RSS Feed

Multiple Choice Questions - SQL Insert

Multiple Choice Questions - SQL Insert

1.
Below statement is true or false:
In order to execute INSERT statements, a user must have at least the INSERT permission assigned on the target table.

A) True
B) False

2.
SQL Server can automatically provide values for ......

A) nullable columns
B) IDENTITY columns
C) columns with the timestamp data type
D) columns with a default value
E) All of above
F) None of above

3.
Which of the following insert statements are correct:

A)
INSERT  INTO Persons ('xxx1','yyy1');
B)
INSERT  INTO [dbo].[Persons]
            ([LastName],
             [FirstName]
            )
VALUES      ('xxx',
             'yyy'
            );
C)
INSERT  INTO Persons VALUES ('xxx1','yyy1');
D)
INSERT  INTO Persons VALUE ('xxx1','yyy1');

4.
In SQL Server, you use the INSERT statement to add one new row and not multiple new rows to an existing table.

A) True
B) False

5.
You can insert data into a table from the results of the EXECUTE statement.

A) True
B) False

6.
You can use the INSERT statement to insert data into a .......

A) particular column
B) all columns
C) IDENTITY columns
D) All of above
E) None of above

7.
SQL Server supports several methods for inserting data into tables including ........

A) SELECT INTO
B) BULK SELECT INSERT
C) INSERT SELECT
D) INSERT SELECT FROM OPENROWSET(BULK …)

8.
Which of the below statement/statements is correct if we need to insert multiple values with one insert query:
1. INSERT  INTO Persons VALUES ('xxx1','yyy1'), ('xxx2','yyy2'), ('xxx3','yyy3');
2. INSERT  INTO Persons VALUES ('xxx1','yyy1'), VALUES ('xxx2','yyy2'), 
   Values ('xxx3','yyy3');
A) only 1 is correct
B) only 2 is correct
C) Both are correct
D) None is correct

9.
Tick the statements which are true.
It is always a good idea to provide a full-column list for INSERT statement because if the full-column list is not specified then

A) SQL SERVER generates an error
B) SQL Server resolves full-column lists whenever the INSERT statement executes
C) INSERT statement can insert the data in different table then specified
D) INSERT statement may generate an error if the underlying table schema changes

10.
If during Insert you want to specify the number or percent of random rows that will be inserted then you can use the . . . . . expression.

A) TYPE
B) NUMBER
C) TOP
D) PERCENT

1) a, 2) e, 3) b,c, 4) b, 5) a, 6) d, 7) a,c,d, 8) a, 9) b,d, 10) c