SQL Questions and Answers – SQL Insert Into Statement

This set of SQL Multiple Choice Questions & Answers (MCQs) focuses on “SQL Insert Into Statement”.

1. Which clause is used along with INSERT INTO statement to add new rows to a table?
a) Add
b) New
c) Values
d) New value
View Answer

Answer: c
Explanation:

INSERT INTO TABLE_NAME VALUES (value1, value2, value3 . . .);

This is the syntax of an INSERT INTO statement. Add clause is used with ALTER statements to alter a table or a database. New and New value are not used in any SQL statements.

advertisement
advertisement

2. Which of the following is/are not necessary to write an INSERT INTO statement?
a) Values
b) Values, Table name
c) Column name, Values
d) Column name
View Answer

Answer: d
Explanation: Values to be inserted are mandatory to add a new row into a table. To add a new row into a table, its name is required. If we are adding values for all the columns of the table, we do not need to specify the column names. However, we have to make sure the order of the values is in the same order as the columns in the table.

3. How many rows can be inserted at a time using INSERT INTO statement with VALUES clause?
a) Any number of rows
b) Only one row
c) One to ten rows
d) One to five rows
View Answer

Answer: b
Explanation: Only one row is inserted into a table with this syntax of INSERT INTO statement with VALUES clause.

INSERT INTO TABLE_NAME VALUES (value1, value2, value3 . . .);

To add n number of rows into a table, this statement should be written n times.

advertisement

4. Which of the following value(s) must be enclosed within single quotations when used with VALUES clause?
a) Character and date values
b) Numeric values
c) Numeric and character values
d) Date and Numeric values
View Answer

Answer: a
Explanation: Character and date values are to be enclosed within single quotation marks, whereas numeric values are not to be enclosed within quotations when used with VALUES clause.

5. NULL values can be inserted into a table using INSERT INTO statement.
a) True
b) False
View Answer

Answer: a
Explanation: If a column is not defined as NOT NULL, then NULL value can be assigned to it using INSERT INTO statement. To insert a NULL value into 3rd column of table dept:

advertisement
 INSERT INTO dept VALUES (7, ‘xxx’, NULL);

6. Rows can be copied from one table to another table using INSERT INTO statement.
a) True
b) False
View Answer

Answer: a
Explanation: We can use the INSERT INTO statement to add rows to a table where the values are derived from existing tables. In place of the VALUES clause, we use a subquery. Number of columns in the INSERT INTO clause should match with those in the subquery.

7. Consider the following relation:

Instructor (Id, Name, City, Country);

Using SQL, how to insert a row with Id number 5, name Ravi.
a) Insert into Instructor values (5, ‘Ravi’);
b) Insert into Instructor values (5, Ravi);
c) Insert into Instructor values (‘5’, ‘Ravi’);
d) Insert into Instructor (Id, Name) values (5, ‘Ravi’);
View Answer

Answer: d
Explanation: Character and date values are to be enclosed within single quotation marks, whereas numeric values are not to be enclosed within quotations. When column names are not specified then all the attributes values must be written with VALUES clause.

8. Which of the following statements can be used with INSERT INTO statement?
a) Update
b) Select
c) Modify
d) Add
View Answer

Answer: b
Explanation: SELECT statement is used with INSERT INTO statement to copy rows from one table and insert them into another table. SELECT statement is used to select data from a table and INSERT INTO statement to insert in a different table.

9. Which of the following is/are omitted from INSERT INTO statement when SELECT statement is used with it?
a) Values clause
b) Table name
c) Values clause, Table name
d) Column names
View Answer

Answer: a
Explanation:

INSERT INTO TABLE_NAME (column_list) SELECT statement;

This syntax is used when INSERT INTO is used with SELECT statement. This statement is used to copy rows from one table and insert them into another table.

10. Using SQL, how can we copy all the data of a table and insert into in a different table if both the tables has same attributes?
a) INSERT INTO first VALUES SELECT * FROM second;
b) INSERT INTO first SELECT * FROM second;
c) INSERT INTO first COPY SELECT * FROM second;
d) INSERT INTO first FROM second;
View Answer

Answer: b
Explanation: SELECT statement is used to copy the data from one table and INSERT INTO statement to insert in a different table. VALUES clause is omitted from INSERT INTO statement when SELECT statement is used with it. COPY clause is NOT VALID in SQL.

Sanfoundry Global Education & Learning Series – SQL.

To practice all areas of SQL, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.