Font size
WorksheetsRDBMS QUIZ
Total questions: 100
Worksheet time: 53mins
In DBMS, a row in a table is called:
Tuple
Attribute
Relation
Key
Recall what each column in a table represents.
A record
A tuple
A key
An attribute
Apply the correct method to test MySQL Server connectivity.
Use MySQL Workbench
Use Excel
Use PowerPoint
Use Notepad
Which constraint ensures values in one table match values in another table?
Primary Key
Foreign Key
Unique
Check
Classify the following SQL command: SHOW TABLES;
Data manipulation
Data definition
Meta data retrieval
Transaction control
Explain the role of a foreign key in table relationships.
Encrypts data
Sorts data
Deletes records
Links tables
Evaluate the advantages of using MySQL over other DBMS tools.
It's open-source and uses SQL
It doesn't support SQL
It's a programming language
It's only for large enterprises
Recall what SQL stands for.
Structured Query Language
Simple Query Language
Sequential Query Language
Standard Question Language
The language used to query data from a database is called:
HTML
XML
SQL
C++
SQL stands for:
Structured Question Language
Structured Query Language
Sequential Query Language
Simple Query Language
Identify which of the following is a database management system.
MS Word
Photoshop
Oracle
MS Power Point
SQL is used for:
Querying operating systems
Querying relational databases
Writing programs
Designing websites
The constraint that enforces referential integrity is:
(a)
The relational model organizes data into:
Trees
Graphs
Tables
Records
Identify the correct syntax to select a database for use.
SELECT DATABASE db_name;
OPEN db_name;
CHOOSE db_name;
USE db_name;
MySQL is best suited for which type of databases?
Relational
Hierarchical
Network
Object-oriented
Which command is used to delete all rows of a table without removing its structure?
DROP
DELETE
REMOVE
TRUNCATE
A table in relational database is also called as:
Attribute
Relation
Tuple
Entity
Which command is used to view the structure of a table?
SHOW table_name
DESC table_name
VIEW table_name
Which command is used to back up a MySQL database from the terminal?
mysqlbackup
mysqldump
mysqlsave
backupdb
Which SQL command retrieves data from a database?
SELECT
INSERT
UPDATE
DELETE
Which of the following is NOT a type of key in DBMS?
Primary Key
Foreign Key
Alternate Key
Parent Key
Which SQL command is used to remove a database?
DELETE DATABASE
REMOVE DATABASE
DROP DATABASE
CLEAR DATABASE
Which tool provides a GUI to design and manage MySQL databases?
MySQL Workbench
SQL Editor
Database Builder
Data Manager
Which SQL command is used to create a database?
MAKE DATABASE
NEW DATABASE
CREATE DATABASE
INIT DATABASE
Which command displays all tables in a selected database?
Which MySQL statement is used to select a database before use?
USE database_name
SELECT database_name
OPEN database_name
START database_name
Explain the role of the Configuration Wizard in MySQL installation.
It writes SQL queries
It sets up server parameters
It installs drivers
It creates user accounts
Define the purpose of MySQL Installer for Windows.
To write SQL queries
To configure network settings
To install and manage MySQL components
To test database performance
Which of the following uniquely identifies a row in a table?
Foreign key
Primary key
Candidate key
Alternate key
Which of the following is NOT an aggregate function in MySQL?
SUM()
COUNT()
AVG()
ROUND()
Which SQL clause is used to sort the results?
ORDER BY
SORT BY
Which MySQL command is used to list all tables in a database?
SHOW DATABASES
SHOW TABLES
LIST TABLES
DESCRIBE DATABASE
The SQL command used to remove a record permanently from a table is:
REMOVE
DELETE
DROP
CLEAR
Which MySQL clause is used to filter groups formed by GROUP BY?
ORDER BY
WHERE
HAVING
DISTINCT
In MySQL, the default sorting order of ORDER BY is:
DESC
ASC
RANDOM
NONE
Which symbol is used in SQL for pattern matching with LIKE?
d)
&
Name the command which is used to drop the structure of the table.
CREATE
ALTER
TRUNCATE
DROP
Which SQL operator is used to check if a value exists in a subquery?
BETWEEN
EXISTS
IN
LIKE
Which clause is used with SELECT to filter records in MySQL?
ORDER BY
WHERE
Which MySQL statement is used to change the structure of an existing table?
UPDATE
ALTER
MODIFY
RENAME
In MySQL, which keyword is used to eliminate duplicate rows in the result?
UNIQUE
DISTINCT
NODUPLICATE
DIFFERENT
The LIKE operator in SQL is used for:
Arithmetic operations
String pattern matching
Sorting
Data type conversion
What does the NOT NULL constraint ensure?
Column must be unique
Column must have default value
Column must be primary key
Column cannot have NULL values
Which SQL command is used to create a new table in MySQL?
INSERT
CREATE
UPDATE
ALTER
Which SQL operator is used to compare a value to a list of possible values?
IN
LIKE
ANY
Which of the following is NOT a Data Manipulation Language (DML) command?
DELETE
INSERT
UPDATE
CREATE
Which SQL statement is used to insert new data into a table?
ADD
INSERT INTO
UPDATE
APPEND
Which command is used to rename a table in MySQL?
CHANGE TABLE
RENAME TABLE
ALTER TABLE
MODIFY TABLE
What does the * symbol in SELECT * FROM table; represent?
Multiply column values
Select all columns
Select unique rows
Count all rows
Which of the following is a Data Definition Language (DDL) command?
INSERT
DELETE
CREATE
UPDATE
Which of the following is NOT a valid MySQL data type?
INT
VARCHAR
FLOAT
CHARACTER
Which statement is used for multi-branch conditional logic in MySQL?
IF()
IFNULL()
CASE
LOOP
In a WHILE loop, where is the loop condition checked?
Before executing the loop body
After executing the loop body
Randomly
Only once
Which flow control statement allows you to exit a loop immediately?
EXIT
LEAVE
END
WHILE
Which clause is used to filter rows in MySQL?
ORDER BY
GROUP BY
WHERE
HAVING
Which clause is used to filter groups after aggregation?
WHERE
ORDER BY
GROUP BY
HAVING
Which statement repeats a block of statements until a condition becomes false?
IF
REPEAT
What is a correlated sub-query?
A query that does not reference any outer query
A query that references columns from the outer query
A query without WHERE clause
A query that only updates data
Which of the following is used to execute conditional logic in MySQL?
LOOP()
IF()
LEAVE
ITERATE
Which of the following is an advantage of using views?
Improves security by restricting access to specific columns
Increases storage requirement
Cannot simplify complex queries
Weaken security by restricting access to specific columns
Which of the following is a looping structure in MySQL?
JOIN
WHILE
SELECT
GROUP BY
Which of the following is a correct way to create a view?
CREATE TABLE view_name AS SELECT * FROM table;
CREATE VIEW view_name AS SELECT * FROM table;
Which operator is used to test for NULL values in SQL?
= NULL
IS NULL
LIKE NULL
NOT NULL
How do you update an existing view?
ALTER VIEW view_name AS SELECT ...;
UPDATE VIEW view_name AS SELECT ...;
MODIFY VIEW view_name AS SELECT ...;
CREATE VIEW view_name AS SELECT ...;
Which function returns a specified value if an expression is NULL?
IFNOTNULL()
IFNULL()
CASE
WHILE
Which type of sub-query is executed for each row of the outer query?
Scalar sub-query
Correlated sub-query
Non-correlated sub-query
Inline view
Which clause is used to sort the result set?
WHERE
ORDER BY
GROUP BY
HAVING
What happens if you drop a table on which a view depends?
Nothing, the view still works
The view is automatically updated
Which of the following is a sub-query?
SELECT * FROM table WHERE id=100;
SELECT * FROM table WHERE id IN (SELECT id FROM table2);
UPDATE table SET col=val;
DELETE FROM table;
How do you delete a view in MySQL?
REJECT VIEW view_name;
DELETE VIEW view_name;
DROP VIEW view_name;
REMOVE VIEW view_name;
Views can help in:
Reducing query complexity
Storing data permanently
Avoiding indexing
Increasing table size
Which command is used to create a sequence in SQL?
CREATE SEQUENCE
MAKE SEQUENCE
NEW SEQUENCE
GENERATE SEQUENCE
Which clause is used to sort the result set?
ORDER
SORT BY
ORDER BY
GROUP BY
Which join returns only the rows with matching values in both tables?
INNER JOIN
LEFT JOIN
RIGHT JOIN
FULL OUTER JOIN
What does the UNION operator do in SQL?
Joins tables side by side
Returns duplicate rows from multiple queries
Combines result sets and removes duplicates
Creates a new table
Which join returns all rows from both tables, with NULLs where there is no match?
Inner Join
Natural Join
Full Outer Join
Left Join
Which command is used to undo a transaction?
REVERSE
CANCEL
COMMIT
ROLLBACK
What is the command to delete a sequence in SQL?
DROP SEQUENCE
REMOVE SEQUENCE
DELETE SEQUENCE
ERASE SEQUENCE
Which command is used to delete a user?
DROP USER
DELETE USER
REMOVE USER
ERASE USER
What command is used to take back permissions from a user?
DENY
REVOKE
REMOVE
Which SQL clause keeps duplicates in union results?
UNION EVERY
UNION ALL
UNION DISTINCT
INTERSECT
What clause limits the number of rows returned?
TOP
FIRST
LIMIT
ROWS
A join that relates a table to itself is called:
Cross Join
Self Join
Outer Join
Composite Join
Which clause would you use to change the increment value of an existing sequence?
MODIFY SEQUENCE
ALTER SEQUENCE
UPDATE SEQUENCE
CHANGE SEQUENCE
What is the difference between UNION and UNION ALL?
UNION includes duplicates, UNION ALL removes them
UNION removes duplicates, UNION ALL includes them
They are identical
Only UNION can sort results
Which command is used to make a transaction permanent?
SAVE
ROLLBACK
COMMIT
EXECUTE
What type of index uses a combination of two or more columns?
Simple Index
Primary Index
Compound Index
Unique Index
Which command is used to create a new user in SQL?
ADD USER
NEW USER
CREATE USER
MAKE USER
Which of these requires the same number and order of columns to work properly?
JOIN
UNION
NATURAL JOIN
SUBQUERY
What is the purpose of a SAVEPOINT in a transaction?
Automatically commits changes
Allows partial rollback
Deletes data
Ends a transaction
What command is used to give permissions to a user?
PERMIT
ALLOW
GRANT
ENABLE
Which command retrieves the next row from a cursor?
GET
SELECT
FETCH
PULL
Which statement is used to close a cursor?
END CURSOR
DROP CURSOR
CLOSE CURSOR
EXIT CURSOR
Which statement is used to remove a stored procedure?
DROP PROCEDURE
DELETE PROCEDURE
REMOVE PROCEDURE
CLEAR PROCEDURE
What is the correct order of cursor operations?
OPEN → DECLARE → FETCH → CLOSE
DECLARE → OPEN → FETCH → CLOSE
FETCH → OPEN → DECLARE → CLOSE
DECLARE → FETCH → OPEN → CLOSE
A trigger can be associated with how many tables?
Only one table
Two tables
Any number of tables
Three tables
Which clause is used to execute a stored procedure?
EXEC
EXECUTE
CALL
RUN
Which Command is used to create stored functions?
CREATE FUNCTION
ADD FUNCTION
MAKE FUNCTION
Which statement is used to remove a trigger?
CLEAR TRIGGER
DELETE TRIGGER
REMOVE TRIGGER
DROP TRIGGER
