Developing Microsoft SQL Server Databases — Question 46
You need to add a new column named Confirmed to the Attendees table.
The solution must meet the following requirements:
✑ Have a default value of false.
✑ Minimize the amount of disk space used.
Which code block should you use?
Answer options
- A. ALTER TABLE Attendees ADD Confirmed bit DEFAULT 0;
- B. ALTER TABLE Attendees ADD Confirmed char(l) DEFAULT '1';
- C. ALTER TABLE Attendees ADD Confirmed bit DEFAULT 1;
- D. ALTER TABLE Attendees ADD Confirmed char(l) DEFAULT `1';
Correct answer: A
Explanation
The correct answer is A because it adds a new column of type 'bit', which uses less disk space and sets the default to 0, representing false. Options B and D use 'char', which consumes more space and are not suitable for a boolean value. Option C sets the default to 1, which represents true, not false.