您的位置:首页 > 数据库

数据库学习知识点

2016-01-04 21:35 525 查看
查询语句基本结构

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)


排序操作 结果以什么顺序显示
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: