Docsity

database system normalization assignment., Assignments of Database Management Systems (DBMS)

Toggle sidebar
bg1
Question 1
a) Analyze the following relational schema and write the SQL code for the given questions.
STUDENT(SID, S_Name, Year)
LECTURER(L_Name, OfficeNumber)
COURSE(CourseID, CourseName, L_Name)
COURSEWORK(SID, CourseID, Marks)
i) What is Hamid office number?
ii) Assume that lecturer Hamid changes his name to Daud. Show the SQL statements
to make the appropriate changes.
iii) What are the names of students who got 75 marks and above for any courses?
iv) Find the names of all current students taking course IAS2143.
v) Find the names of the lecturers who teach each course.
vi) Remove data for student’s name Nabila where her student ID is 200.
(20 marks)
Answer:
i) SELECT OfficeNumber
FROM LECTURER
WHERE L_Name = ‘Hamid’
(3 marks)
ii) UPDATE LECTURER
SET L_Name = ‘Daud’
WHERE L_Name = ‘Hamid’
(3 marks)
iii) SELECT STUDENT.S_Name
FROM STUDENT, COURSEWORK
WHERE STUDENT.SID = COURSEWORK.SID
AND COURSEWORK.Marks >= 75
(4 marks)
iv) SELECT STUDENT.S_Name
FROM STUDENT, COURSEWORK
pf3
pf4

Partial preview of the text

Download database system normalization assignment. and more Assignments Database Management Systems (DBMS) in PDF only on Docsity!

Question 1 a) Analyze the following relational schema and write the SQL code for the given questions. STUDENT(SID, S_Name, Year) LECTURER(L_Name, OfficeNumber) COURSE(CourseID, CourseName, L_Name) COURSEWORK(SID, CourseID, Marks) i) What is Hamid office number? ii) Assume that lecturer Hamid changes his name to Daud. Show the SQL statements to make the appropriate changes. iii) What are the names of students who got 75 marks and above for any courses? iv) Find the names of all current students taking course IAS. v) Find the names of the lecturers who teach each course. vi) Remove data for student’s name Nabila where her student ID is 200. (20 marks) Answer: i) SELECT OfficeNumber FROM LECTURER WHERE L_Name = ‘Hamid’ (3 marks) ii) UPDATE LECTURER SET L_Name = ‘Daud’ WHERE L_Name = ‘Hamid’ (3 marks) iii) SELECT STUDENT.S_Name FROM STUDENT, COURSEWORK WHERE STUDENT.SID = COURSEWORK.SID AND COURSEWORK.Marks >= 75 (4 marks) iv) SELECT STUDENT.S_Name FROM STUDENT, COURSEWORK

WHERE STUDENT. SID = COURSEWORK.SID

AND COURSEWORK.CourseID = ‘IAS2143’ (4 marks) v) SELECT COURSE.Lecturer FROM COURSE, COURSEWORK, STUDENT WHERE COURSE.CourseID = COURSEWORK.CourseID AND COURSEWORK.SID = STUDENT.SID (4 marks) vi) DELETE STUDENT WHERE S_Name = ‘Nabila’ and SID = ‘200’ (2 marks) Question 2 a) The Gill Art Gallery wishes to maintain data on their customers, artists and paintings. They may have several paintings by each artist in the gallery at one time. Paintings may be bought and sold several times. In other words, the gallery may sell a painting, then buy it back at a later date and sell it to another customer. Gallery Customer History Form Customer Name Miss Fatimah Yusof Phone (013) 323 6000 21 Jalan Meranti Satu Taman Sri Muda 40400 Shah Alam Selangor Purchases Made Artist Title Purchase Date Sales Price 03 - Carol Channing Laugh with Teeth 09/17/2000 7000. 15 - Dennis Frings South toward Emerald Sea 05/11/2000 1800. 03 - Carol Channing At the Movies 02/14/2002 5550. 15 - Dennis Frings South toward Emerald Sea 07/15/2003 2200.

b) Draw an entity-relationship model for the following statement: A university consists of several faculties. Within each faculty there are several departments. Each department may run a number of programme. Every programme is composed of several subjects. A lecturer may teach many subjects and each subject may be taught by a number of lecturers. All subjects is enrolled by many student. (10 marks) Answer: consists 1 M 1 M M 1 1 M M N M N (Each entity 1 mark x 7 = 7 marks, each r/ship ½ m x 6 = 3 marks; total 10 marks)

UNIVERSITY

PROGRAMME DEPARTMENT

FACULTY

has SUBJECT run compose teaches LECTURER STUDENT enroll