SQL日常用法—查询

2017-07-12  本文已影响0人  行不离书

SQL—查询的基本用法—查

select这个是查询和其他语法的起点

1、查询表中的全部内容:
语法:select * from 表名

查找所有列表.png

2、条件查找
语法:select 列名 from 表名 where 查询条件表达试

条件查找.png

3、查询排序
语法:select 列名>from 表名 order by 排序的列名[asc或desc]

order by.png

4、模糊查询
语法:select * from where 表名 like 条件(a%)

like用法.png

5、查询表中不重复的数据
语法:select distinct * from 表名
注:distinct 关键词用于返回唯一不同的值。

distinct用法.png

6、between用法
语法:select * from表名 where 列名 between 范围1 and 范围2

between用法.png

7、in 用法
语法:select * from表名 where 名 in (具体值,具体值)

in 用法.png
上一篇 下一篇

猜你喜欢

热点阅读