0% found this document useful (0 votes)
5 views4 pages

MS - Monthly - Databases

Uploaded by

h23911589
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

MS - Monthly - Databases

Uploaded by

h23911589
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Computer Science 9618

Monthly Test | AS

Databases | Marking Scheme


Total Marks: 22

Section A: Scenario-Based Questions


1. Music Streaming Database Scenario
(a) Primary Key Identification (1 mark)
- Marking: Award 1 mark for correctly underlining UserID and SongID as the composite primary key.
- Example Answer: Playlist(UserID, SongID, AddedDate)

(b) Definition of 3NF (2 marks)


- Marking:
- 1 mark for a correct definition: A table is in 3NF if it is in 2NF, and
no non-key attribute/field:
- is dependent on another non key attribute
OR
- is transitively dependent on the primary key.
- 1 mark for explaining its importance: Ensures data integrity and minimizes redundancy.
- Example Answer:
- Definition: A table is in 3NF if [it is in 2NF and] all non-key attributes are [non-transitively dependent on
the primary key or] not dependent on another non-key attribute.
- Importance: This reduces data duplication and improves data integrity.

(c) ER Diagram Completion (2 marks)


- Marking:
- 1 mark for correctly indicating the relationships between User and Playlist.
- 1 mark for correctly indicating the relationships between Song and Playlist.
- Example Answer:

- Show User to Playlist as a 1-to-many relationship and Playlist to Song as a many-to-1


relationship.

Page 1 of 4
Computer Science 9618
Monthly Test | AS

Databases | Marking Scheme


(d) DDL Command for Playlist Table (3 marks)
- Marking:
- 1 mark for defining UserID and SongID as a composite primary key.
- 1 mark for including foreign key constraints.
- 1 mark for correct table creation syntax.
- Example Answer:
CREATE TABLE Playlist (
UserID INTEGER,
SongID INTEGER,
AddedDate DATE,
PRIMARY KEY (UserID, SongID),
FOREIGN KEY (UserID) REFERENCES User(UserID),
FOREIGN KEY (SongID) REFERENCES Song(SongID)
);

Section B: SQL Practical Application

2. Data Modification and Retrieval

(a) Inserting Data (2 marks)


- Marking:
- 1 mark for correct INSERT INTO syntax.
- 1 mark for accurate value insertion.
- Example Answer:
INSERT INTO Playlist (UserID, SongID, AddedDate)
VALUES (2024, 5678, “2024-11-05”);
OR
INSERT INTO Playlist
VALUES (2024, 5678, “2024-11-05”);

p.s. single or double quotes both are allowed for date

(b) Updating Data (2 marks)


- Marking:
- 1 mark for correct UPDATE syntax.
- 1 mark for accurately setting AddedDate.
- Example Answer:
UPDATE Playlist
SET AddedDate = ‘2024-11-06’
WHERE UserID = 2024 AND SongID = 5678;

Page 2 of 4
Computer Science 9618
Monthly Test | AS

Databases | Marking Scheme


(c) Query to List Songs (3 marks)
- Marking:
- 1 mark for the correct SELECT clause.
- 1 mark for using an inner join between Playlist and User.
- 1 mark for the correct WHERE condition and ORDER BY clause.
- Example Answer:
SELECT Playlist.UserID, Username, AddedDate
FROM Playlist
INNER JOIN User ON Playlist.UserID = User.UserID
WHERE SubscriptionType = 'Premium'
ORDER BY AddedDate DESC;

OR

SELECT Playlist.UserID, Username, AddedDate


FROM Playlist, User
WHERE Playlist.UserID = User.UserID
AND SubscriptionType = 'Premium'
ORDER BY AddedDate DESC;

Section C: Database Management

3. Concurrency Control (3 marks)


This is a general question, so any understandable response with a reference to issues and a solution is
accepted. Answer must refer issues and solution in databases context.
- Marking:
- 1 mark for mentioning a potential issue, such as data inconsistency or deadlock.
- 1 mark for another potential issue.
- 1 mark for an effective method to manage concurrency (e.g., locking mechanisms or isolation levels).
- Example Answer:
- Issues: Data inconsistency when two users update the same record at the same time. Deadlocks when
two transactions wait for resources locked by each other.
- Management: Use of database locks and implementing proper isolation levels.

4. Adding a Column (1 mark)


- Marking: 1 mark for correct ALTER TABLE syntax.
- Example Answer:
ALTER TABLE Song ADD COLUMN Duration TIME;

Page 3 of 4
Computer Science 9618
Monthly Test | AS

Databases | Marking Scheme


5. Dropping Constraints (1 mark)
- Marking: 1 mark for correct syntax to drop the primary key.
- Example Answer:
ALTER TABLE Playlist DROP PRIMARY KEY;

Section D: Advanced Database Concepts

6. ER Diagram Explanation (2 marks)


- Marking:
- 1 mark for sensibly explaining what relationships means in an ER diagram with reference to
PK and FK need in it. (e.g., 1-to-many).
- 1 mark for providing an example (e.g., User to Playlist as 1-to-many).
- Example Answer:
- Explanation: Relationship refers to the number of instances of one entity that can be associated with an
instance of another entity. Any correct answer is acceptable.
- Example: In a music streaming platform, a User can have many Playlists, making it a 1-to-many
relationship.

Page 4 of 4

You might also like