23/02/2010
We should understand what is the purpose of the SQL.
(To think about behind the business.)
<SQL>
SELECT Buyer, Department
FROM SKU_DATA;
SELECT DISTINCT Buyer, Department
FROM SKU_DATA;
SELECT *
FROM SKU_DATA;
SELECT *
FROM SKU_DATA
WHERE Department = 'Water Sports';
SELECT SKU_Description, Buyer
FROM SKU_DATA
WHERE Department = 'Climbing';
SELECT *
FROM ORDER_ITEM
ORDER BY OrderNumber, Price;
SELECT *
FROM ORDER_ITEM
ORDER BY Price DESC, OrderNumber ASC;
SELECT *
FROM SKU_DATA
WHERE Department = 'Water Sports'
AND Buyer = 'Nancy Meyers';
SELECT *
FROM SKU_DATA
WHERE Department = 'Camping'
OR Department = 'Climbing';
SELECT *
FROM SKU_DATA
WHERE Buyer IN ('Nancy Meyers', 'Cindy Lo', 'Jerry Martin');
SELECT *
FROM SKU_DATA
WHERE Buyer IN ('Nancy Meyers', 'Cindy Lo', 'Jerry Martin', 'David');
SELECT *
FROM SKU_DATA
WHERE Buyer NOT IN ('Nancy Meyers', 'Cindy Lo', 'Jerry Martin');
SELECT *
FROM ORDER_ITEM
WHERE ExtendedPrice
BETWEEN 100 AND 200;
SELECT *
FROM ORDER_ITEM
WHERE ExtendedPrice >=100
AND ExtendedPrice <= 200;
* "Between" and "=<, >=" are same result, however "=<, >=" is more clear than "between".
0 件のコメント:
コメントを投稿