12,550 views
3 votes
3 votes
Examine the structure of the EMPLOYEES table:

EMPLOYEE_ID NUMBER Primary Key

FIRST_NAME VARCHAR2(25)

LAST_NAME VARCHAR2(25)

Assume all the following four options are executed in the same sequence order. Which statement will not insert a row into the table?

 

a. INSERT INTO employees(first_name,last_name, employee_id) VALUES ( 1000, ‘John’,‘Smith’);

b. INSERT INTO employees VALUES (‘1000’,‘John’,NULL);

c. INSERT INTO employees (employee_id) VALUES (1000);

d. INSERT INTO employees (employee_id, first_name, last_name) VALUES ( 1000, ‘John’,‘’);

3 Answers

5 votes
5 votes
There are various formats of inserting the values in a table. In this case we are given three parameters the EMPLOYEE_ID,FIRST_NAME and LAST_NAME. Out of this the EMPLOYEE_ID is the primary key so it can't be null. Rest of the two parameters can be null. If we do not specify the coloumn name when we are inserting the values then the order that is interpreted for the values is the way it was defined during the table creation. If we are mentioning which coloumns we are filling the data then the order should be as mentioned in the insert command.

lets check the options:

a: This option is wrong as the order in which it is said to insert the data doesnot match with the parameters.

b:Correct As the values are inserted according to the order specified during the creation of table

c:Correct Only the coloumn name which is specified that value is being entered .

d:Correct The last value is null in this case.

So option a will not insert a row.
0 votes
0 votes

 

see what @anjali007  saying is correct obviously but what i think its a printing mistake rather a typing mistake considering it a typing mistake and considering it to be

INSERT INTO employees( employee_id, first_name,last_name) VALUES ( 1000, ‘John’,‘Smith’);

lets assume it to be correct 

 

But what i feel is option d inserting '' is not allowed ,yeah you can insert null but '' is not allowed . This is what i guess please confirm me if i am wrong or right.

But the problem is my test series has given option b . Is it because '1000' is considered a string instead of number?

 

There is too much confusion , plz @Arjun Sir clear it

Related questions

3 votes
3 votes
1 answer
2
Na462 asked Jan 6, 2019
679 views
Identify total number of attributes in minimized relation ?
1 votes
1 votes
1 answer
4
striver23 asked Feb 4, 2023
402 views
can we make weak entity type as composite attribute of another weak entity type?