Skip to content
Question 58 of 95

Q.While creating a table, which constraint does not allow insertion of duplicate values in the table ? (A) UNIQUE (B) DISTINCT (C) NOT NULL (D) HAVING

CBSECBSE Class XII Board 2025MCQ· 1mImportance★★★★★
61% · 58/95 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 →

A constraint is a rule enforced at the database level; UNIQUE is the constraint that prevents duplicate values in a column. The answer is (A).

When you design a database table, you want to enforce certain rules on what data can be stored. These rules are called constraints, and they live in the table definition itself — the database engine checks them automatically every time you try to insert or update a row.

The question asks which constraint blocks duplicate values. Let's see what each option actually does.

Understanding the options

  1. UNIQUE — This is a table constraint. When you declare a column (or combination of columns) as UNIQUE, the database refuses any INSERT or UPDATE that would create a duplicate value in that column. For example:

    CREATE TABLE students (
        roll_no INT UNIQUE,
        name VARCHAR(50)
    );
    

    Now you cannot have two students with the same roll_no. The database enforces this rule.

  2. DISTINCT — This is not a constraint; it's a keyword used in SELECT queries to filter out duplicate rows from the result set. It doesn't prevent duplicates from being inserted — it only affects what you see when you retrieve data:

    SELECT DISTINCT city FROM customers;
    

    The table can still contain duplicate cities; DISTINCT just shows each city once in the output.

  3. NOT NULL — This constraint ensures a column cannot contain NULL values. It has nothing to do with duplicates. You can have a column that is NOT NULL and still insert the same value multiple times:

    CREATE TABLE products (
        product_id INT NOT NULL,
        name VARCHAR(100)
    );
    ``` …
    

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.