Advertisements
Advertisements
प्रश्न
A school has a rule that each student must participate in a sports activity. So each one should give only one preference for sports activity. Suppose there are five students in a class, each having a unique roll number. The class representative has prepared a list of sports preferences as shown below. Answer the following:
| Sports Preferences | |
| Roll_no | Preference |
| 9 | Cricket |
| 13 | Football |
| 17 | Badminton |
| 17 | Football |
| 21 | Hockey |
| 24 | NULL |
| NULL | Kabaddi |
- Roll no 24 may not be interested in sports. Can a NULL value be assigned to that student’s preference field?
- Roll no 17 has given two preference sports. Which property of relational DBMC is violated here? Can we use any constraint or key in the relational DBMS to check against such violations, if any?
- Kabaddi was not chosen by any student. Is it possible to have this tuple in the Sports Preferences relation?
टीपा लिहा
Advertisements
उत्तर
- Yes, a NULL value can be assigned to that student's preference field.
- Property 2 is violated here because each row in a relation is distinct. The primary key can use to identify each row/record in a database table.
- No, it is not possible to have this tuple in the sports preferences relation because Roll_no is the primary key and the primary key does not allow NULL values.
shaalaa.com
Keys in a Relational Database
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
