Showing posts with label sql update. Show all posts
Showing posts with label sql update. Show all posts

Multiple Choice Questions - SQL Insert, Update & Delete

Multiple Choice Questions - SQL Insert, Update & Delete


1)
An SQL INSERT statement adds ............... records to any single table in a relational database.

A) One
B) One or More
C) only two
D) None of Above

2)
An INSERT statement can also be used to retrieve data from other, modify it if necessary and insert it directly into the table.

A) True
B) False

3)
With SQL Insert, It is not possible to add data in specific columns.

A) True
B) False

4)
You may omit columns from an INSERT operation if the table definition so allows.

A) True
B) False

5)
The SELECT statement used in an INSERT SELECT can include a ........... clause to filter the data to be inserted.

A) Where
B) From
C) Into
D) Both A & C

6)
SELECT INTO copies data into a ..... table

A) Old
B) New
C) only System table
D) Both A & B

7)
The SQL........ statement can be used to create backup copies of tables.

A) SELECT IN
B) SELECT TO
C) SELECT IO
D) SELECT INTO

8)
The SELECT...INTO statement doesn't define a primary key for the new table, so you may want to do that manually.

A) True
B) False

9)
By default, a SELECT INTO statement must return only one row.

A) True
B) False

10)
What is this below query doing:

select distinct e1."FirstName"
into NewTable
from "employee" e1

A) The query returns all names from the field "FirstName" including duplicates and places it inside a new table giving it name "NewTable".
B) The query returns all names from the field "FirstName" excluding duplicates and places it inside a new table giving it name "NewTable".
C) The query returns all names from the field "FirstName" excluding duplicates and places it inside a new table giving it name "mynewtable"
D) Both A & B

Answers

Multiple Choice Questions - SQL Insert / Update

Multiple Choice Questions - SQL Insert / Update


1) Which one is correct syntax for Insert Statement?

a) Insert Columns(Col1, Col2,Col3);
b) Insert into (Col1, Col2,Col3) VALUES (Val1,Val2,Val3);
c) Insert Columns(Col1, Col2,Col3) VALUE (Val1, Val2,Val3) Into ;
d) None of the above.

2) Can the sequence & number of columns and values be different in an Insert statement?

a) True
b) False

3) How is Column wise insertion of data different from simply passing values to a table?

a) Column wise data leads in populating data on optional basis i.e. whether user wanted to insert data in a column or not.
b) We can’t pass value to a table without mentioning column names in an insert statement.
c) Passing values to a table without column names is always safe.
d) None of the above.

4) Update statement is used to insert values in a table and therefore it is a replacement of insert statement, is it correct?

a) True
b) False

5) Which one is correct syntax for Update Statement?

a) Update Table Columns(Col1, Col2,Col3);
b) Update into (Col1, Col2,Col3) VALUES (Val1,Val2,Val3);
c) Update Set Col_name=Value;
d) None of the above.

6) Is mentioning column name corresponding to its value mandatory in Update Statement?

a) True
b) False

7) What will be the consequence of omitting ‘Where’ clause in Update Statement?

a) No effect on the query as well as on table.
b) All records present in the table will be updated.
c) Only one record will be updated.
d) None of the above.

8) In any case, can update statement be used in place of insert statement?

a) Yes, if record exists with Identity value.
b) Yes, in every case.
c) No, it is not possible at all.
d) None of the above.

9) Can insert be used in place of update?

a) True
b) False
c) It is replacement of update.
d) None of the above.

10) Can we use ‘where’ clause in an Insert statement?

a) True
b) False

Answers