SQL Questions and Answers – SQL Insert Into Select

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

1. Which of the following statement(s) can be used in SQL to copy and insert data from one table to another table?
a) Copy Select
b) Select copy
c) Select Insert
d) Insert Into Select
View Answer

Answer: d
Explanation: Data of a table can be copied and inserted into another table in SQL by making use of INSERT INTO SELECT statement.

2. In an INSERT INTO SELECT statement, which of the following must match in both source and target table?
a) Column names
b) Column data types, names
c) Column data types and their number
d) Number of columns and their names
View Answer

Answer: c
Explanation: In an INSERT INTO SELECT statement the data types in source and target tables must match and they must be same in number. If not, an error occurs.

3. When an INSERT INTO SELECT statement is used, the existing records of the target table _________
a) Remains unaffected
b) Remains affected
c) Only some of the records are affected
d) Only some of the records re unaffected
View Answer

Answer: a
Explanation: The existing records of the target table of INSERT INTO SELECT statement remain unaffected. The new records from source table will be inserted into the target table without affecting the previous records.
advertisement
advertisement

4. What is the syntax of INSERT INTO SELECT statement?
a)

INSERT INTO SELECT * FROM source_table, target_table
WHERE condition;

b)

INSERT INTO target_table
SELECT * FROM source_table
WHERE condition;

c)

advertisement
INSERT INTO SELECT * FROM (source_table, target_table)
WHERE condition;

d)

advertisement
SELECT * FROM source_table
INSERT INTO target_table
WHERE condition;
View Answer
Answer: b
Explanation: Syntax for an INSERT INTO SELECT statement is as follows:

INSERT INTO target_table
SELECT * FROM source_table
WHERE condition;

5. The SELECT statement of an INSERT INTO SELECT statement can contain HAVING, GROUP BY and WHERE clauses.
a) True
b) False
View Answer

Answer: a
Explanation: The SELECT statement of INSERT INTO SELECT can easily contain WHERE, GROUP BY, and HAVING clauses, as well as table joins and aliases.

6. Using INSERT INTO SELECT statement it is not possible to copy only specific columns from a table.
a) True
b) False
View Answer

Answer: b
Explanation: We can copy only specific columns of a table using an INSERT INTO SELECT statement by specifying the column names in the statement.

7. Using which of the following clause(s) we can copy only specific rows from the source table in an INSERT INTO SELECT statement?
a) Specify
b) Specific
c) Where
d) Few
View Answer

Answer: c
Explanation: To copy only specific records from the source table of INSERT INTO SELECT statement, WHERE clause is used to restrict the rows.

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.