zoukankan      html  css  js  c++  java
  • 2017-11-2

     今天学习了下mysql数据库,学习起来真的很吃力啊。好多东西当时感觉理解了 会了,过上几个小时就有模糊了,而且这个真的要英语功底啊。报个错不知道啥意思,写几个英语单词还出错,检查好几遍都查不到。

    像  查询Student表中的所有记录的Sname、Ssex和Class列     其实很简单的东西  就是select Sname,Ssex,Class from Student;  但是这几个单词打起来也是麻烦  而且这么简单的操作 或许上午学习了 下午就有可能忘掉。还是多几下把。

    简单记一下吧 :

    1、 查询Student表中的所有记录的Sname、Ssex和Class列。 

          select Sname,Ssex,Class from Student  

    2、 查询教师所有的单位即不重复的Depart列。

           select distinct Depart from Teacher

    3、 查询Student表的所有记录。

         select * from Student
     

    4、 查询Score表中成绩在60到80之间的所有记录并按成绩顺序排列。

    select * from Score where Degree >=60 and Degree <=80 order by Degree
    select * from Score where Degree between 60 and 80 order by Degree

    5、 查询Score表中成绩为85,86或88的记录。

    select * from Score where Degree in (85,86,88)

    6、 查询Student表中“95031”班或性别为“女”的同学记录。

    select * from Student where Class =95031 or Ssex ='女'

    7、 以Class降序查询Student表的所有记录。

    select * from Student order by Class desc  

    8、 以Cno升序、Degree降序查询Score表的所有记录。

    select * from Score order by Cno,Degree desc

  • 相关阅读:
    Django: ModelForm中Meta的fields等成员介绍
    python的random函数
    设置mysql隔离级别
    ubantu 下 修改mysql 默认编码
    jdbc 模板 连接
    sql 注入 与解决
    jdbc 简单连接
    动态代理 例子
    自定义的一个数据输入类
    类加载器 读取配置文件
  • 原文地址:https://www.cnblogs.com/dongweichang/p/7775243.html
Copyright © 2011-2022 走看看