NEW
Font size
WorksheetsMySQL Easy-Advanced Mix
Total questions: 75
Worksheet time: 25mins
Which command is used to create a new database in MySQL?
MAKE DATABASE
NEW DATABASE
CREATE DATABASE
BUILD DATABASE
What command is used to display all available databases?
SHOW DATABASES
LIST DATABASE
DISPLAY DATABASE
SELECT DATABASE
Which SQL statement is used to add new records to a table?
INSERT NEW
INSERT INTO
ADD RECORD
CREATE ROW
Which clause is used to filter records in a SELECT statement?
ORDER BY
WHERE
GROUP BY
HAVING
What command deletes all rows from a table but not the table itself?
DROP TABLE
REMOVE TABLE
DELETE TABLE
TRUNCATE TABLE
Which function returns the total number of rows in a result set?
SUM()
TOTAL()
COUNT()
NUMBER()
What type of JOIN returns all records that have matching values in both tables?
FULL JOIN
LEFT JOIN
RIGHT JOIN
INNER JOIN
Which keyword sorts the result set?
SORT
ORDER BY
GROUP BY
ASCEND
What constraint uniquely identifies each record in a table?
FOREIGN KEY
PRIMARY KEY
UNIQUE KEY
DEFAULT KEY
Which SQL command is used to remove a table completely from the database?
DELETE TABLE
ERASE TABLE
DROP TABLE
REMOVE TABLE
What command is used to modify the structure of an existing table?
CHANGE TABLE
ALTER TABLE
UPDATE TABLE
MODIFY TABLE
Which function returns the average value of a numeric column?
MEAN()
AVG()
AVERAGE()
SUM()
Which clause groups rows that have the same values?
GROUP BY
ORDER BY
UNION
JOIN
Which statement is used to retrieve data from a table?
FETCH
GET
SELECT
SHOW
Which command removes a database permanently?
DELETE DATABASE
REMOVE DATABASE
DROP DATABASE
ERASE DATABASE
Which operator is used to test for NULL values?
=
IS NULL
NULL
IS NOT
Which SQL keyword is used to prevent duplicate values?
UNIQUE
DISTINCT
ONLY
NO DUPLICATE
Which MySQL command is used to rename a table?
RENAME TABLE
ALTER NAME
CHANGE TABLE
MODIFY TABLE
Which clause is used to arrange the result set?
A) GROUP BY
B) ORDER BY
C) WHERE
D) LIMIT
Which SQL statement is used to update existing data?
UPDATE
CHANGE
ALTER
MODIFY
Which function returns the largest value in a set?
TOP()
HIGHEST()
MAX()
LARGEST()
Which keyword limits the number of returned rows?
RESTRICT
LIMIT
ROWCOUNT
MAXROWS
Which JOIN includes all records from the left table?
LEFT JOIN
RIGHT JOIN
FULL JOIN
CROSS JOIN
Which command adds a new column to a table?
ADD COLUMN
ALTER TABLE ADD
ALTER TABLE ADD COLUMN
APPEND COLUMN
What constraint ensures that a column cannot have NULL values?
PRIMARY KEY
NOT NULL
UNIQUE
FOREIGN KEY
Which clause is used to specify conditions for grouped records?
A) WHERE
B) HAVING
C) GROUP
D) FILTER
Which function returns the smallest value in a column?
LOWEST()
MIN()
SMALL()
LEAST()
Which command permanently deletes a table?
DROP
DELETE
REMOVE
ERASE
Which operator is used to combine conditions in SQL?
AND/OR
IF
JOIN
COMBINE
Which statement adds a new table to a database?
INSERT TABLE
MAKE TABLE
CREATE TABLE
NEW TABLE
What command is used to undo a transaction?
ROLLBACK
UNDO
CANCEL
REVERSE
Which statement saves all changes permanently to the database?
SAVE
COMMIT
STORE
END
Which keyword is used to join tables vertically?
UNION
JOIN
MERGE
APPEND
Which MySQL statement creates a new user?
ADD USER
CREATE USER
NEW USER
INSERT USER
Which MySQL privilege allows a user to read data?
SELECT
INSERT
DELETE
UPDATE
Which command is used to change user password?
SET PASSWORD
ALTER USER
UPDATE PASSWORD
CHANGE PASSWORD
Which data type is suitable for storing monetary values?
FLOAT
DECIMAL
DOUBLE
INT
What keyword removes duplicate records in a query result?
UNIQUE
ONLY
DISTINCT
FILTER
Which function adds all numeric values?
SUM()
TOTAL()
ADD()
COUNT()
Which keyword is used to join two tables based on a related column?
UNITE
MERGE
JOIN
CONNECT
What command displays the structure of a table?
SHOW TABLE
DESCRIBE
DISPLAY TABLE
VIEW TABLE
Which MySQL command creates a view?
MAKE VIEW
CREATE VIEW
NEW VIEW
ADD VIEW
What command permanently removes all data and structure from a table?
DELETE TABLE
DROP TABLE
CLEAR TABLE
REMOVE TABLE
Which SQL keyword is used to sort data descending?
ORDER DESC
ORDERBY DESC
ORDER BY DESC
SORT DESC
Which clause combines results from multiple SELECT statements?
UNION
JOIN
MERGE
GROUP
Which operator matches a pattern in MySQL?
MATCH
LIKE
EQUAL
SEARCH
Which statement grants privileges to a user?
ALLOW
GRANT
AUTHORIZE
PERMIT
Which statement removes privileges from a user?
REVOKE
REMOVE
DENY
DELETE
Which keyword is used to eliminate duplicates in aggregate results?
UNIQUE
DISTINCT
NO DUPLICATE
EXCLUDE
Which data type is best for storing long text?
TEXT
STRING
VARCHAR
CHAR
Which command changes the name of an existing table?
ALTER TABLE RENAME TO
RENAME TABLE
CHANGE NAME
MODIFY TABLE NAME
Which MySQL function counts only distinct values?
COUNT()
COUNT(DISTINCT)
SUM()
DISTINCTCOUNT()
Which function rounds numbers to the nearest integer?
ROUND()
CEIL()
FLOOR()
TRUNC()
Which function returns the current date?
DATE()
CURDATE()
NOW()
SYSDATE()
Which function returns both current date and time?
DATETIME()
CURRENT()
NOW()
TIME()
What is the default sorting order in ORDER BY clause?
ASC
DESC
NONE
RANDOM
Which function counts non-null values in a column?
SUM()
COUNT()
AVG()
TOTAL()
Which operator combines multiple SELECT results?
UNION
JOIN
MERGE
CONCAT
Which MySQL clause restricts query results to a specific number of rows?
LIMIT
WHERE
GROUP BY
TOP
Which keyword is used to delete a database?
REMOVE DATABASE
DELETE DATABASE
DROP DATABASE
ERASE DATABASE
Which constraint enforces referential integrity?
PRIMARY KEY
UNIQUE
FOREIGN KEY
NOT NULL
Which MySQL statement creates an index?
MAKE INDEX
CREATE INDEX
ADD INDEX
NEW INDEX
Which command removes an index?
DELETE INDEX
DROP INDEX
REMOVE INDEX
CLEAR INDEX
Which keyword is used to check a condition in SQL?
CASE
IF
WHERE
CHECK
Which statement creates a stored procedure?
CREATE PROCEDURE
NEW PROCEDURE
ADD PROCEDURE
MAKE PROCEDURE
Which command executes a stored procedure?
RUN
CALL
EXECUTE
START
Which statement is used to create a trigger?
CREATE TRIGGER
MAKE TRIGGER
NEW TRIGGER
ADD TRIGGER
Which statement permanently removes a trigger?
DROP TRIGGER
DELETE TRIGGER
REMOVE TRIGGER
CLEAR TRIGGER
Which clause is used to rename a column?
RENAME COLUMN
ALTER TABLE CHANGE
CHANGE COLUMN
ALTER TABLE RENAME COLUMN
Which data type is best for true/false values?
BOOLEAN
BIT
TINYINT(1)
ALL OF THE ABOVE
Which function returns the length of a string?
SIZE()
LENGTH()
STRLEN()
CHARCOUNT()
Which operator concatenates two strings in MySQL?
+
CONCAT()
&
||
Which function converts text to uppercase?
UPPER()
UPCASE()
TOUPPER()
CAPS()
Which function extracts a substring from a string?
CUT()
SUBSTRING()
SLICE()
EXTRACT()
Which MySQL statement analyzes and optimizes a table?
ANALYZE TABLE
OPTIMIZE TABLE
CHECK TABLE
REPAIR TABLE
