sql 操作、
简单查询 select * from 色了个星 佛目
查询所以用户的名字,岗位, 工资
select 名字的值,岗位的值,工资的值 from 表名的值;
去重复查询 distinct 第死停特 去掉重复的值 查询的时候支持一列
列用算查询所以的员工 工资加2000
select 员工名字的值,工资的值+2000 from 表名字;
查询所以员工的年薪,不考虑奖金
select 员工的值,工资的值*12 from 表名称;
NULL 空 判断
is null 空
查询所以奖金为空的用户
select * from 表名称,( where 万儿 条件) 奖金的值 is null;
is not null 非空
查询所以奖金不为空的用户
selct * from b表名称 where 条件 奖金的值 is not null;
查询所有员工的年薪考虑奖金 ifnull 判断 (奖金的值,0)
select 员工的值,工资的值*12+ifnull(奖金的值,0) from 表名称;
模糊查询:like (赖克)占位符合% 一个%等于多个字符
select * from 表名称 where like '' %用户名称% '';
精准查询:
select * from 表名称 where like " __用户名称";
关系用算符:
=,>,<,>=,<=,!=
查询工资等于8000的用户
select * from 表名称 工资的值=8000;
查询工资不等于8000的用户
select * from 表名称 工资的值 !=8000;
查询工资大于8000的用户
select * from 表名称 工资的值 >=8000;
查询工资小于8000的用户
select * from 表名称 工资的值 <=8000;
逻辑运算符:
and ( 按的)与 前后都满足
or (喔的)前后条件满足一个就行
select * from 表名称 where 用户名称的值="用户名称" or 用户名称的值="用户名称";
分页展示 limit (里米特) 要跟两个值 0,3 0开始要3个长度
select * from 表名称 limit 0,1;
正序 ” asc ; ordey by (哦的) (拜) 工资的值 asc :
select * from 表名称 ordey by 工资的值 asc;
倒序 年龄 desc;
select * from 表名称 ordey dy 年龄的值 desc;