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;

 

posted @ 2021-04-17 10:52  +D  阅读(60)  评论(0编辑  收藏  举报