Uploaded by waseem

examples of sql language (computer science)

advertisement
1.1: SELECT First_Name FROM CUSTOMERS ORDER BY First_Name DESC
1.2: SELECT*FROM CUSTOMERS WHERE (Title='Mr') ORDER BY First_Name ASC
1.3: SELECT*FROM CUSTOMERS WHERE (Title='Mr' AND Memb_Type='Junior') ORDER BY
Last_Name ASC
1.4: SELECT*FROM CUSTOMERS WHERE (NOT Title = 'mr' AND Town = 'Solihull') ORDER BY
Last_Name ASC
1.5: SELECT*FROM CUSTOMERS WHERE (Memb_Date <#31/01/2014#) ORDER BY First_Name
ASC
1.6: SELECT*FROM CUSTOMERS WHERE (Memb_Date > #31/12/2013# AND Memb_Date <
#01/01/2015# ) ORDER BY First_Name ASC
1.7: SELECT*FROM CUSTOMERS WHERE (Pay_Type LIKE '*Card') ORDER BY First_Name ASC
1.8: SELECT*FROM CUSTOMERS WHERE (Memb_Type = 'senior' AND (Town = 'Croydon' OR
Town ='Brighton' OR Town = 'Glasgow' OR Town = 'Solihull')) ORDER BY Town ASC
1.9: SELECT Order_ID, Order_Year, Cust_ID, tin, Order_Value FROM ORDERS WHERE
(Order_Year=2017)
1.10: SELECT Order_ID, Order_Year, Tin, Order_Value From ORDERS WHERE (Order_Year = 2017
AND Tin>2)
1.11: SELECT Order_ID, Order_Year, Tin, Order_Value From ORDERS WHERE (Order_Year = 2017
AND (Order_Value >89 AND Order_Value<120)) ORDER BY Order_Value DESC
1.12: SELECT Count(First_Name) AS NumRecords FROM CUSTOMERS
1.13: SELECT Count(Memb_Type) AS Senior_Membs FROM CUSTOMERS WHERE Memb_Type =
'Senior'
1.14: SELECT COUNT(Memb_Type) AS [member type] FROM CUSTOMERS GROUP BY
Memb_Type
1.15: SELECT Order_Year, SUM(Order_Value) AS [Order Sum] FROM ORDERS GROUP BY
Order_Year
1.16: SELECT Order_Year, AVG(Order_Value) AS [avrg value] FROM Orders GROUP BY
Order_Year
Download