sql查询数据介绍

sql查询数据表数据sql语句查询数据表数据是通过select语句实现的基本语法:
select * from 表名
例如:查询user表中的数据
select * from user;
sql语句查询指定字段基本结构:
select 字段名称... from 表名
例如:查询表user中的name字段
select name from user;
使用列别名查询sql语句的列别名是通过as实现的。select 字段名 as 列别名 from 表名
例如:
select name as 用户名称 from user;
查询不重复的数据distinct基本语法:
select distinct 字段名称 from  表名
例如:查询名称不重复的数据
select distinct name from user;

转载于: 59biye网http://www.59biye.com/sql/cont/pid/223/id/238.shtml

猜你喜欢

转载自benben.iteye.com/blog/1767695
今日推荐