Consider the below table structure:
Column Name
DataType
Constraint
Empname
Varchar2(20)
Not Null
EmpId
Number(10)
PK
Phoneno
Number(10)
NotNull
insert into employee(empid,empname)values('123','John');
When we issue the above insert command and if the statement fails,
what would be the reason.
Select one:
Value for phoneno is missing.
The column order should not be changed.
empid value should be given without single quotes.
The statement will get executed successfully
Answers
Answer:
value of phone no is missing
Explanation:
Answer:
The correct answer is found to be option (c) empid values should be given without quotes.
Explanation:
While using the number or integer or floating point datatype, we need to insert the values without any quote otherwise it will be treated as a string.
The INSERT INTO statement is employed to insert new records in a table.
It is possible to write the INSERT INTO statement in two ways:
1. Specify both the column names and therefore the values to be inserted:
INSERT INTO <table_name> ( column_1, column_2, column_3, ...) VALUES (value_1, value_2, value_3, ...);
2. If you're adding values for all the columns of the table, you are doing not need to specify the column names in the SQL query. However, ensure the order of the values is in the same order as the columns in the table. Here, the syntax would be as given below:
INSERT INTO <table_name> VALUES (value1, value2, value3, ...);
#SPJ3