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

  • 相关阅读:
    (转)C# BackgroundWorker组件的原理分析
    (转)App.Config详解及读写操作
    (转)C# 控制蜂鸣器发声
    存储过程小例子
    DB通用类:MySQL通用类
    poj 1936 All in All
    Bone Collector 01背包问题
    sdut1359 求最大和子矩阵
    求最大值
    后缀式求值
  • 原文地址:https://www.cnblogs.com/dongweichang/p/7775243.html
Copyright © 2011-2022 走看看