โ† All SQL Flashcard Decks

Data Definition Language (DDL) Flashcards

7 cards from real SQL practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Data Definition Language (DDL) flashcards as text
  1. Which constraint ensures a column cannot contain duplicate values but allows one NULL in many systems?

    Answer: UNIQUE

    A UNIQUE constraint forbids duplicate values while typically permitting a single NULL.

  2. What does a FOREIGN KEY constraint enforce?

    Answer: Referential integrity between two tables

    A FOREIGN KEY ensures values in one table match values in a referenced table, maintaining referential integrity.

  3. Which clause defines a column that automatically gets a value when none is supplied on INSERT?

    Answer: DEFAULT

    The DEFAULT clause provides a value automatically when an INSERT omits that column.

  4. A CHECK constraint is used to do what?

    Answer: Limit the range of values allowed in a column

    A CHECK constraint restricts column values to those satisfying a specified Boolean condition.

  5. How can you add a constraint to an existing table?

    Answer: ALTER TABLE ... ADD CONSTRAINT

    ALTER TABLE ... ADD CONSTRAINT attaches a new constraint to an already-existing table.

  6. What happens by default when you try to insert a NULL into a column defined as NOT NULL?

    Answer: The statement fails with an error

    A NOT NULL column rejects NULL values, causing the insert to fail unless a value is provided.

  7. Which combination of properties best describes a PRIMARY KEY?

    Answer: Unique and NOT NULL

    A PRIMARY KEY is both unique and NOT NULL, uniquely identifying each row.