zoukankan      html  css  js  c++  java
  • mysql查询表内容

    一,说明:表名为student

    1,查询某个表里的字段

    select 字段名1,字段名1 form student;

    例如:查询student中的sname

    select sname from student;

    2,查询某个表里的字段(字段下面有重复的内容),并且显示的查询结果不显示重复的

    select distinct class from student;

    3,查询加条件

    select * from student where sno='107';

    4,查询某个字段下满足某条件的(class为95031中ssex为女的)

    select * from student where class in(95031) and ssex='女';

    5,模糊查询 

    a,查询sname第一个字是王的(_代表一个字符串)

    select * from student where sname like '王_';

    查询sname第二个字是冰的

    select * from teacher where tname like '_冰';

    b,查询sname第一个字是王的(%代表任意字符串)

    select * from student where sname like '王%';

    c,查询sname含有王的(%代表任意字符串)

    select * from student where sname like '%%';

    where中可用的运算符有:算术运算符: +  -  *  /   %

    比较运算符: >   >=   <    <=   =(等于)   <>(不等于)   ==(等于,mysql扩展),!=(不等于,mysql扩展)

    逻辑运算符: and(与)  or(或) not(非)

    6.分页查询 limit

    limit 0,2    0代表下标  2代表显示的个数

    二,说明 表名为score

    1,查询degree是60到70的

    select * from score where degree between '60' and '70';

    也可以用比较运算符这样写:select * from score where degree>60 and degree<70;

    2,查询表中degree为78和79的

    select * from score where degree='78' or degree='79';

  • 相关阅读:
    Shell是linux下的脚本语言解析器
    semver 是 语义化版本
    js中限制字符串输入中英文字符的长度封装
    chalk.js(node终端样式库)
    分页
    利用Nodejs的os.networkInterfaces()模块修改vuecli项目默认打开地址
    物理像素
    长列表优化eg
    [JSOI2008]球形空间产生器
    标记不下传线段树(混蛋树)
  • 原文地址:https://www.cnblogs.com/wfc139/p/8902506.html
Copyright © 2011-2022 走看看