Consider the following SQL statement: sql CREATE TABLE Employees ( ID INT…

2025

Consider the following SQL statement:

sql
CREATE TABLE Employees (
ID INT PRIMARY KEY,
Name VARCHAR(100) NOT NULL,
HireDate DATE DEFAULT CURRENT_DATE
);

What does the DEFAULT keyword accomplish here?

  1. A.

    Automatically updates HireDate when the row is modified

  2. B.

    Sets HireDate to the current date if no value is provided during insertion

  3. C.

    Prevents manual entry of HireDate

  4. D.

    Ensures HireDate is always unique

Attempted by 124 students.

Show answer & explanation

Correct answer: B

In SQL, the DEFAULT keyword assigns a predefined value to a column when no value is supplied during insertion. In this statement:

HireDate DATE DEFAULT CURRENT_DATE

If a new employee record is inserted without specifying HireDate, the database automatically stores the current date in that column.

Explore the full course: Niacl Ao It Specialist