NEW
Font size
WorksheetsSQL MCQs - Class 12
Total questions: 55
Worksheet time: 28mins
What is the purpose of an INNER JOIN in SQL?
To update records in a table.
To create a new table from existing tables.
To delete records from a table.
To retrieve matching records from two or more tables.
Which SQL function is used to count the number of rows in a table?
MAX()
COUNT()
AVG()
SUM()
What data type would you use for a column that stores dates?
INTEGER
DATE or DATETIME
BOOLEAN
STRING
How do you select all columns from a table named 'employees'?
GET * FROM employees;
FETCH * FROM employees;
SELECT * FROM employees;
SELECT ALL FROM employees;
What is the function of the WHERE clause in an SQL statement?
To filter records based on specified conditions.
To create new records in the database.
To sort records in ascending order.
To join multiple tables together.
What type of JOIN returns all records from the left table and matched records from the right table?
FULL OUTER JOIN
LEFT JOIN
RIGHT JOIN
INNER JOIN
Which SQL function is used to find the maximum value in a column?
COUNT()
MIN()
SUM()
MAX()
What is the default data type for a column that stores text in SQL?
CHAR
TEXT
STRING
VARCHAR
How do you filter records in SQL using a specific condition?
Utilize the JOIN clause to combine multiple tables.
Apply the GROUP BY clause to summarize data.
Use the WHERE clause to filter records based on a specific condition.
Use the SELECT statement to retrieve all records.
What is the purpose of the GROUP BY clause in SQL?
To group rows that have the same values in specified columns and perform aggregate functions on them.
To sort rows in ascending or descending order.
To create new tables from existing data.
To filter rows based on specific conditions.
What type of JOIN would you use to combine rows from two tables based on a related column?
RIGHT JOIN
LEFT JOIN
INNER JOIN
FULL OUTER JOIN
Which SQL function would you use to calculate the average of a numeric column?
SUM()
COUNT()
AVG()
MAX()
What is the difference between CHAR and VARCHAR data types?
CHAR is variable-length; VARCHAR is fixed-length.
VARCHAR is used for numeric data types; CHAR is for text.
CHAR can store more data than VARCHAR.
CHAR is fixed-length; VARCHAR is variable-length.
How do you update a record in a table named 'products'?
INSERT INTO products VALUES (new_value) WHERE condition;
DELETE FROM products WHERE condition;
UPDATE products SET column_name = new_value WHERE condition;
SELECT * FROM products WHERE condition;
What is the purpose of the ORDER BY clause in SQL?
To limit the number of rows returned by a query.
To filter the result set of a query.
To group the result set of a query.
To sort the result set of a query.
What SQL statement is used to remove a record from a table?
REMOVE FROM table_name WHERE condition;
DROP table_name WHERE condition;
ERASE FROM table_name WHERE condition;
DELETE FROM table_name WHERE condition;
What is the purpose of the HAVING clause in SQL?
To join multiple tables together.
To filter records after grouping.
To filter records before grouping.
To sort the result set of a query.
Which SQL command is used to create a new table?
ADD TABLE table_name;
MAKE TABLE table_name;
NEW TABLE table_name;
CREATE TABLE table_name;
Which SQL command is used to modify existing records in a table?
EDIT table_name SET column_name = value;
UPDATE table_name SET column_name = value;
CHANGE table_name SET column_name = value;
ALTER table_name SET column_name = value;
What is the purpose of the DISTINCT keyword in SQL?
To limit the number of rows returned by a query.
To sort the result set in descending order.
To return only unique values from a column.
To group rows that have the same values.
What is the full form of SQL?
Structured Query Logic
Standard Query Language
System Query Language
Structured Query Language
Which SQL clause is used to filter records?
GROUP BY
FILTER
WHERE
ORDER BY
Which command is used to create a new database?
CREATE DATABASE
MAKE DATABASE
CREATE TABLE
ADD DATABASE
Which SQL command is used to add a new column to an existing table?
ADD COLUMN
ALTER TABLE
MODIFY TABLE
UPDATE TABLE
Which command is used to insert data into a table?
INSERT INTO
APPEND ROW
ADD RECORD
NEW ENTRY
Which SQL function is used to get the total sum of values in a column?
ADD()
SUM()
COUNT()
TOTAL()
Which clause is used to eliminate duplicate rows from output?
REMOVE DUPLICATES
FILTER
DISTINCT
UNIQUE
Which SQL function is used to find the highest and lowest values in a column?
TOP() and BOTTOM()
MAX() and MIN()
FIRST() and LAST()
HIGH() and LOW()
Which SQL clause is used for sorting records?
SORT BY
ARRANGE BY
ORDER BY
GROUP BY
What is the default order of sorting using ORDER BY?
No default order
Random
Descending
Ascending
Which SQL keyword is used to delete all records in a table without deleting the structure?
REMOVE RECORDS
DROP TABLE
TRUNCATE TABLE
DELETE FROM
Which SQL clause is used for pattern matching?
REGEXP
SEARCH
LIKE
MATCH
Which SQL keyword is used to find NULL values?
= NULL
IS NULL
== NULL
NULL
Which SQL statement is used to modify existing records?
ALTER
MODIFY
UPDATE
CHANGE
Which SQL clause is used to group data based on a specific column?
GROUP BY
ORDER BY
SORT BY
AGGREGATE
Which SQL clause is used to group data based on a specific column?
GROUP BY
ORDER BY
SORT BY
AGGREGATE
Which SQL function calculates the number of records?
COUNT()
SUM()
NUMBER()
TOTAL()
Which SQL constraint ensures that values in a column are unique?
FOREIGN KEY
DEFAULT
UNIQUE
PRIMARY KEY
Which SQL function returns the number of characters in a string?
SIZE()
LENGTH()
STRLEN()
COUNT()
Which SQL clause is used to filter records after grouping?
HAVING
WHERE
ORDER BY
GROUP BY
What is the function of the FOREIGN KEY constraint?
Prevents NULL values
Links data between tables
Ensures unique values
Deletes records automatically
Which SQL constraint is used to set a default value for a column?
PRIMARY KEY
DEFAULT
AUTO_INCREMENT
CHECK
Which SQL operator is used to find a range of values?
RANGE
IN
LIMIT
BETWEEN
Which SQL function rounds a number to a specified decimal place?
TRUNCATE()
CEIL()
FLOOR()
ROUND()
Which SQL function returns the absolute value of a number?
ABS()
ROUND()
CEIL()
MOD()
Which SQL function returns the highest date from a column?
MAX()
HIGH()
LAST()
LATEST()
Which SQL function is used to find the total number of rows in a table?
ROWS()
TOTAL()
COUNT(*)
NUMBER()
Which SQL function converts a value into uppercase?
CAPITALIZE()
UPPER()
CASE()
TOUPPER()
Which SQL statement is used to delete a particular column from a table?
CLEAR COLUMN
REMOVE COLUMN
ALTER TABLE DROP COLUMN
DELETE COLUMN
Which SQL function returns the current system date?
TODAY()
NOW()
GETDATE()
CUR_DATE()
Which SQL constraint ensures that a column cannot have NULL values?
PRIMARY KEY
CHECK
NOT NULL
FOREIGN KEY
Which SQL function removes leading and trailing spaces from a string?
TRIM()
RTRIM()
LTRIM()
CLEAN()
Which SQL statement is used to remove a table from a database?
DELETE TABLE
CLEAR TABLE
REMOVE TABLE
DROP TABLE
Which SQL function combines the values of two columns?
ADD()
MERGE()
JOIN()
CONCAT()
Which SQL function is used to find the average value of a numeric column?
SUM()
MEDIAN()
MEAN()
AVG()
