Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

CAE203 – Database Systems Assignment

Release Date: November 6, 2020


Submission Date: November 30, 2020

Maximum Marks: [40]

Instructions
……………..
1. You are expected to work in groups and all the members in the group must equally
contribute in completion of the task assigned.
2. The prescribed front page should be used and all the details must be filled up correctly.
3. Marks will be deducted for late submission.

Mark Distribution:

Question 1: ER Diagram(10)

i. Entities and their respective attributes


ii. Relationship sets & Cardinalities
iii. ER-Diagram
iv. Relational Schema

Question 2 : Finding Candidate Keys (5)

Question 3: SQL (25)

Question:4 Normalization (10)


1. Construct the ER-Diagram, identify different entities and specify their attribute
types. Show the relationship which exist between the entities. What type of
relationships exists among different entities? Mention any necessary
assumptions that you make.
Scenario:1
HBC Enterprise is a real estate company which deals in buying and selling of
houses, shops, flats and plots (both commercial and residential). It has a number of
offices within the country.
When an owner wishes to sell a property through HBC Enterprise, the manager
from the most convenient branch normally visits the location to assess the selling
price. Assuming that the owner agrees to this price, and to the company’s
commission charge (normally 2% from both parties), the property is then added to
the property list for that branch. Prospective purchasers are given a copy of this list
on request. In some cases if a dealer is involved, then both parties divide the
commission with a percentage normally 50%. .
Using the above scenario construct the ER-Diagram, identify different entities and
specify their attribute types. Show the relationship which exist between the entities.
What type of relationships exists among different entities? Mention any necessary
assumptions that you make.

2. Suppose you are given a relation R with four attributes ABCDE. For each of the
following sets of FDs, assuming those are the only dependencies that hold for
R, do the following: Identify the candidate key(s) for R.

1. AE → D, C → A, E → C

2. B → C, D → A , B C → E

3. ABC → D, DB → A, D → B, E → C

4. C → B, BC → A, AE → D

5. ABC → E, AC → D, AC → A, D → B
Question:3

Roll_No Name DOB DepID Sem Mark Contact_No Gender


10001 Kezang Tshering 12/23/1994 1 1 80 272121 F
10002 Kumbu Dorji 11/28/1995 1 1 70 232122 M
10003 Namgyal 08/15/1994 4 1 65 112121 M
10004 Ngawang 11/03/1991 2 3 46 123123 M
10005 Wangmo 11/30/1992 3 3 53 453667 F
10006 Phuntsho 10/03/1992 2 1 71 323232 M
10007 Sangay Choden 11/03/1994 2 3 91 124244 F
10008 Sonam Phuntsho 11/04/1993 3 1 16 646342 F
10009 Sonam Wangdi 09/03/1990 3 3 36 328656 M
10010 Tashi Dendup 01/03/1989 4 3 68 257422 M
10011 Tashi 12/23/1995 3 1 52 754124 F
A. Create a relational database that contains the following tables with the
following constraint and inserts the following data into these tables.

Dept_ID Dept_Name Tutor_Name Relation :


1 Information Technology Pema Student Pk:Roll_no
2 Electrical Tshering FK: Dept_id
3 Civil Sangay
4 Mechanical Sonam
5 Chemical Dorji

Relation : Department PK: Dept_id

Identity constraint – Rollno

Check constraint- Mark (range 0-100)

Default constraint –Gender( value-‘U’)


Now, solve the following SQL Queries.

1. Display the name, date of birth and contact numbers of all the first-semester MALE students.
2. Display the name and roll number of all the students who are either first semester and a third
semester in the descending order.
3. List the student name, whose name is starting in ‘S’ with five characters.
4. Display Department id, number of students from the student table based on department id.
5. Display department id from the student table where it has at least 3 students is enrolled.
6. Display student names from the student table who was born between 1 Nov ‘94 and 31 Dec. ‘95.
7. List the student names whose name having letter 'n' as the third character.

8. List the name of students whose roll numbers are 10001,10004,10005,10007,10009


9. Display roll no and name not belonging to department 3 or 4.
10. List the five character names starting with ‘T’ and ending with ‘I’
11. Display department number and maximum mark for each department.
12 List the maximum, minimum and average mark in the student table.
13. Display the department id, semester id, No of students and Avg marks based on department and
semester where average mark greater than or equal 50.
14. Display all the unique semester ids in the descending order from the student table
15. Display the lowest mark among students(without aggregate function)
16 Display student name, age from the student table and display the result in ascending order based on
student name.
17 Display student names who are born in the month of November.
18 Display Gender, total marks(based on gender ) from the student table
19 Display Student name, the day of born, Month of born, year of born from the student table
20 Display Student name, Gender, total mark(mark*5) from the student table.
4. Describe and illustrate the process of normalizing in the table given below from
Normal Form 1 to Normal form 3.
The following table structure contains many unsatisfactory components and
characteristics. (For example, there are several multi-valued attributes, some naming
conventions are violated, some attributes are not atomic, and so on.)

You might also like