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='男'
以上就是单表查询所讲的内容
(共篇)下一篇:声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:155
阅读量:182
阅读量:171
阅读量:137
阅读量:34