wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Database Test 23-MAR-2022

Total questions: 108

Worksheet time: 4hrs 36mins

Name
Class
Date
1.
A database management system (DBMS) is a:
a)
Software system used to create, maintain, and provide controlled access to a database
b)
Hardware system used to create, maintain, and provide controlled access to a database
c)
Hardware system used to create, maintain, and provide uncontrolled access to a database
d)
Software system used to create, maintain, and provide uncontrolled access to a database
2.
A database application can perform which of the following activities?
a)
Add records
b)
Display / read records
c)
Update records
d)
All of the above
3.
Data administrator are responsible for ________
a)
Overall management of data resources in an organization
b)
Physical data design
c)
Managing technical issues in the database environment
d)
Writing application program
4.
A relational database consists of a collection of
a)
Field
b)
Record
c)
Table
d)
Keys
5.
A_______ in a table represents a relationship among a set of values
a)
Field
b)
Foreign key
c)
Record
d)
Primary key
6.
The term attribute refers to a ________ of a table
a)
Record
b)
Foreign key
c)
Primary key
d)
Field
7.
The term _______ is used to refer a row
a)
Record
b)
Foreign key
c)
Primary key
d)
Field
8.
Consider attributes ID, CITY, and NAME. Which one if this can be considered as a primary key?
a)
NAME
b)
ID
c)
CITY
d)
ID, NAME
9.
Which one of the following should be taken as a primary key?
a)
Name
b)
DepartmentID
c)
Department
d)
Street
10.
which one of the following cannot be taken as a primary key?
a)
ID
b)
RegistrationNo
c)
DepartmentID
d)
Street
11.
If you were collecting and storing information about your music collection, an album would be considered a(n) _____.
a)
Relation
b)
Entity
c)
Instance
d)
Attribute
12.
The records of a table can be of ________ order.
a)
Any
b)
Same
c)
Sorted
d)
Constant
13.

In a database, Multiple _________ can be created.

a)

Tables

b)

Documents

c)

Primary Key

d)

All of these

14.

___________________ Key uniquely identifies each record in table.

a)

Fields

b)

Record

c)

Row

d)

Primary

15.

In a Database, each row is called a _____________

a)

Field

b)

Data

c)

Record

d)

Table

16.

In a Database, each column is called a _____________

a)

Field

b)

Data

c)

Record

d)

Table

17.

This table has ___________ records.

a)

2

b)

4

c)

5

d)

6

18.

This table has ___________ fields.

a)

2

b)

4

c)

5

d)

6

19.

___________, ___________ & ___________ are fields.

a)

S. No, Product Code & Description

b)

1021, Beverages & Soft drinks, coffees, teas

c)

Dairy Products, Beverages & Seafood.

d)

All of these are fields.

20.

Consider attributes ID, CITY, and NAME. Which one if this can be considered as a primary key?

a)

Name

b)

ID

c)

City

d)

All of these

21.

Which of the following is an example of a DBMS

a)

MS Word

b)

Microsoft Office

c)

Java

d)

Oracle

22.

Database if the collection of information or group of facts in a structured way.

a)

Maybe

b)

No

c)

Yes

d)

Not Always

23.

______________ datatype you'd select for entering "Address".

a)

Number

b)

Date

c)

Text

d)

Time

24.

You have to enter Sam's DOB, What datatype would you use for this field.

a)

Time

b)

Date

c)

Text

d)

Number

25.

______________ symbol indicates that a field is the Primary Key of the table.

a)
b)
c)
d)

All of these

26.

What is this following a definition of?

Stores data/information in an organised way

a)

Field

b)

Database

c)

Record

d)

File/Table

27.

The rows in a database are called:

a)

Records

b)

Fields

c)

Attribute

d)

Coloum

28.

The columns in a database are called:

a)

Records

b)

Fields

c)

Primary key

d)

Foreign key

29.
A database does NOT consist of .........
a)
field
b)
table
c)
character
d)
report
30.
Which language is used to develop and manage databases?
a)
sql
b)
java
c)
html
d)
dbms
31.
A method of only displaying records in a table that match specific criteria...
a)
Filter
b)
Validation
c)
Sort
d)
Verification
32.
A data type used for storing numbers with a fractional part e.g. 3.142
a)
Integer
b)
Boolean
c)
Real / Float
d)
String
33.
A data type that can only hold 2 values e.g. Yes/No or True/False.
a)
Boolean
b)
Integer
c)
Real
d)
String
34.

Data about data is ______________

a)

Data Description

b)

Metadata

c)

Data redundancy

d)

Data inconsistency

35.

Repetition of data is called data ..............

a)

dependance

b)

redundancy

c)

inconsistency

d)

isolation

36.
RDBMS
a)
Relational Database Basic Management System
b)
Relational Database Management System
c)
Required Database Management Setup
d)
None of these
37.

Which statement is used to extract data from a database?

a)

Extract

b)

Get

c)

Open

d)

Select

38.

If you were wanting to filter data, which clause would you use?

a)

Where

b)

Order by

c)

From

d)

Select

39.

Using which word allows you to specify that more than one condition must be met in a query?

a)

Also

b)

And

c)

Or

d)

Where

40.

Using which word allows you to specify that only one of a series of conditions needs to be met in a query filter?

a)

And

b)

Maybe

c)

If

d)

Or

41.

In order to amend data in a database we would use which SQL statement?

a)

Update

b)

Amend

c)

Alter

d)

Modify

42.

To remove a record from a table which SQL statement would you use?

a)

Remove

b)

Cancel

c)

Delete

d)

Eradicate

43.

Which statement allows us to add a record to a table?

a)

Add To

b)

Update To

c)

Add Into

d)

Insert Into

44.

Less than or equal to?

a)

>=

b)

=>

c)

=<

d)

<=

45.

Which character returns all the data found in a table?

a)

%

b)

#

c)

*

d)

/

46.

Which word is missing from the following SQL statement?


Select * table_name

a)

With

b)

Where

c)

From

d)

And

47.

What is the correct order of clauses in a SQL statement?

a)

SELECT, FROM, ORDER BY, WHERE

b)

SELECT, FROM, WHERE, ORDER BY

c)

SELECT, WHERE, FROM, ORDER BY

d)

WHERE, FROM, SELECT, ORDER BY

48.

How do we select all rows for the "Designer" table?

a)

SELECT * FROM Designer

b)

SELECT [All] FROM Designer

c)

SELECT Designer.*

d)

SELECT FROM Designer

49.

How would we script a SQL query to select "Description" from the Item table?

a)

SELECT Item.Description

b)

EXTRACT Description FROM Item

c)

SELECT Item FROM Description

d)

SELECT Description FROM Item

50.

Which query would return only the fields DesignerID and Designer?

a)

SELECT * FROM Designers

b)

SELECT DesignerID, Name FROM Designers

c)

SELECT DesignerID AND Designer FROM Designers

d)

SELECT DesignerID, Designer FROM Designers

51.

You are required to update the phone number for only the DesignerID "SMI01" in the "Designer" table. Which of these would successfully do that?

a)

UPDATE Designer SET PhoneNo = '01224123456'

b)

UPDATE Designer (PhoneNo) VALUES ('01224123456')

c)

UPDATE Designer SET PhoneNo = '01224123456' WHERE DesignerID = 'SMI01'

d)

UPDATE PhoneNo = '01224123456' FROM Designer WHERE DesignerID = 'SMI01'

52.

With SQL how can I return all items in the Item table sorted from the lowest priced to the highest priced?

a)

SELECT * FROM Items ORDER BY Price ASCENDING

b)

SELECT * FROM Items ORDER BY Price ASC

c)

SELECT * FROM Items BY Price LOWEST TO HIGHEST

d)

SELECT * FROM Items ORDER BY Price DESC

53.

How would you DELETE records from the Items table with a "Chair" Type?

a)

DELETE 'Chair' FROM Items

b)

DELETE Type FROM Items WHERE Type = 'Chair'

c)

DELETE FROM Items WHERE Type = 'Chair'

d)

DELETE ITEMS WHERE Type = 'Chair'

54.

How would you display Chairs in the Items table that have a Price greater than £50.

a)

SELECT * FROM Items WHERE Type = 'Chair' AND Price > 50

b)

SELECT * FROM Items WHERE Type = 'Chair' OR Price < 100

c)

SELECT * FROM Iterms WHERE Type = 'Chair' AND Price >= 50

d)

SELECT * FROM Items WHERE Price > 50

55.

Which SQL statement would add a record to the database?

a)

INSERT INTO Designer VALUES ('SMI01', 'M Smith', 'mail@msmith.com', '01224123456')

b)

INSERT VALUES ('SMI01', 'M Smith', 'mail@msmith.com', 01224123456') INTO Designer

c)

INSERT ('SMI01', 'M Smith', 'mail@msmith.com', '01224123456') INTO Designer

d)

INSERT Designer INTO VALUES (''SMI01', 'M Smith', 'mail@msmith.com', '01224123456')

56.

In order to modify data in a database we would use which SQL statement?

a)

Update

b)

Amend

c)

Alter

d)

Modify

57.

What is the ID of the records that are returned when the SQL statement "SELECT * FROM Gymnasts WHERE Name='Xavier'"?

a)

0001

b)

0002

c)

0003

d)

0004

e)

0005

58.

What is the ID of the records that are returned when the SQL statement "SELECT * FROM Gymnasts WHERE HighScore > 8.4"?

a)

0001

b)

0002

c)

0003

d)

0004

e)

0005

59.

Which of the following statements will return the most records?

a)

SELECT * FROM Gymnasts WHERE HighScore > 8.0

b)

SELECT * FROM Gymnasts WHERE Competition LIKE R%

c)

SELECT * FROM Gymnasts WHERE Competition LIKE %o%

d)

SELECT * FROM Gymnasts WHERE Name LIKE %i%

60.

Which of the following is NOT a SQL command?

a)

SELECT

b)

FROM

c)

LIKE

d)

SIMILAR

e)

DISTINCT

61.

How many records are there in this table?

a)

6

b)

7

c)

9

d)

42

62.

How many fields are there in this table?

a)

6

b)

7

c)

9

d)

42

63.

How many records would be returned by the following SQL "SELECT * FROM songs WHERE TimesPlayed >=3

a)

0

b)

2

c)

3

d)

4

64.

How many records would be returned by the following SQL "SELECT * FROM songs WHERE Length < 3 AND Protected = True"?

a)

0

b)

2

c)

3

d)

4

65.

What is the purpose of SQL?

a)

To communicate with a game

b)

To communicate with aliens

c)

To communicate with a database

d)

To communicate with a base

66.

What is the select statement used for?

a)

It is used to select a database

b)

It is used to select data from a database

c)

It is used to select a website

d)

It is not a SQL statement

67.

What is the FROM statement used for?

a)

It is used to select a database

b)

It is not a SQL statement

c)

It is used to select a website

d)

It is used to specify which table to select data from.

68.

What would this SQL query display? SQL * FROM Pupils

a)

It would display pupils who have a * in their name.

b)

It is not a SQL statement.

c)

It would display all records from the Pupils table.

d)

It would not display any pupils.

69.

What would this SQL query display? SQL Forename, Surname FROM Pupils

a)

It would only display pupils forename and surname from the Pupils table.

b)

It is not a SQL statement.

c)

It would display all pupils forenames from Pupils table.

d)

It would not display any pupils.

70.

Which SQL query would display all pupils surnames and registration class?

a)

SELECT * FROM Pupils

b)

SELECT * FROM Pupils WHERE surname, regiClass

c)

SELECT surname, regiClass

d)

SELECT surname, regiClass FROM Pupils

71.

Which SQL query would display all pupils details who have the surname Smith?

a)

SELECT surname FROM Pupils WHERE Smith

b)

SELECT * FROM Pupils WHERE surname = Smith

c)

SELECT * FROM Pupils WHERE surname = "Smith"

d)

SELECT * FROM Pupils

72.

Which SQL query would display all pupils who are older than 12?

a)

SELECT * FROM Pupils WHERE age > 12

b)

SELECT * FROM Pupils WHERE age < 12

c)

SELECT * FROM Pupils WHERE age > "12"

d)

SELECT * FROM Pupils WHERE age >= 12

73.

Which SQL query would display all pupils who 12 years old or order and have the surname Smith?

a)

SELECT * FROM Pupils WHERE Age >= 12 AND Surname = "Smith"

b)

SELECT * FROM Pupils WHERE Age >= 12 AND Surname = Smith

c)

SELECT * FROM Pupils WHERE Age > 12 AND Surname = "Smith"

d)

SELECT * FROM Pupils

74.

Which statement will show all fields and records from the table called "celebs"?

a)

SELECT * FROM celebs;

b)

SELECT FROM celebs;

c)

SELECT forename, surname FROM celebs;

d)

SELECT celebs;

75.

The SQL statement being run is:


SELECT player_name, score FROM leaderboard;


What is the name of the table in this query?

a)

SELECT

b)

player_name

c)

score

d)

leaderboard

76.

Which SQL function is used to count the number of rows in a SQL query?

a)

COUNT()

b)

NUMBER()

c)

SUM()

d)

COUNT(*)

77.

The SQL statement to count distinct rows from a column is,

a)

select COUNT DISTINCT columnname AS total_rows from tablename;

b)

select (COUNT DISTINCT columnname) AS total_rows from tablename;

c)

select DISTINCT columnname AS total_rows from tablename;

d)

select COUNT (DISTINCT) AS total_rows from tablename;

78.

The COUNT() function also counts the NULL values.

a)

True

b)

False

79.

The SUM() function returns - - -

a)

some random values from the given column

b)

the total number of columns in the database

c)

the total number of tables in the given databases

d)

the total sum of a given numeric column

80.

The average value of the given numeric column is calculated by using - - - function.

a)

GETAVG()

b)

FINDAVG()

c)

AVG()

d)

AVGVALUE()

81.

What will be the output of the query :

Select Substring('mysql application',3,3)

a)

app

b)

mysql

c)

application

d)

sql

82.

Which function will be used to remove only the trailing spaces from a string?

a)

ltrim()

b)

rtrim()

c)

trim()

d)

all

83.

Fill in the blank:

___________________ this clause is used to apply condition on all the rows of table.

a)

Where

b)

Having

c)

Order By

d)

Sort By

84.

What will be the output of following query:

Select length(trim(' exam '));

a)

exam

b)

exam

c)

6

d)

4

85.

Difference between ALTER Table command and UPDATE command :

a)

ALTER is DDL command and is used for modifying the schema of table

b)

UPDATE is DML command and is

used for modifying the existing data of table

c)

Using Alter command any value inside the table can be modified.

d)

Using Update command columns of a table can be renamed.

86.
The MIN() function returns the smallest value of the selected column.
a)
True
b)
False
87.
The MAX() function returns the number of rows
a)
True
b)
False
88.
The COUNT() function returns the number of rows that matches a specified criteria.
a)
True
b)
False
89.
Function returns the average value of a numeric column.
a)
Avg
b)
Sum
90.
function returns the total of a numeric column.
a)
Sum
b)
Order
91.

Which of the following functions can be used without GROUP BY clause in SELECT query? (Select all that apply)

a)

COUNT

b)

MAX

c)

MIN

d)

AVG

92.


Which of the following SELECT query returns the department number with maximum salary compensated to an employee? (Consider the table structure as given)

a)

SELECT department_id , max(salary ) FROM employees ;

b)

SELECT department_id , max(salary ) FROM employees GROUP BY department_id ;

c)

SELECT max(salary ) FROM employees GROUP BY department_id ;

d)

SELECT max(salary ) FROM employees ;

93.

Which of the following statements are true about the COUNT function?

a)

The COUNT function counts the number of rows

b)

The COUNT(*) function counts the number of rows with duplicates and NULL values

c)

The COUNT(DISTINCT) function counts the number of distinct rows

d)

COUNT(*) is equivalent to COUNT(ALL)

94.
What word is missing from the line below?
SELECT *
_______ CUSTOMER;
a)
FROM
b)
WHERE
c)
SELECT
d)
ORDER BY
95.
What is the purpose of  *?
a)
Selects ALL fields from the table
b)
Selects only the first field in the table
c)
Selects the last field in the table
d)
Shows only the first row in the table
96.
AVG, COUNT, MAX, MIN and SUM are known as what?
a)
Aggregate functions
b)
Wildcard filters
c)
Subqueries
d)
Calculated field
97.
Does ALTER TABLE let you modify a table?
a)
Yes
b)
No
98.
Which statement do you use to give other users privileges?
a)
GRANT
b)
GIVE ACCESS
c)
ALLOW
d)
GIVE
99.
Which statement do you use to remove other users privileges?
a)
REVOKE
b)
REMOVE ACCESS
c)
UNALLOW
d)
TAKE
100.

What is the purpose of the UPDATE command in SQL?

a)

To edit a table name

b)

To change the name of a field

c)

To change the contents of records in a table

d)

To change the structure of a table

101.

UPDATE customer

SET numberOfOrders = 100, discount = "Yes"

WHERE customerID = 50


The explanation of the above code is:

a)

Use the table customer, and update only the record containing customerID = 50. Change the contents of the field numberOfOrders to 100 and discount to "Yes".

b)

Use the table customer. Change the contents of the field numberOfOrders to 100 and discount = "Yes"

c)

Use the table customer, and update only the record containing customerID = 100. Change the contents of the field numberOfOrders to 50 and discount = "Yes"

d)

Use the table customer, and update only the record containing customerID = 50. Change the contents of the field numberOfOrders to 100.

102.

What is the purpose of the GROUP BY statement in SQL?

a)

It groups tables together.

b)

It groups rows that have the same values into summary rows and is often used with aggregate functions.

c)

It must be used when you use ORDER BY.

d)

It is always used when you use an aggregate function.

103.

This SQL code will :

a)

list the total customers

b)

list the number of customers in each country

c)

list all the customerIDs and their country

d)

list list the number of customers in each city

104.

Which of the following are the five built-in functions provided by SQL?

a)

A. COUNT, SUM, AVG, MAX, MIN

b)

B. SUM, AVG, MIN, MAX, MULT

c)

C. SUM, AVG, MULT, DIV, MIN

d)

D. SUM, AVG, MIN, MAX, NAME

105.

Which one of the following sorts rows in SQL?

a)

A.SORT BY

b)

B.ALIGN BY

c)

C.ORDER BY

d)

D.GROUP BY

106.

Which of the following must be enclosed in double quotes?

a)

A) Dates

b)

B) Column Alias

c)

C) Strings

d)

D) All of the above

107.

Identify the SELECT statements that execute successfully.

a)

SELECT first_name, last_name, job_id, salary*12,

AS Yearly Sal

FROM employees;

b)

SELECT first_name, last_name, job_id, salary*12

"yearly sal"

FROM employees;

c)

SELECT first_name, last_name, job_id, salary AS

"yearly sal"

FROM employees;

d)

SELECT first_name+last_name AS name, job_Id,

salary*12 yearly sal

FROM employees;

108.

Identify the two guidelines for group functions and the GROUP BY clause.

a)

You cannot use a column alias in the GROUP BY clause.

b)

The GROUP BY column must be in the SELECT clause.

c)

By using a WHERE clause, you can exclude rows before dividing them into groups.

d)

The GROUP BY clause groups rows and ensures the order of the result set.

e)

If you include a group function in a SELECT clause, you must include a GROUP BY

clause.