MySQL必知必会-4、检索数据

为了使用select检索数据,必须至少给出两条信息-----想选择什么,从什么地方选择

索引单个列

select title from t_blog;

 检索多个列

select title,flag,create_time from t_blog;

 检索所有列

select * from t_blog;

检索不同行(distinct)

select distinct flag from t_blog;

限制结果(limit)

select title from t_blog limit 5; # 返回前五行
select title from t_blog limit 2,2;  # 返回第二行之后的两行

 使用完全限定的表名

select t_blog.title from t_blog limit 2,2;

select t_blog.title from blog.t_blog limit 2,2;

原文地址:https://www.cnblogs.com/dong973711/p/14669749.html