QuizzesCREATE TABLE, Data Types & Constraints — Concept Check
intermediate
sql

CREATE TABLE, Data Types & Constraints — Concept Check

Questions on CREATE TABLE, Data Types & Constraints. CREATE TABLE defines a table's structure, column data types, and integrity constraints like NOT NULL, UNIQUE, DEFAULT, and CHECK.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on CREATE TABLE, Data Types & Constraints — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A database table is created with a VARCHAR(255) column for storing email addresses. What is a potential issue with this design?

    • AVARCHAR(255) automatically converts to TEXT
    • BEmails longer than 255 characters are truncated
    • CWastes space if emails are shorter
    • DVARCHAR(255) is less performant than TEXT
  2. 2.A table is defined with a CHECK constraint on a column 'age' to be between 0 and 150. What happens if an attempt is made to insert a value of 200?

    • AThe value is cast to 150
    • BThe value is set to NULL
    • CThe database rejects the insert
    • DThe insert succeeds with a warning
  3. 3.What is the primary reason to use NUMERIC over FLOAT for monetary values in a database?

    • AFLOAT is not supported in all databases
    • BNUMERIC avoids rounding errors
    • CNUMERIC is faster to compute
    • DNUMERIC uses less storage
  4. 4.A developer uses BIGINT for a primary key in a high-volume table. What is the advantage of this choice?

    • ASupports a larger range of values
    • BReduces storage size
    • CSimplifies index creation
    • DImproves query performance
  5. 5.A table has a column 'status' with a DEFAULT constraint set to 'active'. What happens when a new row is inserted without specifying 'status'?

    • A'status' is set to 'active'
    • BInsert fails due to missing value
    • C'status' remains NULL
    • DDatabase assigns a random value
  6. 6.Why might VARCHAR(n) be preferred over TEXT in MySQL for certain columns?

    • ATEXT is slower to read
    • BVARCHAR(n) uses less storage
    • CTEXT cannot be fully indexed
    • DVARCHAR(n) supports more characters
  7. 7.A table-level CHECK constraint is defined for a table. What is a unique feature of this constraint type?

    • AIs faster than column-level constraints
    • BAutomatically updates with column changes
    • CCan validate conditions across multiple columns
    • DApplies only to a single column
  8. 8.What is the role of the NOT NULL constraint in a database table?

    • APrevents empty values in a column
    • BEnsures unique values in a column
    • CSets a default value for a column
    • DValidates data against a condition