Essential SQL Concepts for 2025 Interviews Quiz

Strengthen your SQL interview preparation with this quiz covering fundamental questions about SQL usage, data management, keys, constraints, and relational database principles. Each question is crafted to help you master the essential SQL concepts expected in 2025 job interviews for roles like data analyst, developer, and engineer.

  1. Difference Between DBMS and RDBMS

    Which of the following best describes a key distinction between a DBMS (Database Management System) and an RDBMS (Relational Database Management System)?

    1. An RDBMS allows relationships between tables, while a DBMS stores data in separate, unrelated files.
    2. A DBMS requires unique keys for each record, while an RDBMS does not enforce uniqueness.
    3. A DBMS enforces relationships between data, whereas an RDBMS does not.
    4. A DBMS organizes data in related tables, while an RDBMS stores data as flat files only.

    Explanation: The main difference is that an RDBMS supports relationships between tables using keys, whereas a DBMS manages data as isolated files without enforcing relationships. Option A is incorrect because 'flat files' describe traditional DBMS, not RDBMS. Option B reverses their functions. Option D is incorrect since RDBMS emphasizes unique keys more than DBMS does.

  2. Understanding Primary Key

    In a classroom database table containing columns for name, address, phone, and roll number, which column would be the most appropriate to designate as the primary key?

    1. Address
    2. Roll number
    3. Phone
    4. Name

    Explanation: The roll number uniquely identifies each student, making it the ideal choice for a primary key. Names and addresses can repeat among students, so they cannot guarantee uniqueness. Though phone numbers are often unique, some may be shared or missing, making them unreliable. Roll numbers never duplicate and help ensure data accuracy.

  3. Role of a Foreign Key

    When connecting a ‘Students’ table with a ‘Courses’ table in a database, what purpose does a foreign key serve?

    1. It creates a new table automatically.
    2. It prevents any duplicate data in both tables.
    3. It uniquely identifies each row in a single table.
    4. It connects records in one table to related records in another.

    Explanation: A foreign key links two tables, allowing data in one table to reference related data in another, such as linking students to the courses they take. Option A is incorrect as foreign keys do not create tables. Option B describes a primary key, not a foreign key. Option D is not accurate since foreign keys don't prevent duplicates by themselves.

  4. NOT NULL Constraint Usage

    If a column in a SQL table is defined with the NOT NULL constraint, which rule does it enforce for data entry in that column?

    1. No two entries can be identical.
    2. Entries must be automatically generated.
    3. Each row must have a value; no blanks are allowed.
    4. Every entry must be a positive number.

    Explanation: The NOT NULL constraint ensures that a column cannot have missing or empty values, requiring data in every row. Option A describes the UNIQUE constraint. Option B is not enforced by NOT NULL but could be checked with other constraints. Option D is unrelated, as NOT NULL does not auto-generate values.

  5. Purpose of the UNIQUE Constraint

    Why would you use the UNIQUE constraint on an email column in a user table?

    1. To ensure only uppercase letters are used in email addresses.
    2. To prevent duplicate email addresses for different users.
    3. To keep the email column non-empty.
    4. To connect emails to another table as a foreign key.

    Explanation: The UNIQUE constraint stops duplicate values from being entered in the specified column, ensuring each user's email is distinct. Option B refers to NOT NULL, not UNIQUE. Option C is about foreign keys, and Option D is unrelated since case sensitivity is not enforced by UNIQUE.

  6. Primary Key Characteristics

    Which property must every primary key have in a relational database?

    1. It can have duplicate values if necessary.
    2. It must always reference another table.
    3. It is always composed of more than one column.
    4. It cannot contain NULL (empty) values.

    Explanation: A primary key requires that each value be unique and not NULL, ensuring correct identification of rows. Option A is incorrect because duplicates are not allowed. Option B refers to foreign keys, not primary keys. Option D is incorrect, as a primary key can consist of one or more columns, but it's not mandatory to have multiple columns.

  7. Benefits of RDBMS

    What is a significant advantage of using an RDBMS when managing large sets of student records?

    1. Relationships between tables simplify organized data retrieval.
    2. It prevents all users from accessing data simultaneously.
    3. Data is randomly scattered, making searching faster.
    4. RDBMS cannot handle large amounts of data.

    Explanation: An RDBMS enables efficient querying and retrieval of related data across different tables, which is especially helpful with large datasets. Option A is not a benefit, as organized data is preferable to scattered data. Option C is incorrect since RDBMS supports multiple user access. Option D is false; handling large data is a strength of RDBMS.

  8. Constraint Scenario: Range Inputs

    In a database form, if you want to ensure that entered ages are only between 18 and 60 years, which SQL feature or constraint should you use?

    1. UNIQUE constraint
    2. PRIMARY KEY constraint
    3. CHECK constraint
    4. DEFAULT constraint

    Explanation: The CHECK constraint is used for enforcing rules about the values in a column, such as limiting age inputs to a certain range. UNIQUE only requires that values be different, not that they're within a range. PRIMARY KEY is for unique identification, and DEFAULT specifies a value to use if none is provided—not a range.

  9. Multiple Users in RDBMS

    How does an RDBMS support multiple users working with the same data at the same time?

    1. By storing all records as plain text files.
    2. By limiting data access to only one user at a time.
    3. Through concurrency control and data security features.
    4. By turning off all constraints during collaboration.

    Explanation: RDBMS systems allow multiple users to safely work on data at once using features designed to prevent conflicts and preserve data integrity. Option A is not correct; RDBMS is designed for multi-user environments. Option C would make data less secure and is not best practice. Option D does not describe how modern RDBMS store data.

  10. Redundancy Reduction in RDBMS

    Which feature of an RDBMS helps to reduce data redundancy within a student information system?

    1. Establishing primary and foreign keys to link related tables.
    2. Storing all student details in one large file.
    3. Removing all database constraints.
    4. Allowing duplicate records for every student.

    Explanation: Primary and foreign keys allow tables to be related, which ensures each piece of data is stored only once and referenced as needed, reducing redundancy. Option A increases redundancy because data is repeated. Option C is incorrect, as duplicate records are a form of redundancy. Option D could compromise data structure and control.