Skip to content
Exercises · Q6
Q.

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:

Table: Sports Preferences

Roll_noPreference
9Cricket
13Football
17Badminton
17Football
21Hockey
24NULL
NULLKabaddi
  1. Roll no 24 may not be interested in sports. Can a NULL value be assigned to that student's preference field?
  2. Roll no 17 has given two preferences in sports. Which property of relational DBMC is violated here? Can we use any constraint or key in the relational DBMS to check against such violation, if any?
  3. Kabaddi was not chosen by any student. Is it possible to have this tuple in the Sports Preferences relation?
Odisha ChseTextbookSubjective· 3mImportance★★★★★
24% · 7/29 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

This question explores fundamental relational database concepts: the meaning of NULL values, the Entity Integrity Constraint, and the role of Primary Keys in enforcing uniqueness and non-nullability to maintain data consistency and adhere to business rules.

Let's break down each part of the question, focusing on the underlying database principles.

(a) Roll no 24 may not be interested in sports. Can a NULL value be assigned to that student's preference field?

A NULL value in a database signifies the absence of a value, meaning it is unknown, not applicable, or not yet provided.

From a purely database schema perspective, if the Preference column is not explicitly defined with a NOT NULL constraint, then assigning a NULL value to it is syntactically permissible. The database management system (DBMS) would allow the entry (24, NULL).

However, the question also states a school rule: "each student must participate in a sports activity." If a student's Preference field is NULL, it implies that their preference is unknown or they have not yet chosen an activity. This directly contradicts the school's business rule that every student must participate.

Therefore, while technically possible to store NULL if no NOT NULL constraint is applied to the Preference column, it would violate the school's operational rule. A well-designed database, intended to enforce such rules, would typically have a NOT NULL constraint on the Preference column to prevent such entries, or it would require a default value indicating "undecided" rather than NULL.

(b) Roll no 17 has given two preferences in sports. Which property of relational DBMS is violated here? Can we use any constraint or key in the relational DBMS to check against such violation, if any?

The table shows two entries for Roll_no 17: (17, Badminton) and (17, Football). This means that Roll_no 17 appears twice in the table.

The problem statement specifies two crucial rules: "each student must participate in a sports activity" and "each one should give only one preference for sports activity." The second rule, "each one should give only one preference," implies that for any given student (Roll_no), there should be only one associated Preference.

The property of relational DBMS violated here is uniqueness, specifically the Entity Integrity Constraint if Roll_no is intended to be the primary key. A primary key is designed to uniquely identify each record (tuple) in a table. If Roll_no is meant to identify a student's single preference, then Roll_no must be unique.

To prevent such a violation, we can use a Primary Key constraint on the Roll_no column.

PRIMARY KEY (column_name)

A Primary Key constraint ensures two things:

  1. Uniqueness: Every value in the primary key column(s) must be unique. No two rows can have the same primary key value.
  2. Non-nullability: No value in the primary key column(s) can be NULL.

If Roll_no were defined as the primary key, the DBMS would automatically check for uniqueness. When an attempt is made to insert the second entry for Roll_no 17 (e.g., (17, Football)), the DBMS would detect that 17 already exists as a primary key value and would reject the insertion, thereby enforcing the "only one preference" rule.

(c) Kabaddi was not chosen by any student. Is it possible to have this tuple in the Sports Preferences relation? …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.