SQL MCQ's Question Set 1
Q.1. Which statement is wrong about PRIMARY KEY constraint in SQL?
- The PRIMARY KEY uniquely identifies each record in a SQL database table
- Primary key can be made based on multiple columns
- Primary key must be made of any single columns
- Primary keys must contain UNIQUE values.
Answer:- (3)
Q.2. SQL Query to delete all rows in a table without deleting the table (structure, attributes, and indexes)
- DELETE FROM table_name;
- DELETE TABLE table_name;
- DROP TABLE table_name;
- NONE
Answer:- (1)
Q.3. If we want to allow age of a person > 18 in the column Age of table Person, then which constraint will be applied to AGE column.
- Default
- Check
- NOT NULL
- None
Answer:- (2)
Q.4. In a table, a column contains duplicate value, if you want to list all different value only, then which SQL clause is used?
- SQL DISTINCT
- SQL UNIQUE
- SQL BETWEEN
- SQL Exists
Answer:- (1)
Q.5. To give a temporary name to a table, or a column in a table for more readability, what is used?
- SQL Wildcards
- SQL aliases
- SQL LIKES
- SQL Comments
Answer:- (2)
Q.6. What does below SQL statement describe?
SELECT CustomerName, Address + ‘, ‘ + City + ‘, ‘ + Country AS Address
FROM Customers;
|
- Alias named Address column will be created and under this Address, City and Country will be printed as combined statement.
- Alias named Address will be created for Country columns
- Alias named Address column will be created and under this all CustomerName, address, city and country will be printed as combined statement
- All above options are wrong.
Answer:- (1)
Q.7. Logical operators used in SQL are
- AND, OR , NOT
- &&, ||, !
- $,|,!
- None of the above
Answer:- (1)
Q.8. To specify the number of records to return, which keyword is used
- FIRST
- TOP
- START
- ROW
Answer:- (2)
Q.9. To search for a specified pattern in a column
- SQL MATCH
- SQL LIKE
- SQL PATTERN
- SQL SEARCH
Answer:- (2)
Q.10. To combine the result-set of two or more SELECT statements, SQL clause used is
- SQL UNION
- SQL JOIN
- SQL GROUP BY
- NONE
Answer:- (1)
Q.11. Which is called as a virtual table in SQL?
- INNER JOIN
- JOIN
- VIEW
- NONE
Answer:- (3)
Q.12. Syntax to create stored procedure is/are
-
CREATE PROCEDURE procedureName AS
SQL statements
-
CREATE PROCEDURE procedureName AS
BEGIN
SQL statements
END
-
CREATE PROC procedureName AS
BEGIN
SQL statements
END
-
(2) and (3)
- (2) only
Answer:- (4)
Q.13. Which statement(S) is/are incorrect
- Stored procedure may return a value and function must return a value.
- Function has only IN parameter.
- Try and Catch can be used with both stored procedure and function.
- Stored procedure has IN and OUT parameter.
Answer:- (3)
Q.14. The SQL join which does Cartesian product is called?
- Left Join
- Left Outer Join
- Right Outer Join
- Cross Join
Answer:- (4)
Q.15. Match SQL language with SQL commands
1)DDL i)Revok, Grant
2)DML ii)rename a table
3)TCL iii)insert, update
4)DCL iv)rollback , commit
- 1-iii,2-i,3-ii,4-iv
- 1-iii,2-ii,3-iv,4-i
- 1-ii,2-iii,3-iv,4-i*
- 1-i,2-iii,3-ii,4-iv
Answer:- (3)
For more Technical MCQ's and Interview Questions Click here