0% found this document useful (0 votes)
3 views

SQL MCQ

The document consists of multiple-choice questions (MCQs) related to SQL and relational database management systems (RDBMS). It covers various topics including SQL commands, data types, constraints, and database operations. Each question provides four answer options, testing knowledge on SQL functionalities and concepts.

Uploaded by

chitra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

SQL MCQ

The document consists of multiple-choice questions (MCQs) related to SQL and relational database management systems (RDBMS). It covers various topics including SQL commands, data types, constraints, and database operations. Each question provides four answer options, testing knowledge on SQL functionalities and concepts.

Uploaded by

chitra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

SQL MCQs

1. Which of the following are some common RDBMS in use?

A. Oracle
B. MySQL
C. HeidiSQL
D. All of the above

2. What command is used to create a new table in SQL?

A. CREATE TABLE
B. BUILD TABLE
C. GENERATE TABLE
D. None of the above

3. What does the following statement in SQL do?


DROP TABLE student;
A. Deletes a table called student.
B. Creates a table called student.
C. Check if there is a table called student.
D. None of the above.

4. Which of the following are types of Unicode character string types in SQL?

A. nchar
B. ntext
C. Both A and B
D. None of the above

5.What does BLOB in SQL stand for?

A. Binary Large Objects


B. Big Large Objects
C. Binary Language for Objects
D. None of the above

6. Which of the following datatype is most appropriate for storing a string of up


to 255 characters?

A. TEXT
B. TINY TEXT
C. BLOB
D. BINARY

7.What happens when no value is inserted in an ENUM list?


A. Nothing happens
B. The code will crash
C. A blank value is inserted in that case
D. None of the above

8. What is the range of integers that can be held in the MEDIUMINT datatype of
SQL?

A. Signed numbers in the range of -8388608 to 8388607.


B. Unsigned numbers in the range of 0 to 16777215.
C. Both A and B.
D. None of the above.

9. What does the following code snippet do?


ALTER TABLE STUDENT ADD(ADDRESS VARCHAR2(20));
A. Adds a column called ADDRESS in the table student.
B. Checks if a column called ADDRESS is present in the table student.
C. Invalid Syntax
D. None of the above

10. Which of the following commands is used to delete all rows and free up space
from a table?

A. TRUNCATE
B. DROP
C. DELETE
D. ALTER

11. Which of the following commands are a part of Data Control Language?

A. Revoke
B. Grant
C. Both A and B
D. None of the above

12. What does the following code snippet do?


DELETE FROM STUDENTS
WHERE AGE = 16;
ROLLBACK;
A. Performs an undo operation on the delete operation.
B. Deletes the rows from the table where AGE = 16
C. Deletes the entire table
D. None of the above

13. When is the wildcard in WHERE clause used?


A. An exact match is necessary for a CREATE statement.
B. An exact match is not possible in a SELECT statement.
C. An exact match is necessary for a SELECT statement.
D. None of the above.

14. Which of the following is the full form of DDL?

A. Data definition language


B. Data derivation language
C. Dynamic data language
D. Detailed data language

15. Which SQL constraint do we use to set some value to a field whose value has
not been added explicitly?

A. UNIQUE
B. NOT NULL
C. DEFAULT
D. CHECK

16. What are rows of a relation known as?

A. Degree
B. Entity
C. Tuple
D. None

17. During transaction before commit which of the following statements is done
automatically in case of shutdown?

A. Rollback
B. Commit
C. View
D. Flashback

18. Which of the following allows you to uniquely identify a tuple?

A. Schema
B. Attribute
C. Super key
D. Domain

19. How many operations are considered to be the most basic SQL operations?

A. 4
B. 3
C. 2
D. 1
20. Which of the following is not a SQL command?

A. DEL
B. ORDER BY
C. SELECT
D. WHERE

21. What does the following code snippet do?


SELECT TOP 5 * FROM students;
A. Select the top 5 entries for all the columns in the students' table.
B. Select all the entries from the students' table other than the top 5
entries
C. Selects all entries from the student table except 5 random rows
D. None of the above

22. Which of the following matches the definition given below: It is an artificial
key that aims to uniquely identify each record.

A. Primary Key
B. Foreign Key
C. Surrogate Key
D. Composite Key

23. Which of the following commands are used to put a restriction on the number
of rows returned from a query?

A. LIMIT
B. LIKE
C. WHERE
D. GROUP BY

24. Which of the following are valid logical operators in SQL?

A. SOME
B. ALL
C. AND
D. All of the above

25. Which of the following commands is used to delete a trigger in SQL?

A. DROP
B. DELETE
C. ALTER
D. None of the above

26. Which of the following can replace the below query?


SELECT Name, ID
FROM Student, Courses
WHERE Student_ID = Courses_ID;
A. Select Name,ID from Courses,Student where Student_ID = ID;
B. Select Name, ID from Student natural join Courses;
C. Select Name, ID from Student;
D. Select ID from Student join Courses;

27.What will be the output of the following code snippet?


SELECT ROUND (TRUNCATE (MOD (2500, 20), -1), 2) FROM dual;
A. Error
B. 00
C. 0
D. 1

28. Which of the following SQL functions compares the similarities of 2 strings
and returns the result as a 4 character code?

A. SOUNDEX
B. DIFFERENCE
C. CONCAT
D. None of the above

29. Which of the following operators is used to compare a value to a list of literal
values that have been specified?

A. ANY
B. BETWEEN
C. IN
D. ALL

30. Which of the following is not a valid SQL type?

A. NUMERIC
B. DECIMAL
C. CHARACTER
D. None of the above

31. Which of the following constraints can be defined only at the column level?

A. UNIQUE
B. NOT NULL
C. CHECK
D. PRIMARY KEY

32. Which of the following is not a valid aggregate function?

A. count()
B. Sum()
C. Avg()
D. None of the above
33. Which of the following is not a DDL command?

A. REVOKE
B. GRANT
C. UPDATE
D. RENAME

34. Which of the following is known as the minimal super key?

A. Primary key
B. Foreign key
C. Candidate key
D. None of the above

35.Which of the following is also known as a concatenated key?


A. Primary Key
B. Foreign Key
C. Surrogate Key
D. Composite Key

36. Which of the following functions do we use to get a specified day of the
month for a given date?

A. DAY
B. DATEPART
C. GETDATE
D. CURRENT_TIMESTAMP

37. Select the valid SQL type.

A. NUMERIC
B. CHARACTER
C. FLOAT
D. All of the above

38. Group of operations that form a single logical unit of work called?

A. Network
B. Unit
C. Transaction
D. None of the above

39. How can SQL injections occur?

A. Data is used to dynamically construct an SQL Query.


B. Unintended data from an untrusted source enters the application.
C. Both A and B.
D. None of the above.
40. How can the user change “Scaler” into “Interviewbit” in the “Name” column
in the Users table?

A. UPDATE User SET Name = 'Scaler' INTO Name = 'Interviewbit'


B. MODIFY Users SET Name = 'Interviewbit' WHERE Name = 'Scaler'
C. MODIFY Users SET Name = 'Scaler' INTO Name = 'Interviewbit'
D. UPDATE Users SET Name = 'Interviewbit' WHERE Name = 'Scaler'

41. How can we view all the triggers currently in the database?

A. SHOW
B. VIEW
C. READ
D. None of the above

42. Identify the concurrency-based protocol?

A. Lock based protocol


B. Two-phase locking protocol
C. Timestamp ordering protocol
D. All

43. NATURAL JOIN can also be termed as -

A. Combination of Union and cartesian product


B. Combination of Selection and cartesian product
C. Combination of Projection and cartesian product
D. None of the above

44. Primary key can be?

A. NULL
B. NOT NULL
C. Both NULL and NOT NULL
D. Depends on situation

45. The program which performs some common action on database data and is
also stored there is called?

A. Trigger
B. Stored Procedure
C. Stored Function
D. None of the above

46. Select the correct foreign key constraint?

A. Referential integrity
B. Entity integrity
C. Domain integrity
D. None of the above

47.SQL views are also known as?

A. Schema
B. Virtual Table
C. Instance
D. None of the above

48.To select some particular columns, which of the following commands is used?

A. PROJECTION
B. SELECTION
C. JOIN
D. UNION

49. What is a table joined with itself called?

A. Join
B. Self-join
C. Outer join
D. None of the above

50. What is NOLOCK in SQL equivalent to?

A. WRITE UNCOMMITTED
B. READ COMMITTED
C. WRITE COMMITTED
D. READ UNCOMMITTED

51.What is the full form of SQL?

A. Structured Query Language


B. Sample Query Language
C. Structured Query List
D. None of the above.

52.What is the name of the query that is placed within a WHERE or HAVING
clause of another query?

A. Multi query
B. Subquery
C. Super query
D. Master query

53. Which is the AS clause used for?

A. Rename
B. Selection
C. Join
D. Projection

54.Which of the following are TCL commands?

A. ROLLBACK
B. SAVEPOINT
C. Both A and B
D. None of the above

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy