Which keyword is used to define a default value for a column in a DDL statement?

Study for the SQL Basics Test. Improve your knowledge with multiple choice questions and detailed explanations. Prepare effectively to master SQL concepts!

Multiple Choice

Which keyword is used to define a default value for a column in a DDL statement?

Explanation:
The DEFAULT keyword is used to define a default value for a column in DDL. It tells the database to automatically supply that value when an INSERT does not provide one for the column. For example, creating a table with a column that has DEFAULT 'active' means that if you insert a row without specifying that column, the value will be 'active'. If you explicitly provide a value, that value is used instead of the default, and if NULL is inserted (when allowed), the default is not applied. Other options shown aren’t standard keywords for setting a column’s default.

The DEFAULT keyword is used to define a default value for a column in DDL. It tells the database to automatically supply that value when an INSERT does not provide one for the column. For example, creating a table with a column that has DEFAULT 'active' means that if you insert a row without specifying that column, the value will be 'active'. If you explicitly provide a value, that value is used instead of the default, and if NULL is inserted (when allowed), the default is not applied. Other options shown aren’t standard keywords for setting a column’s default.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy