0% found this document useful (0 votes)
3 views

SQL_Assignment1

The document outlines an assignment for a database systems course, consisting of two questions. The first question requires designing an ER diagram for a company database with specified entities, attributes, and relationships, while the second question involves writing SQL queries based on a given database schema. Students must submit their work as a single PDF file named with their student ID.

Uploaded by

jwr15778002438
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

SQL_Assignment1

The document outlines an assignment for a database systems course, consisting of two questions. The first question requires designing an ER diagram for a company database with specified entities, attributes, and relationships, while the second question involves writing SQL queries based on a given database schema. Students must submit their work as a single PDF file named with their student ID.

Uploaded by

jwr15778002438
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Fundamentals of Database Systems

Assignment 1

Note: there is no requirement on ER diagram drawing. You are allowed to draw ER diagrams
using any tool. But you need to make sure that your drawing is clear enough. If the diagrams
are not clear, points will be deducted.

For the submission, please pack all files and convert them into A SINGLE PDF FILE. Rename
the PDF file as XXXX.pdf, where XXXX is your student ID.

Q1. Suppose you are the manager of a company. You want to design an ER diagram for your
company under the following assumptions. [Remember to express all cardinality and
participation constraints in your diagram.] (50 marks)

The company database has the following entity sets:

- Each person is described as ID, name, gender, age and address.


- Some people are employee. Each employee has an employee ID, salary and position.
- Some people are customers. Each customer has a customer ID. Note that the employee
cannot be the customer.
- The company has several departments. Each department has a department name,
location, phone number.
- Each product series has a series name, product type, and target consumer type.
- Each product has a model and price. Note that the product is a weak entity set which
depends on product series.

The company database has the following relationship sets:

- Each department has a unique manager, who is an employee. An employee can be the
manager for at most one department.
- Each employee works for a unique department. Each department contains more than
one employee.
- Some departments can design product series. Each product series is designed by at most
one department.
- Each product series has one or multiple products.
- Some customers buy some products from the company. For such purchasing, we want
to know the purchasing date and payment method.

You do not need to make more assumptions on your design.


Q2. The schema of a database is given as follows. Keys are underlined. (This database is
independent to the example database in lectures. Please do not be confused.)

- 𝑠𝑡𝑢𝑑𝑒𝑛𝑡 = (𝑠𝐼𝐷, 𝑠𝑛𝑎𝑚𝑒, 𝑔𝑒𝑛𝑑𝑒𝑟, 𝑔𝑝𝑎, 𝑚𝑎𝑗𝑜𝑟, 𝑝ℎ𝑜𝑛𝑒)


- 𝑖𝑛𝑠𝑡𝑟𝑢𝑐𝑡𝑜𝑟 = (𝑖𝐼𝐷, 𝑖𝑛𝑎𝑚𝑒, 𝑔𝑒𝑛𝑑𝑒𝑟, 𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛, 𝑑𝑒𝑝𝑎𝑟𝑡𝑚𝑒𝑛𝑡)
- 𝑐𝑜𝑢𝑟𝑠𝑒 = (𝑐𝐼𝐷, 𝑐𝑛𝑎𝑚𝑒, 𝑐𝑟𝑒𝑑𝑖𝑡)
- 𝑒𝑛𝑟𝑜𝑙𝑙 = (𝑠𝐼𝐷, 𝑐𝐼𝐷, 𝑠𝑒𝑚𝑒𝑠𝑡𝑒𝑟, 𝑔𝑟𝑎𝑑𝑒)
- 𝑡𝑒𝑎𝑐ℎ = (𝑖𝐼𝐷, 𝑐𝐼𝐷, 𝑠𝑒𝑚𝑒𝑠𝑡𝑒𝑟)

Write a query for each following question. Assuming students’ name and instructors’ name are
unique. (10 marks for each)

a) Find the name and credit of the courses instructed by Bruce.


b) Find the name of the students who have taken a course instructed by Bruce.
c) Find the name of the instructors who teach more than one courses in a semester.
d) Count the number of courses and total number of course credits that each students fail
(grade equals to “F”). List the student’s name, number of failed courses and total
number of credits of failed courses in your result.
e) Find the names of students whose earned credits exceed 42 (>42). (If the student does
not fail the course, then he will earn the full credits.)

You might also like