0% found this document useful (0 votes)
56 views1 page

Department of Information Systems

This document contains instructions for a lab exam on database concepts. It provides the schema for a FoodDelivery database including tables for Customers, Dishes, Orders, and OrderDetails. It then lists 6 questions to answer for the exam. For odd student IDs, the questions cover writing DDL statements, creating a trigger, and writing SQL queries. For even student IDs, the questions are similar but cover different aspects of the schema and queries.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views1 page

Department of Information Systems

This document contains instructions for a lab exam on database concepts. It provides the schema for a FoodDelivery database including tables for Customers, Dishes, Orders, and OrderDetails. It then lists 6 questions to answer for the exam. For odd student IDs, the questions cover writing DDL statements, creating a trigger, and writing SQL queries. For even student IDs, the questions are similar but cover different aspects of the schema and queries.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

UNIVERSITY OF INFORMATION TECHNOLOGY LAB EXAM

DEPARTMENT OF INFORMATION SYSTEMS Duration: 60 minutes

Given the database schema for “FoodDelivery” as follows:


Customer (CustomerID, FirstName, LastName, DOB, Address, Phone)
Dish (DishID, Name, Type)
Order (OrderID, CustomerID, DateOfOrder)
OrderDetail (OrderID, DishID, Quantity, Price)

SET 1 (Your student ID is odd)


1. Consider the database schema above and write the required DDL statements. Include the required primary
key, foreign key constraints. Use any valid data types. Use SQL syntax. Insert sample data into the tables
(3-5 rows per table). (3 points)
2. Write a trigger (INSERT, UPDATE) on table Dish to check that the food type must be (‘Appetizer’,
‘Main dish’, ‘Dessert’). (0.5 points)
3. List all customers (CustomerID, FullName, Address) who were born in 2002 in descending order of their
address and ascending order of their last names. (2 points)
4. List the number of dishes for each type of dish (Type, QtyOfDishes). (2 points)
5. List all customers (CustomerID, FullName) who has bought the dishes with the highest price. (2 points)
6. List the number of dishes whose price is over 20 dollars and the number of dishes whose price is below
20 dollars (Qty_Above20, Qty_Below20). (0.5 points)
---THE END---

SET 2 (Your student ID is even)


1. Consider the database schema above and write the required DDL statements. Include the required primary
key, foreign key constraints. Use any valid data types. Use SQL syntax. Insert sample data into the tables
(3-5 rows per table). (3 points)
2. Write a trigger (INSERT, UPDATE) on table Order to check that these ordered must be created after
October 2021. (0.5 points)
3. List all customers (CustomerID, FirstName, LastName, Address) who were NOT born in 2002 in
descending order of their first names and ascending order of the last names. (2 points)
4. List the number of orders each day (DateOfOrder, Qty_Orders). (2 points)
5. List all dishes (DishID, Name) which were bought by the youngest group of customers (only consider
their birth year). (2 points)
6. List the number of dishes whose price is over 20 dollars and the number of dishes whose price is below
20 dollars (Qty_Above20, Qty_Below20). (0.5 points)
---THE END---

You might also like