SQL语言练习:[1]单表查询

2025-11-21 12:06:52

单表查询是相对多表查询而言的,指从一个数据表中查询数据。

    查询所有的记录

    select*

    from student

            “*”代表数据表中所有的字段

        例:select studentname,studentage 

            from student

    SQL语言练习:[1]单表查询

    查询某些字段不同记录

    selectdistinct studentage

    from student

    “distinct”保留字指在显示时去除相同的记录,与之对应的是“all”将保留相同的记录,默认为“all”。

    SQL语言练习:[1]单表查询

    单条件的查询

    select *

    from student

    where studentage>17

    组合条件的查询

     select * 

    from student 

    where studentage>17and  studentsex='男'

以上就是单表查询所讲的内容

(共篇)下一篇:
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢