Which of the following queries will he use to accomplish the task?

John works as a Database Administrator in www.company.com Inc. The company has a SQL Server database.
John wants to create a table named employees in thedatabase. The table will have the id, firstname,
lastname, and dateofbirth columns. John has to ensure that the lastname column does not allow null values.
Which of the following queries will he use to accomplish the task?

John works as a Database Administrator in www.company.com Inc. The company has a SQL Server database.
John wants to create a table named employees in thedatabase. The table will have the id, firstname,
lastname, and dateofbirth columns. John has to ensure that the lastname column does not allow null values.
Which of the following queries will he use to accomplish the task?

A.
CREATE TABLE employees (id INTEGER PRIMARY KEY, firstname CHAR(50)NULL, lastname CHAR
(75)NOT NULL, dateofbirth DATE NULL);

B.
CREATE TABLE employees (id INTEGER PRIMARY KEY, firstname CHAR(50)NULL, lastname CHAR
(75), dateofbirth NULL);

C.
CREATE TABLE employees (id INTEGER PRIMARY KEY, firstname CHAR(50)NULL, lastname CHAR
(75) NOT NULL);

D.
CREATE TABLE employees (id INTEGER PRIMARY KEY, firstname CHAR(50)NULL, lastname CHAR
(75), dateofbirth DATE NULL);

Explanation:
In this query, all the columns are created according to the requirement and the lastname column is notallowing
the null values to be entered.
Answer D is incorrect. In this query, the lastname column is allowing the null values to be entered. Answer C is
incorrect. In this query, the dateofbirth column ismissing. Answer B is incorrect. In this query, thedata type of
the dateofbirth column is missing.



Leave a Reply 0

Your email address will not be published. Required fields are marked *