SQL语言练习:[1]单表查询
单表查询是相对多表查询而言的,指从一个数据表中查询数据。
查询所有的记录
select*
from student
“*”代表数据表中所有的字段
例:select studentname,studentage
from student
![SQL语言练习:[1]单表查询](https://exp-picture.cdn.bcebos.com/94af5fc1b727ac536bfc01982ecadce8914899c8.jpg)
查询某些字段不同记录
selectdistinct studentage
from student
“distinct”保留字指在显示时去除相同的记录,与之对应的是“all”将保留相同的记录,默认为“all”。
![SQL语言练习:[1]单表查询](https://exp-picture.cdn.bcebos.com/01bd69f7980e5f203505cf6fbd20b93acc898ec8.jpg)
单条件的查询
select *
from student
where studentage>17
组合条件的查询
select *
from student
where studentage>17and studentsex='男'
以上就是单表查询所讲的内容
(共篇)下一篇:阅读量:40
阅读量:165
阅读量:41
阅读量:125
阅读量:160