WorksheetsSQL Easy Test – 100 Questions (Part 1: 1–30)
Total questions: 100
Worksheet time: 50mins
SQL stands for:
Simple Query Language
Structured Query Language
Server Query Language
Sequential Query Logic
Which SQL statement is used to retrieve data?
GET
SELECT
READ
FETCH
Which SQL statement is used to insert new rows?
INSERT
ADD
PUSH
INCLUDE
Which SQL statement is used to update existing rows?
CHANGE
MODIFY
UPDATE
ALTER
Which SQL statement is used to delete rows?
REMOVE
DELETE
ERASE
DROP
6. Which clause filters rows based on a condition?
WHERE
SELECT
ORDER BY
GROUP BY
Which clause is used to sort results?
ORDER BY
SORT
SORT BY
ARRANGE
Which keyword removes duplicate rows?
UNIQUE
DISTINCT
DIFFERENT
SINGLE
Which wildcard matches any number of characters in LIKE?
_
%
*
?
Which wildcard matches a single character in LIKE?
_
%
*
?
Which function counts rows?
SUM()
COUNT()
TOTAL()
NUMBER()
12. The function that returns the highest value is:
max()
min()
sum()
avg()
Which function returns the lowest value?
MIN()
MAX()
LEAST()
LOW()
Which SQL clause groups rows by column values?
GROUP BY
ORDER BY
HAVING
JOIN
Which clause filters grouped data?
WHERE
HAVING
FILTER
GROUP
INNER JOIN returns:
All rows
Only matching rows
Left table rows
Right table rows
LEFT JOIN returns:
Left table rows + matches
Right table rows + matches
All rows
Only matching rows
RIGHT JOIN returns:
Right table rows + matches
Left table rows + matches
All rows
Only matching rows
FULL OUTER JOIN returns:
Left rows only
Right rows only
Only matching rows
All rows from both tables
Which operator tests for NULL?
= NULL
!= NULL
IS NULL
NOT NULL
PRIMARY KEY ensures:
No duplicates
Not NULL
Both A and B
Auto-increment
FOREIGN KEY ensures:
Unique values
Links to another table
Cannot be NULL
Auto-increment
Which command creates a table?
NEW TABLE
CREATE TABLE
MAKE TABLE
BUILD TABLE
Which command removes a table?
DELETE TABLE
DROP TABLE
REMOVE TABLE
DESTROY TABLE
Which command deletes all rows but keeps the table?
DELETE
TRUNCATE
DROP
ERASE
Which SQL statement renames a column?
RENAME
ALTER TABLE...AS
AS
CHANGE COLUMN
Which clause limits the number of returned rows?
LIMIT
TOP
ROWNUM
All of the above
DEFAULT constraint:
Makes column NOT NULL
Sets a fallback value
Ensures uniqueness
Adds a primary key
CHECK constraint:
Ensures column values meet a condition
Sets default values
Makes column UNIQUE
Prevents NULL values
UNIQUE constraint:
Ensures column values meet a condition
Sets default values
Makes column UNIQUE
Prevents NULL values
A. Prevents duplicates B. Sets default value C. Allows NULL D. Creates foreign key
A. Prevents duplicates
B. Sets default value
C. Allows NULL
D. Creates foreign key
Which command updates rows in a table?
CHANGE
MODIFY
UPDATE
ALTER
Which keyword is used to filter rows in UPDATE or SELECT?
FILTER
WHERE
HAVING
ON
Which SQL function calculates the sum?
ADD()
SUM()
TOTAL()
PLUS()
Which SQL function calculates the average?
MEAN()
AVG()
MIDO
AVERAGE()
Which keyword joins tables based on a column?
JOIN
LINK
CONNECT
UNION
Which of the following can be used in a SQL JOIN?
One table
Multiple tables or queries
Only numeric columns
Only string columns
Which keyword keeps duplicates when combining queries?
UNION
UNION ALL
INTERSECT
JOIN
Which function returns the current date in MySQL?
NOW()
GETDATE()
CURDATE()
TODAY()
Which function returns the current timestamp in SQL Server?
NOW()
GETDATE()
CURRENT_TIMESTAMP
TODAY()
Which command removes a column from a table?
REMOVE COLUMN
DROP COLUMN
DELETE COLUMN
ERASE COLUMN
Which operator checks if a value is in a list?
INSIDE
IN
BETWEEN
EXISTS
A range of values
A range of values
A list
NULL values
Text patterns
AND operator returns TRUE if:
Any condition is TRUE
All conditions are TRUE
Only first condition is TRUE
Only second condition is TRUE
OR operator returns TRUE if:
Any condition is TRUE
All conditions are TRUE
No conditions are TRUE
Only first condition is TRUE
NOT operator reverses:
Conditions
Columns
Tables
Joins
IS NULL checks:
If a column equals 0
If a column has no value
If a column equals empty string
If a column is negative
IS NOT NULL checks:
Column has a value
Column equals NULL
Column equals 0
Column equals empty string
48. ORDER BY DESC sorts data:
in descending order
in ascending order
alphabetically
randomly
49. ORDER BY ASC sorts data:
A. Ascending
B. Descending
C. Random
D. Alphabetically
Which keyword creates a view?
CREATE VIEW
NEW VIEW
MAKE VIEW
VIEW TABLE
Which clause filters rows in a view?
HAVING
WHERE
FILTER
LIMIT
Which command renames a table?
CHANGE TABLE
RENAME TABLE
ALTER TABLE
UPDATE TABLE
Which constraint ensures values are unique?
PRIMARY KEY
UNIQUE
FOREIGN KEY
NOT NULL
Which constraint prevents NULL?
PRIMARY KEY
UNIQUE
FOREIGN KEY
NOT NULL
A. UNIQUE B. DEFAULT D. PRIMARY KEY
A. UNIQUE
B. DEFAULT
C. NOT NULL
D. PRIMARY KEY
A composite key is:
A key that includes multiple columns
A single column primary key
A foreign key only
A temporary key
Which keyword sets a default value for a column?
DEFAULT
VALUE
SET
INIT
57. COUNT(column) ignores:
NULL values
Duplicates
Numbers
Text
58. COUNT(*) counts:
Only non-NULL values
Only numbers
All rows including NULLs
Only text
MAX(column) returns:
Lowest value
Highest value
Average
Count
Which of the following represents the lowest value?
Lowest value
Highest value
Average
Count
61. SUM(column) adds:
Text values
Numeric values
All rows
Only NULLs
AVG(column) calculates:
Sum
Count
Average of numeric values
Median
Which SQL statement creates a database?
CREATE DATABASE
NEW DATABASE
MAKE DATABASE
BUILD DATABASE
Which SQL statement deletes a database?
DROP DATABASE
DELETE DATABASE
ERASE DATABASE
REMOVE DATABASE
Which SQL command backs up a database?
BACKUP DATABASE
SAVE DATABASE
COPY DATABASE
EXPORT DATABASE
A. RESTORE DATABASE B. IMPORT DATABASE C. COPY DATABASE D. LOAD DATABASE
RESTORE DATABASE
IMPORT DATABASE
COPY DATABASE
LOAD DATABASE
INNER JOIN returns:
All rows
Only rows with matching keys
Left table rows
Right table rows
LEFT JOIN returns:
Left table rows + matching rows
Right table rows + matching rows
Only matching rows
All rows
RIGHT JOIN returns:
Right table rows + matching rows
Left table rows + matching rows
Only matching rows
All rows
FULL OUTER JOIN returns:
Left table only
Right table only
Only matching rows
All rows from both tables
Which keyword prevents duplicate rows in a SELECT query?
UNIQUE
DISTINCT
SINGLE
DIFFERENT
Which wildcard matches any number of characters in LIKE?
%
_
*
?
Which wildcard matches any number of characters in LIKE?
%
_
*
?
Which wildcard matches a single character in LIKE?
_
%
*
?
Which SQL statement removes all rows but keeps the table structure?
DELETE
TRUNCATE
DROP
ERASE
Which SQL statement removes an entire table?
DELETE TABLE
DROP TABLE
ERASE TABLE
REMOVE TABLE
Which SQL statement adds a new row?
ADD
INSERT
PUSH
INCLUDE
Which SQL statement changes existing rows?
MODIFY
UPDATE
CHANGE
ALTER
Which SQL clause filters rows?
WHERE
HAVING
FILTER
LIMIT
Which SQL clause filters groups?
WHERE
HAVING
GROUP
ORDER
Which keyword is used to rename a column in SELECT?
A. AS
B. RENAME
C. CHANGE
D. MODIFY
PRIMARY KEY ensures:
Column allows NULL
Unique and NOT NULL
Only uniqueness
Only NOT NULL
FOREIGN KEY ensures:
Unique values in a column
Column references another table
Column cannot be NULL
Column auto-increments
NOT NULL ensures:
Column has a value
Column can be NULL
Column has duplicates
Column is unique
DEFAULT sets:
A fallback value if none provided
Column as unique
Column as NOT NULL
Column as primary key
CHECK constraint ensures:
Values meet a condition
Column is unique
Column cannot be NULL
Column references another table
COUNT(*) counts:
Only non-NULL rows
All rows
Only numeric rows
Only text rows
COUNT(column) counts:
Only numeric rows
All rows
Only non-NULL rows in that column
Only text rows
89. SUM(column) calculates:
Count
Average
Sum of numeric values
Maximum value
Column values are unique, Column cannot be NULL, Column has default value, Column references another table
Column values are unique
Column cannot be NULL
Column has default value
Column references another table
MAX(column) returns:
Minimum value
Maximum value
Average value
Sum of values
MIN(column) returns:
Maximum value
Minimum value
Average value
Sum of values
Which operator checks if a value is in a list?
IN
BETWEEN
EXISTS
LIKE
BETWEEN checks:
A single value
A range
A list
NULL values
AND operator returns TRUE if:
Any condition is TRUE
All conditions are TRUE
First condition is TRUE
Second condition is TRUE
OR operator returns TRUE if:
Any condition is TRUE
All conditions are TRUE
First condition is TRUE
Second condition is TRUE
NOT operator:
Inverts a condition
Joins tables
Filters rows
Sorts rows
ORDER BY ASC sorts:
Ascending
Descending
Random
Alphabetically
