- MySQL查询
- 查询所有字段:
select * from 表名;
- 查询指定字段:
select 列1,列2,... from 表名;
- 使用as 给字段取别名:
select id as 序号, name as 名字 from 表名;
- 消除重复行:在select后面列前使用distinct可以消除重复行
select distinct 列1,... from 表名;
- 条件查询
- 使用where子句对表中的数据筛选,结果为true的行会出现在结果集中
select * from 表名;
select 列1,列2,... from 表名;
select id as 序号, name as 名字 from 表名;
select distinct 列1,... from 表名;