【SQL学习笔记】一、select语句
SQL有别于其他的编程语言的一点在于首先处理的并不是写在第一行的语句(select),而是from字句。
为了更详细的了解select语句的每个部分,举例如下:
该语句返回的结果是下订单超过4次的女顾客的列表。
select c.CUSTOMER_ID,,count(o.ORDER_ID) as orders_ct from OE.CUSTOMERS c join OE.ORDERS o on c.CUSTOMER_ID = o.CUSTOMER_ID where c.GENDER ='F' group by c.CUSTOMER_ID having count(o.order_id) >4 order by orders_ct,c.CUSTOMER_ID