Dark Mode
Image

SQL Tutorial

SQL Database

SQL Injection

PL/SQL Tutorial

Sql Interview Question

SQl Quiz

SQL MCQ (Multiple Choice Questions)

Here we are going to see a list of important SQL questions in MCQ style with an explanation of the answer for competitive exams and interviews. These frequently asked SQL questions are given with the correct choice of answer among multiple options. You can select your choice and check it instantly to see the answer with an explanation.

1) What is the full form of SQL?

  1. Structured Query List
  2. Structure Query Language
  3. Sample Query Language
  4. None of these.

Show Answer Workspace

2) Which of the following is not a valid SQL type?

  1. FLOAT
  2. NUMERIC
  3. DECIMAL
  4. CHARACTER

Show Answer Workspace

3) Which of the following is not a DDL command?

  1. TRUNCATE
  2. ALTER
  3. CREATE
  4. UPDATE

Show Answer Workspace

4) Which of the following are TCL commands?

  1. COMMIT and ROLLBACK
  2. UPDATE and TRUNCATE
  3. SELECT and INSERT
  4. GRANT and REVOKE

Show Answer Workspace

5) Which statement is used to delete all rows in a table without having the action logged?

  1. DELETE
  2. REMOVE
  3. DROP
  4. TRUNCATE

Show Answer Workspace

6) SQL Views are also known as

  1. Simple tables
  2. Virtual tables
  3. Complex tables
  4. Actual Tables

Show Answer Workspace

7) How many Primary keys can have in a table?

  1. Only 1
  2. Only 2
  3. Depends on no of Columns
  4. Depends on DBA

Show Answer Workspace

8) Which datatype can store unstructured data in a column?

  1. CHAR
  2. RAW
  3. NUMERIC
  4. VARCHAR

Show Answer Workspace

9) Which of the following is not Constraint in SQL?

  1. Primary Key
  2. Not Null
  3. Check
  4. Union

Show Answer Workspace

10) Which of the following is not a valid aggregate function?

  1. COUNT
  2. COMPUTE
  3. SUM
  4. MAX

Show Answer Workspace

11) Which data manipulation command is used to combines the records from one or more tables?

  1. SELECT
  2. PROJECT
  3. JOIN
  4. PRODUCT

Show Answer Workspace

12) Which operator is used to compare a value to a specified list of values?

  1. ANY
  2. BETWEEN
  3. ALL
  4. IN

Show Answer Workspace

13) What operator tests column for absence of data

  1. NOT Operator
  2. Exists Operator
  3. IS NULL Operator
  4. None of the above

Show Answer Workspace

14) In which of the following cases a DML statement is not executed?

  1. When existing rows are modified.
  2. When a table is deleted.
  3. When some rows are deleted.
  4. All of the above

Show Answer Workspace

15) If we have not specified ASC or DESC after a SQL ORDER BY clause, the following is used by default

  1. DESC
  2. ASC
  3. There is no default value
  4. None of the mentioned

Show Answer Workspace

16) Which of the following statement is true?

  1. TRUNCATE free the table space while DELETE does not.
  2. Both TRUNCATE and DELETE statements free the table's space.
  3. Both TRUNCATE and DELETE statement does not free the table's space.
  4. DELETE free the table space while TRUNCATE does not.

Show Answer Workspace

17) What is returned by INSTR ('JAVAT POINT', 'P')?

  1. 6
  2. 7
  3. POINT
  4. JAVAT

Show Answer Workspace

18) A command that lets you change one or more field in a table is:

  1. INSERT
  2. MODIFY
  3. LOOK-UP
  4. All of the above

Show Answer Workspace

19) Which of the following is also called an INNER JOIN?

  1. SELF JOIN
  2. EQUI JOIN
  3. NON-EQUI JOIN
  4. None of the above

Show Answer Workspace

20) Which of the following is true about the HAVING clause?

  1. Similar to the WHERE clause but is used for columns rather than groups.
  2. Similar to WHERE clause but is used for rows rather than columns.
  3. Similar to WHERE clause but is used for groups rather than rows.
  4. Acts exactly like a WHERE clause.

Show Answer Workspace

21) _______ clause creates temporary relation for the query on which it is defined.

  1. WITH
  2. FROM
  3. WHERE
  4. SELECT

Show Answer Workspace

22) The SQL statement:

  1. SELECT ROUND (65.726, -1) FROM DUAL;  

Prints:

  1. is illegal
  2. garbage
  3. 726
  4. 70

Show Answer Workspace

23) Which of the following is true about the SQL AS clause?

  1. The AS clause in SQL is used to change the column name in the output or assign a name to a derived column.
  2. The SQL AS clause can only be used with the JOIN clause.
  3. The AS clause in SQL is used to defines a search condition.
  4. All of the mentioned

Show Answer Workspace

24) _________ command makes the updates performed by the transaction permanent in the database?

  1. ROLLBACK
  2. COMMIT
  3. TRUNCATE
  4. DELETE

Show Answer Workspace

25) How can you change "Thomas" into "Michel" in the "LastName" column in the Users table?

  1. UPDATE User SET LastName = 'Thomas' INTO LastName = 'Michel'
  2. MODIFY Users SET LastName = 'Michel' WHERE LastName = 'Thomas'
  3. MODIFY Users SET LastName = 'Thomas' INTO LastName = 'Michel'
  4. UPDATE Users SET LastName = 'Michel' WHERE LastName = 'Thomas'

Show Answer Workspace

26) Which command is used to change the definition of a table in SQL?

  1. CREATE
  2. UPDATE
  3. ALTER
  4. SELECT

Show Answer Workspace

27) Which type of JOIN is used to returns rows that do not have matching values?

  1. Natural JOIN
  2. Outer JOIN
  3. EQUI JOIN
  4. All of the above

Show Answer Workspace

28) A CASE SQL statement is ________?

  1. A way to establish a loop in SQL.
  2. A way to establish an IF-THEN-ELSE in SQL
  3. A way to establish a data definition in SQL
  4. All of the above.

Show Answer Workspace

29) Which statement is true regarding routines and triggers?

  1. Both run automatically.
  2. Both are stored in the database.
  3. Both consist of procedural code.
  4. Both have to be called to operate.

Show Answer Workspace

30) Which statement is true regarding procedures?

  1. They include procedural and SQL statements.
  2. They work similarly to the functions.
  3. It does not need unique names.
  4. It cannot be created with SQL statements.

Show Answer Workspace

31) Which of the following is the basic approaches for joining tables?

  1. Union JOIN
  2. Natural JOIN
  3. Subqueries
  4. All of the above

Show Answer Workspace

32) Why we need to create an index if the primary key is already present in a table?

  1. Index improves the speed of data retrieval operations on a table.
  2. Indexes are special lookup tables that will be used by the database search engine.
  3. Indexes are synonyms of a column in a table.
  4. All of the above

Show Answer Workspace

33) Group of operations that form a single logical unit of work is known as

  1. View
  2. Network
  3. Unit
  4. Transaction

Show Answer Workspace

34) Shared locks are applied while performing

  1. Read operations
  2. Write operations
  3. A & B both
  4. None of the above

Show Answer Workspace

35) Sequence can generate

  1. Numeric value
  2. Alphanumeric value
  3. A & B both
  4. None of the above

Show Answer Workspace

36) A sequence in SQL can generate a maximum number:

  1. 39 digits
  2. 38 digits
  3. 40 digits
  4. 37 digits

Show Answer Workspace

37) Which of the following is the correct order of a SQL statement?

  1. SELECT, GROUP BY, WHERE, HAVING
  2. SELECT, WHERE, GROUP BY, HAVING
  3. SELECT, HAVING, WHERE, GROUP BY
  4. SELECT, WHERE, HAVING, GROUP BY

Show Answer Workspace

38) What is the difference between a PRIMARY KEY and a UNIQUE KEY?

  1. Primary key can store null value, whereas a unique key cannot store null value.
  2. We can have only one primary key in a table while we can have multiple unique keys
  3. Primary key cannot be a date variable whereas unique key can be
  4. None of these

Show Answer Workspace

39) Which of the following are the synonyms for Column and ROW of a table?

  1. Row = [Tuple, Record]
  2. Column = [Field, Attribute]
  3. Row = [Tuple, Attribute]
  4. Columns = [Field, Record]
  1. 1 and 2
  2. 3 and 4
  3. Only 1
  4. Only 2

Show Answer Workspace

40) Which operator is used to compare the NULL values in SQL?

  1. Equal
  2. IN
  3. IS
  4. None of Above

Show Answer Workspace

41) Which of the following statement is correct regarding the difference between TRUNCATE, DELETE and DROP command?

I. DELETE operation can be rolled back but TRUNCATE and DROP operations cannot be rolled back.
II. TRUNCATE and DROP operations can be rolled back but DELETE operations cannot be rolled back.
III. DELETE is an example of DML, but TRUNCATE and DROP are examples of DDL.
IV. All are an example of DDL.

  1. I and III
  2. II and III
  3. II and IV
  4. II and IV

Show Answer Workspace

42) Which of the following options are correct regarding these three keys (Primary Key, Super Key, and Candidate Key) in a database?

I. Minimal super key is a candidate key
II. Only one candidate key can be a primary key
III. All super keys can be a candidate key
IV. We cannot find a primary key from the candidate key

  1. I and II
  2. II and III
  3. I and III
  4. II and IV

Show Answer Workspace

43) When the wildcard in a WHERE clause is useful?

  1. When an exact match is required in a SELECT statement.
  2. When an exact match is not possible in a SELECT statement.
  3. When an exact match is required in a CREATE statement.
  4. When an exact match is not possible in a CREATE statement.

Show Answer Workspace

44) ______ is NOT a type of constraint in SQL language?

  1. FOREIGN KEY
  2. PRIMARY KEY
  3. UNIQUE
  4. ALTERNATE KEY

Show Answer Workspace

45) Find the cities name with the condition and temperature from table 'whether' where condition = sunny or cloudy but temperature >= 60.

  1. SELECT city, temperature, condition FROM weather WHERE condition = 'cloudy' AND condition = 'sunny' OR temperature >= 60
  2. SELECT city, temperature, condition FROM weather WHERE condition = 'cloudy' OR condition = 'sunny' OR temperature >= 60
  3. SELECT city, temperature, condition FROM weather WHERE condition = 'sunny' OR condition = 'cloudy' AND temperature >= 60
  4. SELECT city, temperature, condition FROM weather WHERE condition = 'sunny' AND condition = 'cloudy' AND temperature >= 60

Show Answer Workspace

46) Which of the following statement is correct to display all the cities with the condition, temperature, and humidity whose humidity is in the range of 60 to 75 from the 'whether' table?

  1. SELECT * FROM weather WHERE humidity IN (60 to 75)
  2. SELECT * FROM weather WHERE humidity BETWEEN 60 AND 75
  3. SELECT * FROM weather WHERE humidity NOT IN (60 AND 75)
  4. SELECT * FROM weather WHERE humidity NOT BETWEEN 60 AND 75

Show Answer Workspace

47) ________ is a program that performs some common action on database data and also stored in the database.

  1. Stored Procedure
  2. Trigger
  3. Stored Function
  4. None of the above

Show Answer Workspace

48) Which statement is used to get all data from the student table whose name starts with p?

  1. SELECT * FROM student WHERE name LIKE '%p%';
  2. SELECT * FROM student WHERE name LIKE 'p%';
  3. SELECT * FROM student WHERE name LIKE '_p%';
  4. SELECT * FROM student WHERE name LIKE '%p';

Show Answer Workspace

49) What is the advantage of the clustered index?

  1. It is fast to update the records.
  2. It does not need extra work for SQL queries.
  3. It minimizes the page transfer and maximizes the cache hits.
  4. None of the above is correct.

Show Answer Workspace

50) Evaluate the SQL statement:

  1. SELECT a.emp_name, a.sal, a.dept_id, b.maxsal FROM employees a,  
  2. (SELECT dept_id, MAX(sal) maxsal FROM employees GROUP BY dept_id) b  
  3. WHERE a.dept_id = b.dept_id AND a.sal < b.maxsal;  

Which of the following statement is correct?

  1. The statement gives an error at line 1.
  2. The statement gives an error at line 6.
  3. The statement produces the employee name, salary, department ID, and maximum salary earned in the employee department for all departments that pay less salary than the maximum salary paid in the company.
  4. The statement produces the employee name, salary, department ID, and maximum salary earned in the employee department for all employees who earn less than the maximum salary in their department.

Show Answer Workspace

51) Which of the following are the DATETIME data types that can be used in column definitions?

  1. TIMESTAMP
  2. INTERVAL MONTH TO DAY
  3. INTERVAL YEAR TO MONTH
  4. TIMESTAMP WITH DATABASE TIMEZONE

Show Answer Workspace

52) Which data dictionary table can be used to show the object privileges granted to the user on specific columns?

  1. USER_TAB_PRIVS_MADE
  2. USER_COL_PRIVS_MADE
  3. USER_TAB_PRIVS
  4. USER_COL_PRIVS

Show Answer Workspace

53) Evaluate the SQL statement:

  1. SELECT ROUND (TRUNCATE (MOD (1600, 10), -1), 2) FROM dual;  

What will be displayed?

  1. 0
  2. 1
  3. 00
  4. An error statement

Show Answer Workspace

54) What is the need for our query to execute successfully on an existing view?

  1. The specified table must contain data.
  2. We must have a SELECT privilege on the view.
  3. We should have a SELECT privilege only on the specified table.
  4. The specified table must be in the same database or schema.

Show Answer Workspace

55) Which of the following operator can be used with a multiple-row subquery?

  1. =
  2. BETWEEN
  3. NOT IN
  4. <>

Show Answer Workspace

56) _______ is a constraint that can be defined only at the column level?

  1. UNIQUE
  2. NOT NULL
  3. CHECK
  4. PRIMARY KEY

Show Answer Workspace

Comment / Reply From