You are on page 1of 3

CS208 - Databases 2 Assignment

Deadline Part A: 12/04/2022


Deadline Part B: 15/05/2022

Part A: Logical design (list of tables and attributes with data type)
Part B: Implementation and Queries (SQL)

Overview:
The purpose of this assignment is to allow students to get familiarized with
the of database development. You are being provided with requirements for
a hypothetical system, named Supermarket Database (SuperMarketDB)
that manages sales data. The SuperMarketDB database stores the sales of
a global supermarket chain. The objectives of the system are to store and
manage the sales of the supermarkets to customers.

Information management (tables):


There are three types of users in SuperMarketDB. For each user, the
system must verify its identity when accessing the application (via
username / password). Additionally, the following information must be kept
for each user: Identity, Full Name and Role.
The roles and responsibilities of each users are described below:
 Point of Sales Users
 Managers
 System Administrator

A basic set of information that SuperMarketDB should support is listed


below:
 Customer: Identity, First Name, Last Name, Citizenship (Country),
Date of Birth, Gender, Age, Total Purchases
 Supplier: Identity, Name
 Store: Store Name, Manager, City, Number of Employees
 Employee: Identity, First Name, Surname, Citizenship (Country),
DoB, Gender, Age, Recruitment Date, Date of Dismissal
 Product: Name, Product Category, Barcode Code, Brand, Country of
Origin, Size (used volumes), VAT Class, Supplier, Secondary Codes,
 Product Category: Name, Super-category to which the category
belongs (if any)
 Product Offers: It is any combination of products under an offer
(e.g., ketchup + mayonnaise at a specific offer price).
 Customer Invoice: Customer invoices store product sales
information to customers. Each invoice records the date and time it
was created, the customer it belongs to, and includes at least one
product. Finally, each invoice calculates the total amount of all its
products (i.e., quantity * price).
 Supplier Invoice: Vendor invoices store product sales information
from vendors to each store

These tables and attributes are mandatory, you may create more tables
and add more attributes to the existing tables.

For part A you to create a logical design with these tables, including the
tables name, attributes and data types. Also you must specify the primary
key and any foreign key. After the deadline of part A you will receive a
version of the database that you may use in order to create the queries.
This database contains data that you will need get feedback from queries.

Logical design sample:


Customer
Name Nvarchar
Surname Nvarchar
……….. ………..
……….. ………..
Query reports (views):
1. Print the information of all product brands.
2. List all the main product categories (super category e.g. beverages,
bread/bakery etc)
3. Print any city that is recorded in the whole database (only once).
4. List all the employees (name + surname, store name, role) that works
on store with id = 1, the manager must be first on the list.
5. List of customers (name + surname) with the same name as
employees.
6. Report the monthly {use format([Date], 'yyyy-MM')} invoices sorted by
total amount in descending order.
7. List the top 20 highest spending customers for a specific time period
(between 2012 and 2013).
8. Print the product name and the total count for every product that were
sold in all customers.
9. Report all the information regarding products (from all related tables),
meaningful information (no ids).
10. Report the most profitable store.
11. List the suppliers that have the best selling product (supplier name,
product name, category, quantity).
12. Print the offer name, final price and the products included in the offer,
for every offer in the offers table.

Create three (3) queries your own, that they will have the syntax:
select ...
from ...
where ...

For higher marks join two or more tables.

Submission:
For part A a file that shows your work.
For part B export the database (generate scripts) into a file.

You might also like