Which clause sets a default value for a column named status to 'active'?

Study for the SQL Basics Test. Explore multiple-choice questions with comprehensive explanations and hints. Gear up for your SQL exam!

Multiple Choice

Which clause sets a default value for a column named status to 'active'?

Explanation:
Setting a default value for a column in SQL is done with the DEFAULT clause after the datatype, and string defaults must be written as string literals using single quotes. The correct form defines the column with its type (status VARCHAR(10)) and then assigns DEFAULT 'active'. This ensures that if no value is provided during an insert, the row will automatically use the string active. The other forms fail because they either omit the proper string literal syntax, use double quotes which denote identifiers rather than string literals, or employ an invalid phrase for column defaults.

Setting a default value for a column in SQL is done with the DEFAULT clause after the datatype, and string defaults must be written as string literals using single quotes. The correct form defines the column with its type (status VARCHAR(10)) and then assigns DEFAULT 'active'. This ensures that if no value is provided during an insert, the row will automatically use the string active. The other forms fail because they either omit the proper string literal syntax, use double quotes which denote identifiers rather than string literals, or employ an invalid phrase for column defaults.