数据库学习知识点

查询语句基本结构
select + from + where + order by;

分类 投影操作 (select) 查询结果显示列

select 列名 from 表名 where 条件
* 指代查询显示所有

表前缀 select class.c_name form class8
列别名 select c_name as ‘姓名’ from class
字符拼接 select concat(c_name,’-‘,c_add) from stu;
排除重复数据 select distinct c_age from stu;
select distinct c_age,c_name from stu
## 组合查询排除重复
返回限定行数查询 select * from stu limit 0,3;
# 从第一行开始,查询3条数据
select * form stu limit 2
# 查询显示数据为 2 行

选择操作

       and             where id=1 and name=‘张’
       or              where id=1 or id=3
       between         where year between 18 and 20
       in (not in)     where year in (18,19,20)
       like            where iname=张%’  (模糊查询)

       处理控制数据   is null (not null)

排序操作 结果以什么顺序显示

你可能感兴趣的:(数据库,学习知识总结)