Mysql常用指令
码农天地 -去重指令
作用:去除select 查询出来的结果中重复的数据,重复数据只展示一列.
关键字:DISTINCT
用法:select DISTINCT source from student_table
source:去重的字段条件
student_table: 表名
select version() --查询系统版本(函数)
用来计算(表达式)select 100*33 as 计算结果 --用来计算(表达式)
查询自增长步长(变量)select @@auto_increment_increment --查询自增的步长(变量)
模糊查询select * from student_table where name like '%刘%' --表示名字中带有刘字的条件;
select * from student_table where name like '刘%' --表示名字以刘字开头的条件;
select * from student_table where name like '刘_' --表示以刘后面只有一个子的条件;
select * from student_table where name like '刘__' --表示以刘后面只有两个字的条件.
select * from student_table where birthdate is not null; 查询出生日期不为空的学生信息.
select * from student_table where birthdate is null; 查询出生日期为空的学生信息.
图示:
结论:inner join 是两边条件都符合的才能执行,null的不算
left join tableone left join tabletwo ,以左边边为准,左边的null能被输出;
特别申明:本文内容来源网络,版权归原作者所有,如有侵权请立即与我们联系(cy198701067573@163.com),我们将及时处理。