SQL必知必会学习笔记1-Kane

一.检索数据

  • 检索单个列
select prd_name
from products;
  • 分号表结束
  • 不区分大小写
  • 空格无意义
  • 多个列时列之间加逗号,结尾不加
select prod_id,prod_name,prod_proce
from products;
  • 检索所有列
select*
from products;
  • 检索不同值
  • dinstinct关键字作用于其后所有列,只有某两行完全相同才会被合并
select distinct vend_id
from products;
  • 限制结果
select prod_name
from products
limit 5;
limit 5,offset 5;
(limit 5,5;)

猜你喜欢

转载自blog.csdn.net/weixin_42862067/article/details/81510969