wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Database Concepts and Functions

Total questions: 35

Worksheet time: 29mins

Name
Class
Date
1.

During a database management workshop, Ananya asked the instructor about the different components of database systems. She specifically wanted to know what DDL stands for in database management.

a)

Data Distribution Layer

b)

Data Design Language

c)

Data Delivery Logic

d)

Data Definition Language

2.

Divya is working on a new project and needs to set up a database. Which SQL command should she use to create a new table for storing project data?

a)

ADD TABLE

b)

INSERT TABLE

c)

MODIFY TABLE

d)

CREATE TABLE

3.

Saisha is working on a project that involves managing a large database for her company. She needs to ensure that her team can effectively manipulate and manage the data stored in the database tables. What is the purpose of DML in SQL?

a)

The purpose of DML in SQL is to manage and manipulate data in database tables.

b)

To define the structure of a database schema.

c)

To optimize database performance.

d)

To create and delete database tables.

4.

During a database management workshop, Kabir asked the participants to name one common DML command used for modifying data in a database.

a)

DELETE

b)

UPDATE

c)

SELECT

d)

INSERT

5.

In a library, each book is assigned a unique identification number to ensure that no two books have the same ID. What is this unique identification number called?

a)

A primary key constraint is a database rule that enforces uniqueness and non-null values for a column or set of columns.

b)

A primary key constraint is used to define foreign keys in other tables.

c)

A primary key constraint can be null in a database table.

d)

A primary key constraint allows duplicate values in a column.

6.

Ananya is managing a database for a library and needs to ensure that each book's ISBN number is unique. How does she enforce uniqueness in the ISBN column?

a)

Use a UNIQUE constraint or create a unique index on the column.

b)

Use a PRIMARY KEY constraint on the column.

c)

Set the column to allow duplicate values.

d)

Create a foreign key reference to another table.

7.

Aanya is designing a database for her new online store. She wants to ensure that every product has a name and cannot be left blank. What is the function of the NOT NULL constraint?

a)

The NOT NULL constraint prevents NULL values in a database column.

b)

The NOT NULL constraint is used to create foreign key relationships.

c)

The NOT NULL constraint allows NULL values in a database column.

d)

The NOT NULL constraint automatically fills NULL values with default values.

8.

Aditi is managing a database of customer information for her online store. She needs to change the address of a customer who has moved. What SQL command would she use to update existing records?

a)

DELETE

b)

UPDATE

c)

INSERT

d)

SELECT

9.

Arnav is learning SQL and is curious about the difference between a function and a procedure. He asks his friend Aashi to explain it to him.

a)

Procedures return a value, while functions do not.

b)

Functions are always faster than procedures in execution.

c)

Functions can only be used in SELECT statements, while procedures can be used anywhere.

d)

The main difference is that functions return a value and can be used in expressions, whereas procedures do not return a value and are executed as standalone statements.

10.

Vanya is analyzing the sales data for her online store and wants to find out the average sales amount for a specific product. How does she calculate the average of a numeric column in SQL?

a)

SELECT MAX(column_name) FROM table_name;

b)

SELECT COUNT(column_name) FROM table_name;

c)

SELECT SUM(column_name) FROM table_name;

d)

SELECT AVG(column_name) FROM table_name;

11.

Riyaan is analyzing a database of customer orders. He wants to know how many orders were placed in total. What SQL function should he use to achieve this?

a)

To calculate the average value of a column.

b)

To retrieve unique values from a dataset.

c)

To sort the rows in a table.

d)

To count the number of rows in a dataset.

12.

Aarav is working on a database project and needs to combine two strings to create a full name from a first name and a last name. How can he concatenate these two strings in SQL?

a)

Use JOIN(string1, string2)

b)

Use MERGE(string1, string2)

c)

Use APPEND(string1, string2)

d)

Use CONCAT(string1, string2) or string1 || string2 (PostgreSQL) or string1 + string2 (SQL Server).

13.

Krish is designing a database for his new application. He needs to choose between CHAR and VARCHAR data types for storing user information. What is the difference between CHAR and VARCHAR data types?

a)

CHAR is variable-length; VARCHAR is fixed-length.

b)

CHAR can store more data than VARCHAR.

c)

Both CHAR and VARCHAR are fixed-length.

d)

CHAR is fixed-length; VARCHAR is variable-length.

14.

Naira is working on a database project and needs to convert a string representation of a number into an integer for her calculations. How does she convert a string to an integer in SQL?

a)

STRING_TO_INT(string_value)

b)

INTEGER(string_value)

c)

TO_INTEGER(string_value)

d)

CAST(string_value AS INT) or CONVERT(INT, string_value)

15.

Viaan is working on a project where he needs to analyze customer feedback. He wants to determine the length of each feedback string to categorize them. What SQL function would he use to find the length of a string?

a)

STRING_LENGTH()

b)

GET_LENGTH()

c)

CHAR_COUNT()

d)

LENGTH()

16.

In a library system, there are two tables: Books and Borrowers. The Borrowers table has a foreign key constraint that links to the Books table. What does this foreign key constraint ensure?

a)

A foreign key constraint is a type of index that speeds up queries.

b)

A foreign key constraint is a rule that allows duplicate values in a table.

c)

A foreign key constraint is a method to delete records from a table.

d)

A foreign key constraint is a rule that enforces a link between two tables, ensuring that values in the child table correspond to values in the parent table.

17.

Arnav is managing a database for his online bookstore. He needs to remove some outdated records of books that are no longer available. How does he delete records from a table in SQL?

a)

DELETE table_name SET condition;

b)

DROP table_name WHERE condition;

c)

REMOVE FROM table_name WHERE condition;

d)

DELETE FROM table_name WHERE condition;

18.

In a school, the teacher wants to analyze the students' scores in different subjects. She decides to use the GROUP BY clause to organize the data. What is the purpose of the GROUP BY clause?

a)

To sort rows in ascending order.

b)

To join multiple tables together.

c)

To filter rows based on a condition.

d)

To group rows that have the same values in specified columns.

19.

Aarav is analyzing a dataset of sales transactions and wants to present the results in a specific order. How can he sort the results of his query?

a)

Filter results with the WHERE clause.

b)

Use the GROUP BY clause in your query.

c)

Use the ORDER BY clause in your query.

d)

Sort results by using the SELECT statement.

20.

In a restaurant, there are two tables: one for customers who ordered appetizers and another for customers who ordered main courses. What is the difference between INNER JOIN and LEFT JOIN when combining these two tables?

a)

INNER JOIN returns customers who ordered both appetizers and main courses; LEFT JOIN returns all customers who ordered appetizers with their corresponding main course orders, if available.

b)

INNER JOIN includes customers who only ordered appetizers.

c)

LEFT JOIN only returns customers who ordered main courses.

d)

INNER JOIN returns all customers from both tables.

21.

In a company, Divya is tasked with organizing the employee database. She notices that many employees have duplicate records and inconsistent information. To address this issue, she decides to implement a process to reduce data redundancy and improve data integrity. What is this process called?

a)

A technique to encrypt sensitive data.

b)

A way to create backups of a database.

c)

A method to increase the size of a database.

d)

A process to reduce data redundancy and improve data integrity.

22.

Aarush is managing a database for a library. He needs to ensure that each book in the library has a unique identifier. Which of the following is a characteristic of a primary key?

a)

A primary key can contain NULL values.

b)

A primary key must be unique for each record in a table.

c)

A primary key can be duplicated across different tables.

d)

A primary key is optional for a database table.

23.

Mira is designing a new library system. What is the purpose of a database schema in her project?

a)

To define the structure and organization of data in a database.

b)

To store actual data records.

c)

To optimize query performance.

d)

To manage user permissions and access.

24.

Riya is tasked with creating a new view in her database to simplify data access for her team. Which SQL command should she use to create a view?

a)

CREATE VIEW

b)

NEW VIEW

c)

ADD VIEW

d)

INSERT VIEW

25.

In a database, what is the purpose of an index?

a)

To enforce data integrity by preventing duplicate entries.

b)

To define relationships between tables.

c)

To speed up the retrieval of rows from a table.

d)

To store large amounts of data efficiently.

26.

During a database optimization session, Sam wants to know how to remove duplicate records from a table. What SQL command should he use?

a)

DELETE DISTINCT FROM table_name;

b)

SELECT DISTINCT column_name FROM table_name;

c)

REMOVE DUPLICATES FROM table_name;

d)

DELETE FROM table_name WHERE condition;

27.

Rohan is studying database design and wants to understand the purpose of normalization. What is the primary goal of normalization in a database?

a)

To increase data redundancy and improve performance.

b)

To eliminate data anomalies and ensure data integrity.

c)

To create more tables for better organization.

d)

To simplify the database structure without any constraints.

28.

Meera is tasked with ensuring that the email addresses in her database are unique. Which constraint should she apply to the email column to achieve this?

a)

PRIMARY KEY

b)

UNIQUE

c)

CHECK

d)

FOREIGN KEY

29.

During a database review, Arjun learns about different types of constraints. What is the purpose of a CHECK constraint in SQL?

a)

To automatically generate unique values for a column.

b)

To create a relationship between two tables.

c)

To ensure that a column cannot contain NULL values.

d)

To enforce a specific condition on a column's values.

30.

Riya is tasked with ensuring that the phone numbers in her customer database follow a specific format. What SQL constraint can she use to enforce this format?

a)

FOREIGN KEY

b)

CHECK

c)

UNIQUE

d)

DEFAULT

31.

During a data analysis session, Sam wants to find the total revenue generated from sales. Which SQL function should he use to sum up the sales amounts?

a)

MAX()

b)

AVG()

c)

COUNT()

d)

SUM()

32.

Aditi is creating a report that requires data from multiple tables in her database. What SQL operation should she use to combine rows from these tables based on a related column?

a)

INTERSECT

b)

JOIN

c)

UNION

d)

GROUP BY

33.

Ravi is learning about database transactions and wants to understand the concept of ACID properties. What does the 'I' in ACID stand for?

a)

Independence

b)

Integrity

c)

Isolation

d)

Inconsistency

34.

During a database design meeting, Priya is asked to explain the purpose of a foreign key. What is the role of a foreign key in a relational database?

a)

To enforce data integrity by preventing NULL values.

b)

To store large amounts of data efficiently.

c)

To establish a link between two tables.

d)

To uniquely identify a record in a table.

35.

In a data analysis project, Aman needs to filter records based on specific criteria. Which SQL clause should he use to specify the conditions for filtering?

a)

ORDER BY

b)

HAVING

c)

GROUP BY

d)

WHERE