wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

SQL & MySQL REVIEW QUIZ

Total questions: 51

Worksheet time: 36mins

Name
Class
Date
1.

Which three elements of a relational database are defined in the schema? (Choose 3.)

a)

relationships

b)

attributes

c)

tables

d)

SQL keywords

e)

aliases

2.

In the SQL statement " SELECT genre FROM movies" what is specified by "genre"?

a)

the table

b)

the column

c)

the database

d)

the folder

3.

What is a flat file database?

a)

a database that stores records in a single file with no hierarchical structure

b)

a database that requires SQL to store, manipulate, and retrieve data

c)

a database that is used to store large amounts of complex data

d)

a database that stores data in a sheet using a hierarchical tabular format of columns and rows

4.

What is used to show how the tables in a database are related to one another?

a)

ERD

b)

CSV

c)

DML

d)

DDL

5.

Which commonly used SQL statement is necessary to retrieve data from one or more tables in a database?

a)

INSERT

b)

TRUNCATE

c)

CREATE

d)

SELECT

6.

Which structure in a table represents an individual record contained in the database?

a)

relationship

b)

row

c)

column

d)

foreign key

7.

Which SQL statement is used to filter data in a database?

a)

DISTINCT

b)

ORDER BY

c)

WHERE

d)

FROM

8.

What is represented by the comma-separated list of items following the SELECT command in this example?

a)

records

b)

aliases

c)

columns (attributes)

d)

table names

9.

Refer to the exhibit. The exhibit shows the structures of the Drivers and Orders data tables for a pizza delivery service. The same driver may deliver multiple orders on an average day. What type of relationship exists between the Drivers table and the Orders table?

a)

The two tables have a one-to-one relationship because both have DriverID as the primary key.

b)

There is a one-to-many relationship between the two tables because one driver may have many orders, but an order can have only one driver.

c)

There is a many-to-many relationship between the two tables because there are many drivers and many orders in the tables.

d)

There is a one-to-one relationship between the two tables because DriverID is a common identifier for the records in both tables.

10.

Which two SQL statements are used to create and change a database schema? (Choose two.)

a)

ALTER

b)

CREATE

c)

DELETE

d)

INSERT

e)

SELECT

11.

Refer to the exhibit. You need to get information about customer purchases that is stored in the two tables. You would like to see data from the OrderID, CustomerName, OrderAmount, and OrderDate columns. To obtain this information, how would you complete the following partial SQL query?

SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderAmount, Orders.OrderDate
FROM Orders
INNER JOIN _______ ON _____________ = _____________;

a)

INNER JOIN Orders ON Orders.OrderID=Orders.CustomerID;

b)

INNER JOIN Customers ON Customer.CustomerID=Customers.CustomerID;

c)

INNER JOIN Orders ON Orders.CustomerID=Customers.CustomerID;

d)

INNER JOIN Customers ON Orders.CustomerID=Customers.CustomerID;

12.

In combination with primary and foreign keys, which SQL statement is the most common method for joining fields from multiple tables?

a)

BETWEEN

b)

LIKE

c)

JOIN

d)

WHERE

13.

Refer to the exhibit. Which type of SQL JOIN operation would return all the rows from Table 1 and Table 2?

a)

LEFT JOIN

b)

RIGHT JOIN

c)

FULL JOIN

d)

INNER JOIN

14.

Which JOIN clause would join the two tables Orders and Customers, using the CustomerID field in both tables as the relationship between the two tables?

SELECT *
FROM Orders
LEFT JOIN Customers ON ____________ = ______________;

a)

ON Customers.CustomerID=Orders.CustomerID

b)

ON Orders.CustomerID=Customers.CustomerID

c)

ON Orders.CustomerID=Orders.CustomerID

d)

ON Customers.CustomerID=Customers.CustomerID

15.

Which type of key uniquely defines each table row in a relational database?

a)

foreign key

b)

primary key

c)

principal key

d)

JOIN key

16.

What is the function of a foreign key in a relational database table?

a)

to define a relationship with a primary key in a different table

b)

to uniquely identify a row within the table

c)

to create a many-to-one relationship within the table

d)

to add additional unique columns to the data table

17.

Review the columns and descriptions in each table, Movie, and Award. Data from the two tables need to be combined to extract the title and cost of movies that won awards. Can a NATURAL JOIN be used to accomplish the desired result?

Movie table:
MovieID- primary key
Title- name of the movie
Date- date the movie was released
Cost- total cost of production

Award table:
AwardID- primary key
MovieID- foreign key
Category- award category
Name- name of the award
Date: day the award was received

a)

Yes, because both tables have two common columns.

b)

Yes, because both tables have the MovieID column.

c)

No, because the Date column contains different data types in each table.

d)

No, because an OUTER JOIN should be used to extract all of the information.

18.

What is the result of the query shown in the example?

UPDATE Review
SET Comment = 'This is the new comment'
WHERE MovieId = 3456 AND AuthorName = 'PuzoFan76';

a)

The comment made by PuzoFan76 for the movie with the ID 3456 will be modified to say, “This is a new comment.”

b)

A new comment will be added to the movie with the ID 3456 for the author PuzoFan76.

c)

All of the comments for the movie with the ID 3456 will be modified to say, “This is a new comment.”

d)

A new row will be added to the table Review with the MovieId= 3456 and the AuthorName =PuzoFan76.

19.

What are two types of data that benefit from NoSQL data storage? (Choose two.)

a)

data with flexible formats that can change over time

b)

high volumes of unstructured data

c)

data easily organized in tables of columns and rows

d)

data that conforms to a structured schema

e)

form data requiring input validation

20.

A collection of fields and records in a specific category

a)

Table

b)

Field

c)

Record

d)

column

21.

Rows in database tables are called...

a)

Tables

b)

Records

c)


Fields

22.

What are some best practices when creating tables in SQL?

a)

Using long and descriptive column names

b)

Including NULL values in all columns

c)

Avoiding the use of primary keys

d)

Normalizing data to reduce redundancy

23.

What type of backup and recovery can be performed on a database management system (DBMS)?

a)

Incremental backup

b)

Full backup only

c)

Recovery without backups

d)

Backup with no recovery option

24.

A server with active transactions restarts after a failure. What type of recovery would you recommend?

a)

Redo recovery

b)

Undo recovery

c)

Differential recovery

d)

Partial recovery

25.

Why is MySQL server administration important for database management?

a)

It ensures data is always stored in plaintext format

b)

It guarantees zero downtime during maintenance

c)

It optimizes database performance and security

d)

It simplifies complex SQL queries

26.

How does MySQL server administration contribute to the scalability and performance of database systems?

a)

By limiting the number of concurrent user connections

b)

By reducing the storage capacity of the database

c)

By optimizing indexes and query execution plans

d)

By disabling caching mechanisms for faster access

27.

Which of the following statements correctly illustrates the usage of the SQL ALTER TABLE command?

a)

ALTER TABLE Customers ADD COLUMN Email VARCHAR(50);

b)

UPDATE TABLE Customers SET Email = 'example@email.com';

c)

MODIFY TABLE Customers ADD Email VARCHAR(50);

d)

CREATE TABLE Customers MODIFY Email VARCHAR(50);

28.

What is the primary function of the SQL ALTER TABLE command?

a)

To delete existing tables from the database

b)

To insert new records into a table

c)

To modify the structure of an existing table

d)

To perform complex queries on multiple tables

29.

Which option correctly demonstrates using ALTER TABLE to rename a column in SQL?

a)

ALTER TABLE Employees CHANGE COLUMN OldName NewName VARCHAR(50);

b)

ALTER TABLE Employees MODIFY COLUMN OldName TO NewName VARCHAR(50);

c)

ALTER TABLE Employees RENAME COLUMN OldName TO NewName VARCHAR(50)

d)

ALTER TABLE Employees RENAME COLUMN OldName NewName VARCHAR(50);

30.

How does the SQL ALTER TABLE command contribute to database scalability?

a)

It automatically creates backups of modified tables

b)

It is used to restore databases after a failure

c)

It allows for structural changes to be backed up and recovered

d)

It has no direct impact on backup and recovery processes

31.

In terms of SQL best practices, when should the ALTER TABLE command be used?

a)

Only when creating a new table

b)

As a primary method for inserting data into a table

c)

Whenever modifications to the table structure are necessary

d)

Only when deleting columns from a table

32.

Which action can be performed using the ALTER TABLE command to enhance database security?

a)

Encrypting all data in the table

b)

Adding or removing columns with sensitive information

c)

Restricting access to specific rows in the table

d)

Automatically blocking suspicious IP addresses

33.

What precaution should be taken when using the ALTER TABLE command to maintain data integrity?

a)

Always execute the command during peak usage hours

b)

Ensure there are no active transactions on the table

c)

Modify all columns in the table simultaneously

d)

Use it only on tables with a small number of rows

34.

How does the ALTER TABLE command impact database performance?

a)

It significantly slows down query execution

b)

It has no effect on database performance

c)

It can improve performance by optimizing table structure

d)

It increases latency by introducing unnecessary complexity

35.

What is a primary consideration when designing a database table?

a)

Including redundant data to speed up queries

b)

Choosing arbitrary data types for columns

c)

Normalizing data to minimize redundancy

d)

Limiting the number of rows in each table

36.

When creating a new table in SQL, what is the purpose of defining primary keys?

a)

To allow NULL values in the primary key columns

b)

To enforce data uniqueness and provide fast data retrieval

c)

To restrict access to the table

d)

To increase storage space

37.

Which SQL command is used to import data from a CSV file into a database table?

a)

LOAD DATA

b)

IMPORT TABLE

c)

INSERT INTO

d)

COPY TABLE

38.

What type of backup includes only the data that has changed since the last backup?

a)

Full backup

b)

Differential backup

c)

Incremental backup

d)

Redo backup

39.

Which action helps in cleaning data to ensure consistency and accuracy?

a)

Adding duplicate entries

b)

Removing NULL values

c)

Mixing data types in columns

d)

Ignoring data anomalies

40.

When altering a table, what is a primary consideration to ensure data integrity?

a)

Changing column data types frequently

b)

Dropping all constraints before making changes

c)

Performing alterations during peak usage hours

d)

Backing up data before making alterations

41.

What is the purpose of altering a database table?

a)

To decrease database performance

b)

To remove all existing data

c)

To modify the structure or properties of the table

d)

To limit access to the table

42.

Which MySQL feature allows horizontal partitioning of tables across multiple servers to distribute the load evenly?

a)

Clustering

b)

Partitioning

c)

Replication

d)

Sharding

43.

Why is MySQL server administration important for database management?

a)

It ensures compatibility with other database management systems.

b)

It automates data entry processes.

c)

It helps optimize database performance and ensures its availability.

d)

It primarily focuses on front-end user interface design.

44.

How does MySQL server administration contribute to data integrity and reliability?

a)

By encrypting all data stored in the database.

b)

By automatically detecting and correcting errors in data entries.

c)

By implementing backup and recovery strategies to prevent data loss.

d)

By providing real-time data analytics tools.

45.

What are the security implications of inadequate MySQL server administration?

a)

Increased risk of unauthorized access, data breaches, and data loss.

b)

Enhanced performance and scalability of the database system.

c)

Improved compatibility with third-party applications.

d)

Better data visualization and reporting capabilities.

46.

How does MySQL server administration contribute to the scalability and performance of database systems?

a)

By limiting the number of concurrent user connections.

b)

By enforcing strict data validation rules.

c)

By implementing techniques such as partitioning and sharding to distribute data and workload efficiently.

d)

By focusing solely on data storage without optimizing query execution.

47.

What is the purpose of locking in MySQL databases?

a)

To prevent unauthorized access to the database.

b)

To ensure data consistency and integrity during concurrent access.

c)

To optimize query performance by caching frequently accessed data.

d)

To automate routine maintenance tasks.

48.

What strategies can be employed to minimize locking contention in a MySQL database?

a)

Increasing the number of locks allowed per transaction.

b)

Optimizing queries to reduce the duration of transactions.

c)

Enforcing strict data validation rules.

d)

Disabling locking mechanisms altogether.

49.

Explain the difference between implicit and explicit locking in MySQL.

a)

Implicit locking is automatically applied by MySQL during data retrieval operations, while explicit locking requires manual commands to lock specific resources.

b)

Implicit locking requires explicit commands to lock resources, while explicit locking is automatically applied by MySQL during data retrieval operations.

c)

Both implicit and explicit locking require manual commands to lock specific resources.

d)

There is no difference between implicit and explicit locking in MySQL.

50.

What are the potential consequences of long-held locks in a MySQL database?

a)

Improved data consistency and integrity.

b)

Reduced concurrency and performance degradation.

c)

Enhanced security against unauthorized access.

d)

Increased scalability and fault tolerance.

51.

How can you use MySQL Workbench to analyze and optimize locking operations in a database?

a)

By executing the OPTIMIZE LOCKS command in the SQL Editor.

b)

By configuring custom locking profiles in the Performance Dashboard.

c)

By analyzing the Performance Schema tables related to locking.

d)

By adjusting the locking settings in the Server Administration section.