[Assignments] Simple Queries in SQL — Chapter 12 Assignments (Q/A)
Table of Contents
16. Write SQL commands for the following on the basis of given table:
No | Title | Author | Type | Pub | Qty | Price |
---|---|---|---|---|---|---|
1 | Data Structure | Lipschutz | DS | McGraw | 4 | 217 |
2 | Computer Studies | French | FND | Galgotia | 2 | 75 |
3 | Advanced Pascal | Schildt | PROG | McGraw | 4 | 350 |
4 | Dbase dummies | Palmer | DBMS | PustakM | 5 | 130 |
5 | Mastering C ++ | Gurewich | PROG | BPB | 3 | 295 |
6 | Guide Network | Freed | NET | ZPress | 3 | 200 |
7 | Mastering Foxpro | Seigal | DBMS | BPB | 2 | 135 |
8 | DOS guide | Norton | OS | PHI | 3 | 175 |
9 | Basic for beginners | Morton | PROG | BPB | 3 | 40 |
10 | Mastering Window | Cowart | OS | BPB | 1 | 225 |
- Select all the PROG type published by BPB from Library.
- Display a list of all books with Price more then 130 and sorted by Qty.
- Display all the books sorted by Price in ascending order.
Solution:
SELECT * FROM Library
WHERE Type="PROG" AND Pub="BPB" ;SELECT Title FROM Library
WHERE Price > 130
ORDER BY Qty ;SELECT Title FROM Library
ORDER BY Price ;