《mysql必知必会》学习_第四章

P27:

select prod_name from products; # select 列 from 表 # 从表products 中检索 名为 prod_name 的列

P28 多个语句一起必须要加上分号(;)

select prod_name from products;select vend_id from products; #这是两条语句,两个都加上分号,就会一起运行#

P22 

select prod_id,prod_name,prod_price from products; #展开多个列的时候,用逗号(,)把列分开#

 

 P23 

show  * from products;  #通配符(*)返回所有列#

P24

select vend_id from products; #把表products的列vend_id所有出现的值都列出来(包括重复的)#

select distinct vend_id from products; #加上了distinct ,去重#

P25  限制结果

select prod_name from products limit 5;  #在表products 的列prod_name 中选择前5个#

select prod_name from products limit 5,3; ##在表products 的列prod_name 中的第5个值开始选个#

 

P26 使用完全限定的表名

select products.prod_name from products; #product.prod_name限定列prod_name在表products中#

  

select products.prod_id from hh.products; #products.prod_id限定列prod_id是表products 的, 表products是数据库hh中的#

 

posted @ 2018-07-24 17:51  张三疯了  阅读(167)  评论(0编辑  收藏  举报