You are on page 1of 2

CYPRUS INTERNATIONAL UNIVERSITY

FACULTY OF ENGINEERING
CMPE344, Database Management Systems II
Homework #1 (5%)
Spring 2022-2023
Submission Deadline 30th of March 17.00pm (Late submissions will not be
accepted)
Instructor: Prof Dr Melike Şah Direkoğlu
For the following questions, use the given tables below.

Customers Table:

CustomerID CustomerName Address City


1 Ali Yasemin sokak, Gonyeli Nicosia
2 John Ataturk Bulvari, Karakol Famagusta
3 Mary Rauf Denktas Bulvari Kyrenia
4 Jane Gul sokak, Hamitkoy Nicosia
5 Anna Zeytin sokak, Catalkoy Kyrenia

Orders Table:
OrderID CustomerID ProductID Quantity OrderDate
1000 5 1 1 2023-03-20
1001 3 4 3 2023-03-21
1002 2 3 2 2023-03-22
1003 1 2 2 2023-03-23
1004 1 2 1 2023-03-23

Products Table:
ProductID ProductName CategoryID UnitPrice
1 Hair Dryer 2 400
2 T-shirt 1 100
3 Book 4 200
4 Pizza 3 150

Create the given tables in a customer database in MySql DBMS. Then, write SQL queries
according to the given questions below. For each question, show your SQL query solutions, as
well as, the screen shot of the results.
Q1. Write SQL query to find the name of the customers located in Kyrenia.

Q2. Display name and address of the customers, where the address contains the keyword
‘sokak’. Order the results in alphabetical address order.

Q3. Display the name of the customer, the product name s/he ordered, unit price of the
product and the order quantity.

Q4. Display the minimum, the maximum and the average price of products in the products
table.

Q5. Find the name(s) of customers who did not order a product in the order table.

Q6. Write a SQL query to increase the price of categoryID 2 products by 10 percent.

Bonus Question: Display the total price for each customer based on their individual orders
(i.e. John ordered two books, total price becomes 2*200=400).

Note: For all questions clearly show the SQL query and the screen shot of the query result from
MySQL database. Submit your solutions as one pdf file.

You might also like