Practice 120+ MCQ on SQL with answers & explanations. Perfect for students, exams & interviews. Boost your SQL skills with easy to advanced questions today!
Introduction (MCQ on SQL Guide)
A student from a small village, Rahul, was preparing for an IT interview. He knew coding, but he got stuck in the MCQ on SQL questions asked by the interviewer. After that, he started practicing SQL MCQs daily… and within a few weeks, his confidence increased and he was able to get selection.
In today’s data-driven world, SQL is the most important skill. According to a Statista report, more than 70% of developers in the world use databases, and SQL is the top language in it. Therefore, MCQ practice is very necessary.
SQL is a structured query language used to manage databases. 👉 Learn SQL basics

What is SQL?
SQL (Structured Query Language) is a language used to manage databases.
Why is MCQ practice important?
For exam preparation
To crack an interview
For concept clarity
Who is this article for?
Students
Competitive exam aspirants
IT learners
👉 Just as people learn financial transactions due to Mobile Banking awareness, students learn data handling skills due to SQL awareness.
Before learning SQL, it is important to understand basics. You can start with 👉 Computer Fundamentals MCQ for beginners to build a strong foundation.
MCQ on SQL with Answers & Detailed Explanation
In this section, you will get basic to beginner level MCQ on SQL with answers. These questions are specially designed for beginners, which help in understanding the fundamental concepts of SQL and building a strong foundation.

Q1. What is the full form of SQL?
A) Structured Query Language
B) Simple Query Language
C) Sequential Query Language
D) None
Answer: A) Structured Query Language
Explanation: SQL stands for Structured Query Language, which is used to manage and manipulate relational databases.
Q2. What is SQL used for?
A) Data retrieve
B) Data store
C) Data manipulate
D) All
Answer: D) All
Explanation: SQL is used to retrieve, store, update, and delete data in databases, making all options correct.
Q3. What does SELECT command do?
A) Insert data
B) Delete data
C) Fetch data
D) Update
Answer: C) Fetch data
Explanation: The SELECT command is used to retrieve data from a database table.
Q4. What is WHERE clause for?
A) Sorting
B) Filtering
C) Grouping
D) None
Answer: B) Filtering
Explanation: The WHERE clause is used to filter records based on specific conditions.
Q5. What is a primary key?
A) Duplicate value
B) Unique identifier
C) Null value
D) None
Answer: B) Unique identifier
Explanation: A primary key uniquely identifies each record in a table and cannot contain duplicate or NULL values.
Q6. Is SQL case sensitive?
A) Yes
B) No
C) Depends
D) None
Answer: B) No
Explanation: SQL keywords are generally case-insensitive, though some databases may treat table/column names differently.
Q7. What is a NULL value?
A) Zero
B) Blank
C) Unknown
D) All
Answer: C) Unknown
Explanation: NULL represents missing or unknown data, not zero or an empty string.
Q8. What type of language is SQL?
A) Programming
B) Query
C) Markup
D) None
Answer: B) Query
Explanation: SQL is a query language used to communicate with and manipulate databases.
Q9. What is a row in a table called?
A) Field
B) Record
C) Column
D) None
Answer: B) Record
Explanation: A row represents a single record in a table containing related data.
Q10. What is a column called?
A) Record
B) Field
C) Table
D) None
Answer: B) Field
Explanation: A column is also known as a field or attribute that stores a specific type of data.
MCQ On SQL Database
SQL cannot be understood properly without understanding database concepts. Therefore, in this section, MCQ on SQL database based on table, row, column and data structure are given, which will strengthen your core understanding.

Q1. What is a database?
A) Collection of data
B) Organized data
C) Structured information
D) All
Answer: D) All
Explanation: A database is an organized collection of structured data that can be easily accessed, managed, and updated.
Q2. Where is data stored in a SQL database?
A) Table
B) File
C) Folder
D) None
Answer: A) Table
Explanation: In SQL databases, data is stored in tables consisting of rows and columns.
Q3. What is a row in a table?
A) Column
B) Record
C) Field
D) None
Answer: B) Record
Explanation: A row represents a single record in a table, containing related data.
Q4. What is a column in a table?
A) Record
B) Field
C) Table
D) None
Answer: B) Field
Explanation: A column is also called a field or attribute that stores a specific type of data.
Q5. How many primary keys can a table have?
A) One
B) Many
C) None
D) Unlimited
Answer: A) One
Explanation: A table can have only one primary key, but it can consist of multiple columns (composite key).
Q6. What is a foreign key?
A) Unique key
B) Link between tables
C) Duplicate key
D) None
Answer: B) Link between tables
Explanation: A foreign key is used to establish a relationship between two tables.
Q7. What is data redundancy?
A) Unique data
B) Duplicate data
C) Deleted data
D) None
Answer: B) Duplicate data
Explanation: Data redundancy refers to unnecessary duplication of data in a database.
Q8. Which type of database uses SQL?
A) Relational database
B) NoSQL database
C) Both
D) None
Answer: A) Relational database
Explanation: SQL is primarily used in relational database management systems (RDBMS).
Q9. What does a table consist of?
A) Rows only
B) Columns only
C) Rows and Columns
D) None
Answer: C) Rows and Columns
Explanation: A table is made up of rows (records) and columns (fields).
Q10. What is a schema in SQL?
A) Table
B) Structure of database
C) Row
D) Column
Answer: B) Structure of database
Explanation: A schema defines the structure of a database including tables, relationships, and constraints.
MCQ On SQL Commands
SQL commands are the main basis for performing operations on the database. MCQ on SQL commands based on commands like CREATE, INSERT, UPDATE, DELETE are given in this section, which are important for both practical and exam.

Q1. Which type of SQL command is CREATE?
A) DML
B) DDL
C) DCL
D) TCL
Answer: B) DDL
Explanation: CREATE is a Data Definition Language (DDL) command used to create database objects like tables.
Q2. Which command is used to insert data into a table?
A) UPDATE
B) DELETE
C) INSERT
D) SELECT
Answer: C) INSERT
Explanation: INSERT is a DML command used to add new records into a table.
Q3. Which SQL command is used to remove data from a table?
A) DROP
B) DELETE
C) REMOVE
D) CLEAR
Answer: B) DELETE
Explanation: DELETE is used to remove specific records from a table using conditions.
Q4. Which command is used to modify existing data?
A) ALTER
B) UPDATE
C) MODIFY
D) CHANGE
Answer: B) UPDATE
Explanation: UPDATE is used to change existing records in a table.
Q5. Which command is used to remove an entire table?
A) DELETE
B) REMOVE
C) DROP
D) TRUNCATE
Answer: C) DROP
Explanation: DROP command deletes the entire table structure and data permanently.
Q6. Which command removes all records but keeps the table structure?
A) DELETE
B) DROP
C) TRUNCATE
D) REMOVE
Answer: C) TRUNCATE
Explanation: TRUNCATE deletes all data from a table but retains its structure.
Q7. Which command is used to give permissions?
A) REVOKE
B) GRANT
C) PERMIT
D) ALLOW
Answer: B) GRANT
Explanation: GRANT is a DCL command used to provide access permissions to users.
Q8. Which command is used to take back permissions?
A) REMOVE
B) DELETE
C) REVOKE
D) CANCEL
Answer: C) REVOKE
Explanation: REVOKE removes previously granted permissions from users.
Q9. Which command is used to save a transaction permanently?
A) SAVE
B) COMMIT
C) END
D) FINISH
Answer: B) COMMIT
Explanation: COMMIT saves all changes made during the transaction permanently.
Q10. Which command is used to undo changes?
A) CANCEL
B) UNDO
C) ROLLBACK
D) RESET
Answer: C) ROLLBACK
Explanation: ROLLBACK is used to undo changes made in a transaction before it is committed.
MCQ On SQL Server
SQL Server is a widely used relational database system that is used in real-world applications. This section provides MCQs on SQL server based on SQL Server basics, features and usage.

Q1. Who developed SQL Server?
A) Oracle
B) Microsoft
C) IBM
D) Google
Answer: B) Microsoft
Explanation: SQL Server is a relational database management system developed by Microsoft.
Q2. SQL Server is which type of database system?
A) NoSQL
B) Hierarchical
C) Relational
D) Network
Answer: C) Relational
Explanation: SQL Server is a Relational Database Management System (RDBMS) that stores data in tables.
Q3. Which language is used in SQL Server?
A) PL/SQL
B) T-SQL
C) SQL++
D) Java
Answer: B) T-SQL
Explanation: SQL Server uses Transact-SQL (T-SQL), an extension of SQL developed by Microsoft.
Q4. What is the default port for SQL Server?
A) 1521
B) 1433
C) 3306
D) 8080
Answer: B) 1433
Explanation: SQL Server typically uses port 1433 for communication.
Q5. Which version of SQL Server is free?
A) Enterprise
B) Standard
C) Express
D) Developer
Answer: C) Express
Explanation: SQL Server Express is a free version with limited features.
Q6. What is SSMS in SQL Server?
A) Server Storage Management System
B) SQL Server Management Studio
C) Structured Storage Management System
D) None
Answer: B) SQL Server Management Studio
Explanation: SSMS is a tool used to manage SQL Server databases and execute queries.
Q7. What is a database in SQL Server?
A) Collection of tables
B) Collection of files
C) Collection of queries
D) None
Answer: A) Collection of tables
Explanation: A database in SQL Server is a structured collection of tables and related objects.
Q8. What is a table in SQL Server?
A) Collection of rows and columns
B) Collection of files
C) Collection of queries
D) None
Answer: A) Collection of rows and columns
Explanation: Tables store data in rows (records) and columns (fields).
Q9. Which feature ensures data integrity in SQL Server?
A) Constraints
B) Functions
C) Views
D) Indexes
Answer: A) Constraints
Explanation: Constraints like PRIMARY KEY, FOREIGN KEY ensure data accuracy and integrity.
Q10. What is indexing in SQL Server?
A) Data deletion
B) Data sorting
C) Faster data retrieval
D) Data storage
Answer: C) Faster data retrieval
Explanation: Indexing improves the speed of data retrieval operations in a database.
MCQ On SQL Server 2008 With Answers
Some exams and interviews ask version-specific questions. Therefore, in this section, MCQs on SQL server 2008 with answers based on SQL Server 2008 are given, which complete your preparation.

Q1. Which feature was introduced in SQL Server 2008?
A) Data Compression
B) JSON Support
C) Graph Database
D) None
Answer: A) Data Compression
Explanation: SQL Server 2008 introduced data compression to reduce storage space and improve performance.
Q2. What is a primary key in SQL Server 2008?
A) Duplicate identifier
B) Unique identifier
C) Null value
D) None
Answer: B) Unique identifier
Explanation: A primary key uniquely identifies each record in a table and does not allow NULL or duplicate values.
Q3. What does NULL represent in SQL Server 2008?
A) Zero
B) Blank
C) Unknown value
D) Default value
Answer: C) Unknown value
Explanation: NULL indicates that the value is missing or unknown, not zero or empty.
Q4. Which data type is used to store large text in SQL Server 2008?
A) INT
B) VARCHAR
C) TEXT
D) DATE
Answer: C) TEXT
Explanation: TEXT data type is used to store large amounts of text data in SQL Server 2008.
Q5. What is the use of IDENTITY property?
A) Store text
B) Auto increment values
C) Store date
D) None
Answer: B) Auto increment values
Explanation: IDENTITY property is used to automatically generate incremental values for a column.
Q6. Which constraint ensures unique values?
A) FOREIGN KEY
B) UNIQUE
C) CHECK
D) DEFAULT
Answer: B) UNIQUE
Explanation: UNIQUE constraint ensures that all values in a column are distinct.
Q7. What does the DEFAULT constraint do?
A) Deletes data
B) Assigns default value
C) Updates data
D) None
Answer: B) Assigns default value
Explanation: DEFAULT constraint provides a value when no value is specified during insertion.
Q8. Which command is used to create a table?
A) INSERT
B) CREATE
C) UPDATE
D) DELETE
Answer: B) CREATE
Explanation: CREATE command is used to define a new table in the database.
Q9. What is a stored procedure?
A) Table
B) Precompiled SQL code
C) Column
D) Index
Answer: B) Precompiled SQL code
Explanation: Stored procedures are saved SQL queries that can be reused and executed multiple times.
Q10. Which keyword is used to sort results?
A) GROUP BY
B) ORDER BY
C) SORT
D) ARRANGE
Answer: B) ORDER BY
Explanation: ORDER BY is used to sort query results in ascending or descending order.
MCQ On SQL Queries
SQL queries are the most important to retrieve data from the database. In this section, MCQs on SQL queries based on queries like SELECT, WHERE and ORDER BY are given.

Q1. Which SQL statement is used to retrieve data from a database?
A) INSERT
B) UPDATE
C) SELECT
D) DELETE
Answer: C) SELECT
Explanation: The SELECT statement is used to fetch data from one or more tables in a database.
Q2. What does the WHERE clause do in a query?
A) Sort data
B) Filter data
C) Group data
D) Delete data
Answer: B) Filter data
Explanation: The WHERE clause is used to filter records based on specific conditions.
Q3. Which clause is used to sort the result set?
A) GROUP BY
B) ORDER BY
C) SORT BY
D) ARRANGE
Answer: B) ORDER BY
Explanation: ORDER BY is used to sort the result set in ascending or descending order.
Q4. What does SELECT * FROM table_name mean?
A) Select specific columns
B) Select all columns
C) Delete table
D) Update table
Answer: B) Select all columns
Explanation: The * symbol is used to select all columns from a table.
Q5. Which operator is used for pattern matching?
A) =
B) LIKE
C) IN
D) BETWEEN
Answer: B) LIKE
Explanation: The LIKE operator is used to search for a specified pattern in a column.
Q6. Which clause is used with aggregate functions?
A) WHERE
B) ORDER BY
C) GROUP BY
D) SELECT
Answer: C) GROUP BY
Explanation: GROUP BY is used to group rows that have the same values into summary rows.
Q7. Which keyword is used to remove duplicate values?
A) UNIQUE
B) DISTINCT
C) REMOVE
D) DELETE
Answer: B) DISTINCT
Explanation: DISTINCT is used to return only unique values in the result set.
Q8. What does LIMIT clause do?
A) Filters data
B) Limits number of rows
C) Sorts data
D) Groups data
Answer: B) Limits number of rows
Explanation: LIMIT is used to restrict the number of rows returned in a query.
Q9. Which operator is used to select values within a range?
A) IN
B) LIKE
C) BETWEEN
D) RANGE
Answer: C) BETWEEN
Explanation: BETWEEN is used to filter values within a given range.
Q10. Which clause is executed first in a query?
A) SELECT
B) ORDER BY
C) WHERE
D) FROM
Answer: D) FROM
Explanation: The FROM clause is logically executed first to determine the data source before applying conditions.
MCQ On SQL Queries With Answers (Output Base)
Understanding query output is very important for learning SQL. In this section, output-based MCQs on SQL queries with answers are given, which improve logical thinking and query understanding.

Q1. What will be the output of the following query?
SELECT 5 + 3;
A) 5
B) 3
C) 8
D) Error
Answer: C) 8
Explanation: SQL can perform arithmetic operations, so 5 + 3 = 8.
Q2. What will this query return?
SELECT COUNT(*) FROM students;
A) Total rows
B) Total columns
C) Error
D) NULL
Answer: A) Total rows
Explanation: COUNT(*) returns the total number of rows in the table.
Q3. What is the output of this query?
SELECT DISTINCT city FROM customers;
A) All cities
B) Duplicate cities
C) Unique cities
D) Error
Answer: C) Unique cities
Explanation: DISTINCT removes duplicate values and returns only unique records.
Q4. What will this query do?
SELECT name FROM students WHERE marks > 50;
A) Show all students
B) Show students with marks less than 50
C) Show students with marks greater than 50
D) Error
Answer: C) Show students with marks greater than 50
Explanation: WHERE clause filters records based on the condition marks > 50.
Q5. What is the output of this query?
SELECT MIN(marks) FROM students;
A) Highest marks
B) Lowest marks
C) Average marks
D) Error
Answer: B) Lowest marks
Explanation: MIN() function returns the smallest value from a column.
Q6. What will this query return?
SELECT MAX(age) FROM employees;
A) Minimum age
B) Maximum age
C) Average age
D) Error
Answer: B) Maximum age
Explanation: MAX() returns the highest value from a column.
Q7. What does this query do?
SELECT name FROM students ORDER BY name ASC;
A) Sort descending
B) No sorting
C) Sort ascending
D) Error
Answer: C) Sort ascending
Explanation: ORDER BY ASC sorts the results in ascending order.
Q8. What is the output of this query?
SELECT 10 / 2;
A) 2
B) 5
C) 10
D) Error
Answer: B) 5
Explanation: SQL performs arithmetic division, so 10 ÷ 2 = 5.
Q9. What will this query return?
SELECT LENGTH(‘SQL’);
A) 2
B) 3
C) 4
D) Error
Answer: B) 3
Explanation: LENGTH() returns the number of characters in a string. “SQL” has 3 characters.
Q10. What does this query return?
SELECT UPPER(‘sql’);
A) sql
B) SQL
C) Sql
D) Error
Answer: B) SQL
Explanation: UPPER() converts all characters in a string to uppercase.
MCQ On SQL Class 12
SQL is an important part of the syllabus for school level students. In this section, MCQ on SQL class 12 is given as per CBSE and state board pattern.

Q1. What is SQL mainly used for?
A) Designing websites
B) Managing databases
C) Writing programs
D) Creating images
Answer: B) Managing databases
Explanation: SQL is used to manage and manipulate data stored in databases.
Q2. What is the full form of DBMS?
A) Data Backup Management System
B) Database Management System
C) Data Base Memory System
D) None
Answer: B) Database Management System
Explanation: DBMS stands for Database Management System, which is used to store and manage data.
Q3. What is a table in SQL?
A) Collection of files
B) Collection of rows and columns
C) Collection of queries
D) None
Answer: B) Collection of rows and columns
Explanation: A table organizes data into rows (records) and columns (fields).
Q4. What is a primary key?
A) Duplicate value
B) Unique identifier
C) Null value
D) None
Answer: B) Unique identifier
Explanation: A primary key uniquely identifies each record in a table.
Q5. Which command is used to display data?
A) INSERT
B) DELETE
C) SELECT
D) UPDATE
Answer: C) SELECT
Explanation: SELECT command is used to retrieve data from a database.
Q6. What is a record?
A) Column
B) Row
C) Table
D) Field
Answer: B) Row
Explanation: A record is a row in a table that contains data.
Q7. What is a field?
A) Row
B) Column
C) Table
D) Record
Answer: B) Column
Explanation: A field is a column that stores a specific type of data.
Q8. Which clause is used to filter data?
A) ORDER BY
B) GROUP BY
C) WHERE
D) SELECT
Answer: C) WHERE
Explanation: WHERE clause is used to apply conditions and filter records.
Q9. What does ORDER BY do?
A) Filters data
B) Sorts data
C) Deletes data
D) Updates data
Answer: B) Sorts data
Explanation: ORDER BY sorts the result in ascending or descending order.
Q10. What is the use of INSERT command?
A) Delete data
B) Update data
C) Add new data
D) Sort data
Answer: C) Add new data
Explanation: INSERT is used to add new records into a table.
MCQ On SQL In DBMS
SQL and DBMS are closely related to each other. To understand database management, theory-based MCQ on SQL in DBMS are given in this section.

Q1. What is SQL in DBMS?
A) Programming language
B) Query language
C) Markup language
D) None
Answer: B) Query language
Explanation: SQL is a query language used to interact with databases in a DBMS.
Q2. Which DBMS uses SQL?
A) Relational DBMS
B) Hierarchical DBMS
C) Network DBMS
D) None
Answer: A) Relational DBMS
Explanation: SQL is primarily used in Relational Database Management Systems (RDBMS).
Q3. What is the main function of SQL in DBMS?
A) Design UI
B) Manage data
C) Create images
D) None
Answer: B) Manage data
Explanation: SQL is used to store, retrieve, update, and delete data in DBMS.
Q4. Which command is used to retrieve data in DBMS?
A) INSERT
B) DELETE
C) SELECT
D) UPDATE
Answer: C) SELECT
Explanation: SELECT is used to fetch data from a database.
Q5. Which command is used to modify database structure?
A) DML
B) DDL
C) DCL
D) TCL
Answer: B) DDL
Explanation: DDL commands like CREATE and ALTER are used to define and modify database structure.
Q6. What is data integrity in DBMS?
A) Duplicate data
B) Accurate data
C) Deleted data
D) None
Answer: B) Accurate data
Explanation: Data integrity ensures that the data in the database is accurate and consistent.
Q7. What is normalization?
A) Data duplication
B) Data organization
C) Data deletion
D) None
Answer: B) Data organization
Explanation: Normalization is the process of organizing data to reduce redundancy.
Q8. What is a constraint in DBMS?
A) Function
B) Rule
C) Table
D) Column
Answer: B) Rule
Explanation: Constraints are rules applied to ensure data accuracy and integrity.
Q9. What is a relationship in DBMS?
A) Link between tables
B) Link between rows
C) Link between columns
D) None
Answer: A) Link between tables
Explanation: Relationships connect tables using keys like foreign keys.
Q10. What is a view in DBMS?
A) Physical table
B) Virtual table
C) Column
D) Index
Answer: B) Virtual table
Explanation: A view is a virtual table based on the result of a SQL query.
For deeper understanding 👉 Database concepts guide
If you want to strengthen your programming basics, you can also practice 👉 C Programming MCQ Quiz for beginners to improve your logic-building skills.
MCQ On SQL Joins
Joins are an advanced and frequently asked topic in SQL. In this section, MCQ on SQL joins based on INNER JOIN, LEFT JOIN and RIGHT JOIN are given.

Q1. What is a JOIN in SQL?
A) Combine tables
B) Delete tables
C) Create tables
D) None
Answer: A) Combine tables
Explanation: JOIN is used to combine rows from two or more tables based on a related column.
Q2. Which JOIN returns only matching records from both tables?
A) LEFT JOIN
B) RIGHT JOIN
C) INNER JOIN
D) FULL JOIN
Answer: C) INNER JOIN
Explanation: INNER JOIN returns only the rows that have matching values in both tables.
Q3. What does LEFT JOIN return?
A) Only matching rows
B) All rows from left table + matching rows from right
C) All rows from right table
D) None
Answer: B) All rows from left table + matching rows from right
Explanation: LEFT JOIN returns all records from the left table and matching records from the right table.
Q4. What does RIGHT JOIN return?
A) All rows from left table
B) Only matching rows
C) All rows from right table + matching rows from left
D) None
Answer: C) All rows from right table + matching rows from left
Explanation: RIGHT JOIN returns all records from the right table and matching records from the left table.
Q5. Which JOIN returns all records from both tables?
A) INNER JOIN
B) LEFT JOIN
C) RIGHT JOIN
D) FULL JOIN
Answer: D) FULL JOIN
Explanation: FULL JOIN returns all records when there is a match in either table.
Q6. Which clause is used with JOIN?
A) WHERE
B) ON
C) SELECT
D) ORDER
Answer: B) ON
Explanation: The ON clause specifies the condition for joining tables.
Q7. What is a self join?
A) Join two tables
B) Join same table
C) Delete table
D) None
Answer: B) Join same table
Explanation: A self join is used to join a table with itself.
Q8. Which JOIN is used to find unmatched records?
A) INNER JOIN
B) LEFT JOIN
C) RIGHT JOIN
D) OUTER JOIN
Answer: D) OUTER JOIN
Explanation: OUTER JOIN is used to get matched and unmatched records from tables.
Q9. What happens if there is no matching record in INNER JOIN?
A) NULL value
B) Row is skipped
C) Error
D) Duplicate
Answer: B) Row is skipped
Explanation: INNER JOIN only returns matching rows, so non-matching rows are excluded.
Q10. Which JOIN is most commonly used?
A) LEFT JOIN
B) RIGHT JOIN
C) INNER JOIN
D) FULL JOIN
Answer: C) INNER JOIN
Explanation: INNER JOIN is the most commonly used join for retrieving matching records.
MCQ On SQL Functions
SQL functions are very useful for data analysis. In this section, MCQ on SQL functions based on functions like COUNT, SUM, AVG are given.

Q1. What is a SQL function?
A) Table
B) Predefined operation
C) Database
D) None
Answer: B) Predefined operation
Explanation: SQL functions are predefined operations used to perform calculations or manipulate data.
Q2. Which function is used to count rows?
A) SUM()
B) COUNT()
C) AVG()
D) MAX()
Answer: B) COUNT()
Explanation: COUNT() returns the number of rows in a table or matching a condition.
Q3. Which function returns the maximum value?
A) MIN()
B) MAX()
C) AVG()
D) SUM()
Answer: B) MAX()
Explanation: MAX() returns the highest value from a column.
Q4. Which function returns the minimum value?
A) MIN()
B) MAX()
C) SUM()
D) COUNT()
Answer: A) MIN()
Explanation: MIN() returns the smallest value from a column.
Q5. Which function calculates the average?
A) SUM()
B) AVG()
C) COUNT()
D) MAX()
Answer: B) AVG()
Explanation: AVG() calculates the average value of a column.
Q6. Which function is used to add values?
A) ADD()
B) TOTAL()
C) SUM()
D) COUNT()
Answer: C) SUM()
Explanation: SUM() calculates the total of numeric values.
Q7. What does UPPER() function do?
A) Lowercase text
B) Uppercase text
C) Count text
D) None
Answer: B) Uppercase text
Explanation: UPPER() converts all characters in a string to uppercase.
Q8. What does LOWER() function do?
A) Uppercase text
B) Lowercase text
C) Count text
D) None
Answer: B) Lowercase text
Explanation: LOWER() converts all characters in a string to lowercase.
Q9. What does LENGTH() function return?
A) Number of rows
B) Number of columns
C) Length of string
D) None
Answer: C) Length of string
Explanation: LENGTH() returns the number of characters in a string.
Q10. Which type of functions operate on multiple rows?
A) Scalar functions
B) Aggregate functions
C) String functions
D) None
Answer: B) Aggregate functions
Explanation: Aggregate functions (like COUNT, SUM) operate on multiple rows and return a single value.
MCQ On SQL Injection
Security is an important part of database management. In this section, MCQ on SQL injection based on its prevention methods are given.

Q1. What is SQL Injection?
A) Database design method
B) Security attack
C) Query optimization
D) None
Answer: B) Security attack
Explanation: SQL Injection is a type of cyber attack where malicious SQL queries are inserted into input fields to manipulate the database.
Q2. What is the main goal of SQL Injection?
A) Improve performance
B) Access unauthorized data
C) Create tables
D) Backup data
Answer: B) Access unauthorized data
Explanation: Attackers use SQL Injection to gain unauthorized access to sensitive data.
Q3. Which input field is commonly targeted in SQL Injection?
A) Password field
B) Login form
C) Search box
D) All
Answer: D) All
Explanation: Any user input field can be targeted if not properly secured.
Q4. Which symbol is commonly used in SQL Injection?
A) #
B) —
C) *
D) @
Answer: B) —
Explanation: The double dash (–) is used to comment out the rest of a SQL query.
Q5. What is the best way to prevent SQL Injection?
A) Use SELECT
B) Use prepared statements
C) Use DELETE
D) None
Answer: B) Use prepared statements
Explanation: Prepared statements separate SQL logic from user input, preventing injection attacks.
Q6. What happens during SQL Injection?
A) Data is secured
B) Data is manipulated
C) Data is deleted automatically
D) None
Answer: B) Data is manipulated
Explanation: Attackers can modify, delete, or access data using malicious queries.
Q7. Which language is mainly affected by SQL Injection?
A) HTML
B) SQL
C) CSS
D) XML
Answer: B) SQL
Explanation: SQL Injection specifically targets SQL-based database systems.
Q8. Which practice improves SQL security?
A) Hardcoding queries
B) Input validation
C) Ignoring errors
D) None
Answer: B) Input validation
Explanation: Validating user input helps prevent malicious data from being executed.
Q9. What is parameterized query?
A) Fixed query
B) Dynamic query
C) Safe query with parameters
D) None
Answer: C) Safe query with parameters
Explanation: Parameterized queries use placeholders, making them secure against SQL Injection.
Q10. SQL Injection mainly affects which type of databases?
A) Relational databases
B) NoSQL databases
C) File systems
D) None
Answer: A) Relational databases
Explanation: SQL Injection targets relational databases that use SQL for queries.
Learn how to prevent attacks 👉 SQL injection prevention guide
MCQ On SQL Indiabix
Regular practice is very important for interview preparation. In this section, MCQ on SQL Indiabix based on Indiabix style are given, which gives real exam experience.

Q1. Which SQL statement is used to extract data from a database?
A) GET
B) SELECT
C) EXTRACT
D) OPEN
Answer: B) SELECT
Explanation: SELECT is the standard SQL command used to retrieve data from a database.
Q2. Which SQL clause is used to filter records?
A) ORDER BY
B) GROUP BY
C) WHERE
D) SORT
Answer: C) WHERE
Explanation: WHERE clause filters records based on specific conditions.
Q3. Which keyword is used to sort results in descending order?
A) DESC
B) DOWN
C) SORT
D) LOWER
Answer: A) DESC
Explanation: DESC is used with ORDER BY to sort results in descending order.
Q4. Which function returns the number of records?
A) SUM()
B) COUNT()
C) AVG()
D) TOTAL()
Answer: B) COUNT()
Explanation: COUNT() returns the total number of rows.
Q5. Which SQL statement is used to update data?
A) MODIFY
B) CHANGE
C) UPDATE
D) SET
Answer: C) UPDATE
Explanation: UPDATE is used to modify existing data in a table.
Q6. Which operator is used to search for a pattern?
A) IN
B) BETWEEN
C) LIKE
D) EXISTS
Answer: C) LIKE
Explanation: LIKE is used for pattern matching in SQL queries.
Q7. Which SQL keyword is used to remove duplicate values?
A) UNIQUE
B) DISTINCT
C) REMOVE
D) DELETE
Answer: B) DISTINCT
Explanation: DISTINCT ensures only unique values are returned.
Q8. Which clause is used to group records?
A) ORDER BY
B) WHERE
C) GROUP BY
D) SORT
Answer: C) GROUP BY
Explanation: GROUP BY groups rows with similar values.
Q9. Which command is used to delete a table?
A) DELETE
B) REMOVE
C) DROP
D) TRUNCATE
Answer: C) DROP
Explanation: DROP removes the entire table structure and data.
Q10. Which clause is used to limit the number of records returned?
A) LIMIT
B) TOP
C) BOTH A and B
D) None
Answer: C) BOTH A and B
Explanation: LIMIT (MySQL) and TOP (SQL Server) are used to restrict the number of rows returned.
Conclusion
Practice is more important than theory to learn SQL, and MCQs on SQL prepare you for exams, interviews and real-world understanding. Just as Mobile Banking awareness has made people digitally empowered, SQL awareness can make you strong in the data world.
So now the question is — will you start practicing SQL MCQs from today?
FAQ (Frequently Asked Questions)
Q1. What is MCQ on SQL and why is it important for students?
Answer:
MCQ on SQL refers to multiple-choice questions based on SQL concepts like queries, commands, joins, and functions. It is important for students because it helps in quick revision, improves problem-solving skills, and prepares them for exams, competitive tests, and technical interviews.
Q2. How can I prepare for SQL MCQs for exams and interviews?
Answer:
To prepare for SQL MCQs, students should first understand basic concepts like SELECT queries, joins, and functions. Regular practice of MCQs, solving previous questions, and analyzing answers with explanations can significantly improve accuracy and confidence during exams and interviews.
