学习笔记6.8

SELECT prod_name
FROM Products;

SElECT prod_id,prod_name,prod_price
FROM Products;

SELECT *
FROM Products;

SELECT DISTINCT vend_id--取不同
FROM Products;

select * from (select rownum rn,Products.prod_name from Products) where rn <=5;

SELECT prod_name
FROM Products
WHERE ROWNUM <=5;--前5列

select prod_name from Products where rownum <= 9 minus select prod_name from Products where rownum <= 4;--5-9列

select* from Products where rownum <= 9 minus select * from Products where rownum <= 4;--5-9列

--字典序
SELECT prod_name
FROM Products
ORDER BY prod_name;

SELECT prod_name,prod_id,prod_price
FROM Products
ORDER by prod_price,prod_name;


--第一行决定出场顺序,第二行是第一,二关键字,可以用第一行的相对位置表示。
SELECT prod_name,prod_id,prod_price--决定出场顺序 
FROM Products
ORDER by 3,2;

--指定降序排序
SELECT prod_id,prod_price,prod_name
FROM Products
ORDER by prod_price DESC,prod_id DESC;


你可能感兴趣的:(数据库学习笔记)