Introduction to SQL - Technical MCQs

Q1:

Which of the following do you need to consider when you make a table in SQL?

A Data types

B Primary keys

C Default values

D All of the above.

ANS:D - All of the above.

Because if there null values. When calculating the column values.

If there is null then the total will be '0'.

(anything + null = 0).

If we use default value '0' at integer column.

If we not specified the value then the 0 will be inserted in that column.

Then the total result will be correct. And also for char column it changes default. That if we don't know a person name. Instead of leaving it null. If we put default as 'not specified' then 'not specified' will be inserted in column. And so on.