MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
CREATE TABLE employee (id INTEGER, name VARCHAR(20), salary NOT NULL);INSERT INTO employee VALUES (1005, Rach, 0);INSERT INTO employee VALUES (1007, Ross, );INSERT INTO employee VALUES (1002, Joey, 335);Some of these insert statements will produce an error. Identify the statement.
A
Insert into employee values (1005, Rach, 0);
B
Insert into employee values (1002, Joey, 335);
C
Insert into employee values (1007, Ross, );
D
None of the mentioned
Explanation: 

Detailed explanation-1: -Note that the INSERT statement requires the column names in the parenthesis if you don’t want to insert data in all the columns but to some specific columns only. INSERT INTO Employee(EmpId, FirstName, LastName) VALUES(2, ’James’, ’Bond’); Now, the Select * from Employee query will display the following result.

Detailed explanation-2: -A null value indicates a lack of a value, which is not the same thing as a value of zero. For example, consider the question “How many books does Adam own?” The answer may be “zero” (we know that he owns none) or “null” (we do not know how many he owns).

Detailed explanation-3: -In an employee table to include the attributes whose value always have some value which of the following constraint must be used? Explanation: Not null constraint removes the tuples of null values.

Detailed explanation-4: -The SQL Coalesce and IsNull functions are used to handle NULL values.

There is 1 question to complete.