WorksheetsMastering DBMS Concepts
Total questions: 15
Worksheet time: 8mins
SELECT COUNT(*)
FROM employees
WHERE salary = NULL;
Total number of employees
Employees with NULL salary
0
Error
Which SQL statement is used to retrieve data from a database?
RETRIEVE
SELECT
FETCH
GET
What is a primary key in a database?
A primary key is a unique identifier for a record in a database.
A primary key is an optional identifier for a record in a database.
A primary key is a duplicate identifier for multiple records in a database.
A primary key is a random identifier for a record in a database.
How does a foreign key differ from a primary key?
A primary key can link records, while a foreign key uniquely identifies them.
A primary key is used for indexing, whereas a foreign key is for data validation.
A primary key can be null, while a foreign key must always be unique.
A primary key uniquely identifies records, while a foreign key links records between tables.
What SQL clause is used to filter records?
WHERE
HAVING
SELECT
GROUP BY
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 calculations on them.
To sort rows based on specified column values.
To join multiple tables into a single result set.
To filter rows that meet certain criteria.
Define a composite key in the context of databases.
A composite key is a single attribute that uniquely identifies a record.
A composite key is a key that consists of two or more attributes that together uniquely identify a record in a database.
A composite key is a key that can be used multiple times in a database.
A composite key is a key that consists of only numeric values.
What is the function of the ORDER BY clause in SQL?
The ORDER BY clause groups the result set of a query.
The ORDER BY clause sorts the result set of a query.
The ORDER BY clause limits the result set of a query.
The ORDER BY clause filters the result set of a query.
Explain the difference between INNER JOIN and LEFT JOIN.
INNER JOIN returns matched rows only; LEFT JOIN returns all left table rows with matched right table rows or NULLs.
INNER JOIN includes all rows from both tables; LEFT JOIN excludes unmatched rows.
INNER JOIN returns all rows from the left table; LEFT JOIN returns only matched rows.
INNER JOIN returns all rows regardless of matches; LEFT JOIN returns only unmatched rows.
What is normalization in database design?
Normalization in database design is the process of organizing data to minimize redundancy and dependency.
Normalization is the process of increasing data duplication.
Normalization refers to the process of encrypting sensitive data.
Normalization involves creating multiple copies of data for backup.
What is a unique key constraint?
A unique key constraint is a rule that permits null values in a column.
A unique key constraint is a method for indexing data in a table.
A unique key constraint is a rule that ensures all values in a specified column are unique across the database table.
A unique key constraint allows duplicate values in a column.
How can you update existing records in a SQL table?
Use the UPDATE statement with SET and WHERE clauses.
Apply the INSERT statement with VALUES and SET clauses.
Use the SELECT statement with FROM and WHERE clauses.
Execute the DELETE statement with WHERE and LIMIT clauses.
What is the purpose of the WHERE clause in SQL?
To filter records based on specified conditions.
To create new database entries.
To sort records in ascending order.
To join multiple tables together.
What is a database index and why is it used?
A database index is a method for storing data in a cloud.
A database index is a type of software for managing users.
A database index is a tool for creating backups of data.
A database index is a data structure that improves the speed of data retrieval operations.
What is the difference between a database and a database management system?
A database is the data itself; a DBMS is the software that manages the database.
A database is a type of software; a DBMS is the data itself.
A database is a collection of files; a DBMS is a programming language.
A database stores data; a DBMS is a physical server.
