■select
查询表或者视图的数据。
【例】select * from cxck.t产品
where 产品号 = 'a001'
查询where 指定的产品号等于a001的所有列的数据。
【例】select 产品号, 出库数 from cxck.t产品
where 产品号 = 'a001'
查询产品号为 a001 的产品号和出库数。
【例】select 产品号, 出库数 from cxck.t产品
where 产品号 >= 'a001' and 产品号 <= 'a999'
order by 产品号
查询产品号在a001 ~ a999 之间的产品号和出库数,并按 order by 指定的产品号升序排列。
order by 产品号 desc 时,降序排列。
【例】select 产品号, sum(订货数) from cxck.v订货1
where 产品号 >= 'a001' and 产品号 <= 'a999'
group by 产品号
order by 产品号
v订货1 的产品号在a001 ~ a999 之间订货数按 group by 指定的产品号分组合计,并按产品号排序。
Oracle 可以通过from cxck.v订货1 v订货1 使用表的别名。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/174388/viewspace-905935/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/174388/viewspace-905935/