• SQL 笔记


    SQL 笔记

       1.全查

          select * from  test;     查询 test表的全部字段

       2.查询某个字段的值

          select name from  test;    查询 test表的name字段

       3.查询多个字段的值

          select  name,type from  test;  查询 test表的name,type两个字段的数据

       4.条件查询

          select * from  test where age > 36;   查询 test表中符合过滤条件age> 36的值

          select * from  test where type='0' and age > 36;  查询 test表中符合过滤条件type='0' 和 age> 36的值

          select * from  testn where type='0' or age > 36;  查询 test表中符合过滤条件type='0' 或 age> 36的值

       5.区间查询

          select * from  test where age between '10' and '15';查询 test表中符合过滤条件10<=age<=15的值

       6.集合查询

          select * from  test where age in(10,15);

          相当于 select * from  test where age=‘10’ or age =‘15’;

       7.排序

          select * from  test order by age desc;  以age倒序,显示 test的内容 (order by 默认正序asc)

       8.模糊查询

          select * from  test where name like '%羽%';  查询name中带有羽的数据

       9.求和

          select  sum(age)  from  test;

       10.多表联合查询

          select *from token,test;  查询结果:token表和test表以笛卡尔乘积方式显示

       11.插入

          insert into test(name,type,age) value('刘备','1','56');  将value的值对应插入test表的三个字段中

       12.修改

          update test set type='0' where name='刘备';  将name为刘备的type改为0

       13.删除

          delete from test where name='刘备'; 删除test表中name为刘备的内容

  • 相关阅读:
    团体程序设计天梯赛-练习集L1-002. 打印沙漏
    WUOJ-ACM :1003: 零起点学算法78——牛牛
    ZOJ-2965
    天梯赛-L1-018. 大笨钟
    代码哲学 摒弃“够用就行”的心态
    github 源码阅读
    Biopython SeqIO 读取序列文件,读取信息,写入序列
    Biopython 模块处理Seq序列 方法
    coursera 有比较丰富的生物信息等课程 win7 访问设置
    python 正则匹配 csv文件中特殊符号如■高风险 这样的black block
  • 原文地址:https://www.cnblogs.com/Qtoken/p/11190858.html
Copyright © 2020-2023  润新知