Think & Reflect · Q2
Q.Which two constraints when applied together will produce a Primary Key constraint?
Uttar Pradesh UpmspTextbookSubjective· 2mImportance★★★★★
84% · 38/45 Questions
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 →UNIQUE + NOT NULL together give exactly the behaviour of a PRIMARY KEY: every value must be distinct and a value must always be present.
Why these two?
Think about what a primary key must guarantee (Table 8.2):
- It uniquely identifies each row → no two rows may share a value → that is the UNIQUE constraint.
- It must identify every row, so it can never be missing → the column can't hold NULL → that is the NOT NULL constraint.
Put both on one column and you have re-created the primary-key promise:
CREATE TABLE STUDENT(
RollNumber INT UNIQUE NOT NULL,
SName VARCHAR(20)
);
behaves, for identification purposes, like:
CREATE TABLE STUDENT(
RollNumber INT PRIMARY KEY,
SName VARCHAR(20)
);
``` …
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.