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

  • 相关阅读:
    线程同步总结
    Map,HashMap,LinkedHashMap,TreeMap比较和理解
    实现自定义注解
    SSM框架中写sql在dao文件中以注解的方式
    SSM框架中写sql在xml文件中
    自由创蚁-青少年积木式编程平台正式发布了!
    回调函数
    全面理解Javascript闭包和闭包的几种写法及用途
    hover伪类
    添加背景音乐
  • 原文地址:https://www.cnblogs.com/dongweichang/p/7775243.html
Copyright © 2011-2022 走看看