Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

FIRST SEMESTER 2021

CONTINUOUS ASSESSMENT (CA)

DEPARTMENT: SOFTWARE ENGINEERING LECTURER: NSHOM Samuel


MONTH: DECEMBER 2021 COURSE CODE: ADS201
YEAR: 2021/2022 COURSE TITLE: Advanced Database and SQL
DATE: 16/12/2021 TIME: 8:00 – 10:00am
DURATION: 2 HOURS

INSTRUCTIONS TO CANDIDATES

Before starting this Exam, create a folder on the desktop with the name
format: matricule-ADS201. E.g. SL19T201-ADS201

TASK ONE: 15 marks


(a) Strictly with the use of SQL, create a database in MySQL named „dreamland‟ with the following tables:
customers
**customer_id customer_name address
C1507 MAFON BETILA Bamenda
C1517 KIMBONG BLESS Kumba
C1523 MOYANCHO MALVIN Yaounde
C1525 NDINTECK ALEX Bamenda
C1557 DINSE JOSHUA Buea

products
**product_id *product_name unit_price
PR01 White Rice 21000
PR02 ELENA Tomatoe 5400
PR03 Mayor-Vegetable oil 18000
PR04 SuperJus 3000
PR05 NIPE-Sardine 2500

orders
**SN customer_id product_id order_id quantity Order_date
1 C1507 PR02 CR01 10 2020-12-14
2 C1507 PR05 CR01 5 2020-12-14
3 C1507 PR01 CR01 10 2020-12-14
4 C1523 PR05 CR02 8 2020-12-16
5 C1523 PR03 CR03 4 2020-12-20
**=Primary Key; *=Unique;
b) Create a foreign key constraint for tb_orders.customer_id associating with tb_customers.customer_id.
c) Create a foreign key constraint for tb_orders.product_id associating with tb_products.product_id.
Dean of Studies (+237) 6 54 24 19 83 info@swissLinkedu.com Director: (+237) 6 79 89 48 92
d) Write query statements for the following situations: (NB: Copy each SQL statement into your answer booklet)
(i) inserts a customer from Bamenda whose name is EPIE BISSONG with customer_id C1558.
(ii) selects all customers whose names begin with the character “M”
(iii) changes the name of the customer with customer_id C1517 to ETA BISSONG BECKY
(iv) shows customer_id, customer_name, order_id, product_name, quantity, unit_price, amount
e) Export the database and put into your exam folder.

TASK TWO: 15 marks


Create a database called “foukou” with the Tables below and write SQL queries for the task
tb_customers
CusNo CusFName CusLName CusStreet CusCity CusRegion CusBal
C234 Tom Simon 12 Ave New Town Tiko SW 235 600
C123 Paul Thomas 23 Hill Street Douala LT 150 000
C456 Ruth Silas 123 King Street Edea LT 540 000
C678 Roda Kent 345 Ave city sq Kinbo CE 175 000
C890 Roy Green 671 old Kent Rd Garoua NO 430 000
C213 John Blues 562 College street Limbe SZ 653 000
C476 Saul Tiger 12 Ave mark town Kaele EN 453 000
C788 Daisy Green 17 Care street Douala LT 345 000

tb_orders
OrdNo OrdDate CusNo Product OrdCost
01110 2015/01/23 C890 Cement 340000
01111 2015/01/25 C213 Zinc 350000
02222 2015/02/12 C467 Rice 125000
02220 2015/03/15 C234 Cement 300000
03330 2015/01/28 C678 Wheat 275000
03331 2015/04/24 C123 Cement 175000
04444 2015/05/17 C456 Rice 100000
05555 2015/06/20 C890 Cement 450000
06666 2015/05/19 C213 Wine 180000
07777 2015/07/01 C234 Wine 540000

Write SQL statements to: (NB: Copy each SQL statement into your answer booklet)
a) List the customer number, the name (first and last) and the balance of customers who reside in Douala
b) List the order number, order date, order cost, customer first name and customer city for orders costing
more than 25000 and sent to Douala.
c) List the cities and regions where orders have been placed. Remove duplicates from the results
d) List the customer number, the name (first and last), the city and total order cost of customers who
reside in Limbe
e) Export the database and put into your exam folder.

<<END>>
Dean of Studies (+237) 6 54 24 19 83 info@swissLinkedu.com Director: (+237) 6 79 89 48 92

You might also like