CS Professional · Artificial Intelligence, Data Analytics and Cyber Security - Laws and Practice · Database Management
A student and course database records that many students enrol in many courses, with each enrolment also storing the date of enrolment. How should the many-to-many relationship and the enrolment date be implemented in relational tables?
Create a separate Enrolment table holding the student key and course key as foreign keys, forming a composite primary key, with the enrolment date as its own attribute. Many-to-many relationships need a junction table, and relationship attributes belong in it.
- ACreate an Enrolment table with student and course keys as foreign keys and the date as its attributeCorrect
- BStore the enrolment date in the Student table and the course key in each student row
- CStore a list of course IDs in a single column of the Student table
- DAdd the student key to the Course table and keep the date there
Explanation
A many-to-many relationship requires a separate junction table whose key combines the two foreign keys. An attribute of the relationship, such as enrolment date, belongs in that table. Other options store repeating groups or attach the date to the wrong entity, breaking normalisation.
Did you get it right without looking?
One question tells you little. A timed set on Database Management shows your real accuracy, how long you take and where you lose marks.
More Database Management questions
- A company changes the physical storage of its employee records by adding an index and moving files to a new disk, and no application program…
- Which of the following is a characteristic traditionally used to define big data, along with volume and variety?
- A fintech firm's DBMS lets the marketing team see only customer names and cities, while hiding PAN and Aadhaar columns stored in the same ba…
- In a bank's database, the customer table has the column AccountNo as its unique identifier, and the loan table has a column AccountNo that m…
- A Mumbai-based fintech firm stores customer PAN and account details in a relational database. To ensure that a data analyst can run reports …
- A bank's database administrator runs the statement GRANT SELECT ON customer TO audit_team. Which category of SQL sub-language does this stat…