MySQL数据检索

1. MySQL数据检索 检索单个列 select prod_name from products; 检索多个列 select prod_id, prod_name, prod_price from products; 检索所有列 select * from products; 检...
1. MySQL数据检索

检索单个列
select prod_name from products;

检索多个列
select prod_id, prod_name, prod_price from products;

检索所有列
select * from products;

检索不同的行
select distinct vend_id from products;

限制结果
返回前3条结果
select prod_name from products limit 3;
返回从第5条开始的3条结果
select prod_name from products limit 5,3;
select prod_name from products limit 3 offset 5;

完全限定的表名
select products.prod_name from test.products;

1. distinct关键字
    去重复
2. limit关键字
    limit y 其中y表示检索的最多行数
    limit x,y 其中x表示从x个开始,y表示检索的行数
3. offset关键字
    limit y offset x 其中x表示从x个开始,y表示检索的行数

原文出处:http://andrew7676.iteye.com/blog/2430184

  • 发表于 2018-09-17 23:43
  • 阅读 ( 345 )
  • 分类:网络文章

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除