DATABASESYSTEMS
(30 points)
Consider the following relational schema, provided as a SQLite database populated with sample data:
- Product(maker, model, type)
- PC(model, speed, ram, hd, price)
- Laptop(model, speed, ram, hd, screen, price)
- Printer(model, color, type, price)
Write SQL statements for the following queries (5 points each) in the given quiz-1.sql file:
- What makers produce Laptops cheaper than $2000 with a screen larger than 16?
- What makers produce PCs but do not produce Laptops?
- For every maker that sells both PCs and Printers, find the combination of PC and Printer that hasmaximum price. Print the maker, the PC model, Printer model, and the combination price (PC price + Printer price).
- What Laptop hd sizes are offered in at least 2 different models?
- What PCs are less expensive than all the Laptops? Print the model and the price.
- What makers produce at least a Laptop model and at least 2 Printer models?
We will grade your quiz by running the quiz-1.sql file on the given database and another database populated with different data. So, make sure your SQL statements are general. You should test that your code works without errors by running the command sqlite3 data.sqlite < quiz-1.sql in the terminal. quiz-1.sql is the only file you have to turn in.
Reviews
There are no reviews yet.