wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

DBMS With SQL Test 03(30-JUN-2021)

Total questions: 70

Worksheet time: 36mins

Name
Class
Date
1.

Which statement is used to extract data from a database?

a)

Extract

b)

Get

c)

Open

d)

Select

2.

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

a)

Where

b)

Order by

c)

From

d)

Select

3.

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

4.

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

5.

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

a)

Update

b)

Amend

c)

Alter

d)

Modify

6.

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

a)

Remove

b)

Cancel

c)

Delete

d)

Eradicate

7.

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

a)

Add To

b)

Update To

c)

Add Into

d)

Insert Into

8.

Less than or equal to?

a)

>=

b)

=>

c)

=<

d)

<=

9.

Which word is missing from the following SQL statement?


Select * table_name

a)

With

b)

Where

c)

From

d)

And

10.

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

11.

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

12.

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

13.

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

14.

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'

15.

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

16.

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'

17.

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

18.

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')

19.

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

a)

COUNT()

b)

NUMBER()

c)

SUM()

d)

COUNT(*)

20.

Which of the following SQL clauses is used to DELETE tuples from a database table?

a)

DELETE

b)

REMOVE

c)

DROP

d)

CLEAR

21.

If you don’t specify ASC or DESC after a SQL ORDER BY clause, the following is used by default

a)

ASC

b)

DESC

c)

There is no default value

d)

None of the mentioned

22.

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” ends with an “a”?

a)

SELECT * FROM Persons WHERE FirstName=’a’

b)

SELECT * FROM Persons WHERE FirstName LIKE ‘a%’

c)

SELECT * FROM Persons WHERE FirstName LIKE ‘%a’

d)

SELECT * FROM Persons WHERE FirstName=’%a%’

23.

What does the ALTER TABLE clause do?

a)

The SQL ALTER TABLE clause modifies a table definition by altering, adding, or deleting table columns and/or constraints

b)

The SQL ALTER TABLE clause is used to insert data into database table

c)

THE SQL ALTER TABLE deletes data from database table

d)

The SQL ALTER TABLE clause is used to delete a database table

24.

The UPDATE SQL clause can _____________

a)

update only one row at a time

b)

update more than one row at a time

c)

delete more than one row at a time

d)

delete only one row at a time

25.

How can you change “Hansen” into “Nilsen” in the “LastName” column in the Persons table?

a)

UPDATE Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’

b)

MODIFY Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’

c)

MODIFY Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’

d)

UPDATE Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’

26.

SQL query to find all the cities whose humidity is 95.

a)

SELECT city WHERE humidity = 95

b)

SELECT city FROM weather WHERE humidity = 95

c)

SELECT humidity = 89 FROM weather

d)

SELECT city FROM weather

27.

SQL query to find the temperature in increasing order of all cities.

a)

SELECT city FROM weather ORDER BY temperature

b)

SELECT city, temperature FROM weather

c)

SELECT city, temperature FROM weather ORDER BY temperature

d)

SELECT city, temperature FROM weather ORDER BY city

28.

Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70.

a)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ OR temperature > 70

b)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ OR temperature > 70

c)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70

d)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ AND temperature > 70

29.

The command to remove rows from a table ‘CUSTOMER’ is __________________

a)

DROP FROM CUSTOMER

b)

UPDATE FROM CUSTOMER

c)

REMOVE FROM CUSTOMER

d)

DELETE FROM CUSTOMER WHERE

30.

Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy.

a)

SELECT city, temperature, condition FROM weather WHERE condition NOT IN (‘sunny’, ‘cloudy’)

b)

SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN (‘sunny’, ‘cloudy’)

c)

SELECT city, temperature, condition FROM weather WHERE condition IN (‘sunny’, ‘cloudy’)

d)

SELECT city, temperature, condition FROM weather WHERE condition BETWEEN (‘sunny’, ‘cloudy’);

31.

Match the following SQL term with a description - FROM

a)

The criteria which must be met

b)

The fields to display

c)

The field and order used to sort the results

d)

The table used in the query

32.

Match the following SQL term with a description - SELECT

a)

The fields to display

b)

The table used in the query

c)

The criteria which must be met

d)

The field and order used to sort the results

33.

Match the following SQL term with a description - WHERE

a)

The table used in the query

b)

The fields to display

c)

The field and order used to sort the results

d)

The criteria which must be set

34.

Match the following SQL term with a description - ORDER BY

a)

The fields to display

b)

The field and order used to sort the results

c)

The table used in the query

d)

The criteria that must be met

35.

In what order does SQL process the instructions?

a)

FROM - SELECT - WHERE - ORDER BY

b)

WHERE - FROM - SELECT - ORDER BY

c)

SELECT - FROM - WHERE - ORDER BY

d)

SELECT - FROM - ORDER By - WHERE

36.

What is a field?

a)

A collection of information

b)

A single item of information

c)

A list of information

d)

A group of records

37.

Which of the following is not a database data type?

a)

text

b)

number

c)

array

d)

date

38.

Which example of the field name below is in camel case?

a)

First Name

b)

firstName

c)

FIRSTNAME

d)

firstname

39.

Which symbol would you use to represent more than 50

a)

= 50

b)

< 50

c)

> 50

d)

# 50

40.

How to select only rows which are equal by the condition?

a)

SELECT * FROM my_table_name WHERE city = 'Berlin'

b)

SELECT * FROM my_table_name WHERE city LIKE 'Berlin'

c)

SELECT * FROM my_table_name WHERE city EQUAL 'Berlin'

d)

SELECT * FROM my_table_name WHERE city EQUALS TO 'Berlin'

41.

How to select only rows which aren't equal by the condition?

a)

SELECT * FROM my_table_name WHERE city <> 'Berlin'

b)

SELECT * FROM my_table_name WHERE city NOT LIKE 'Berlin'

c)

SELECT * FROM my_table_name WHERE city NOT EQUAL 'Berlin'

d)

SELECT * FROM my_table_name WHERE city NOT IN ('Berlin')

42.

How to select only specific columns from the table?

a)

SELECT city, country FROM customers

b)

SELECT customers.city, customers.country FROM customers

c)

SELECT c.city, c.country FROM customers c

d)

SELECT COLUMNS city, country FROM customers

43.

How to select values by many conditions? (choose all possible options)

a)

SELECT * FROM Products WHERE price = 18 OR price = 19

b)

SELECT * FROM Products WHERE price = 18 BETWEEN name LIKE 'nik'

c)

SELECT * FROM Products WHERE price = 18 AND name LIKE 'nik'

d)

SELECT * FROM Products WHERE price = 18 IN name LIKE 'nik'

44.

Which of the proposed statements can return a result that is less or more than the given value?

a)

SELECT * FROM Products WHERE price < 18

b)

SELECT * FROM Products WHERE price LESS THEN 18

c)

SELECT * FROM Products WHERE price BY 18

d)

SELECT * FROM Products WHERE price BETWEEN 18 AND 100

45.

How to select only NULL values?

a)

SELECT * FROM Products WHERE price = NULL

b)

SELECT * FROM Products WHERE price LIKE NULL

c)

SELECT * FROM Products WHERE price IS NULL

d)

SELECT * FROM Products WHERE price EQUALS NULL

46.

How to select values by the last and first symbols in the char field?

a)

SELECT * FROM Customers WHERE city LIKE 'B%'

b)

SELECT * FROM Customers WHERE city LIKE 'B%n'

c)

SELECT * FROM Customers WHERE city LIKE '%n'

d)

SELECT * FROM Customers WHERE city LIKE 'B_%n'

47.

How to select values from the specific range?

a)

SELECT * FROM Products WHERE price IN (18, 22)

b)

SELECT * FROM Products WHERE price BETWEEN 18

AND 22

c)

SELECT * FROM Products WHERE price >= 18 AND

price <= 22

d)

SELECT * FROM Products WHERE price >= 18 OR

price <= 22

48.

DDL means

(a)  

49.

Which of the following is NOT a GROUP BY function?

a)

MAX

b)

MIN

c)

NVL

d)

AVG

50.

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

51.

Which of the following is not a valid SQL statement?

a)
SELECT MIN(pubdate) FROM books GROUP BY category HAVING pubid = 4;
b)
SELECT MIN(pubdate) FROM books WHERE category = 'COOKING';
c)
SELECT COUNT(*) FROM orders WHERE customer# = 1005;
d)
SELECT MAX(COUNT(customer#)) FROM orders GROUP BY customer#;
52.

Which of the following are true about group functions?

a)

You can use group functions in any clause of a SELECT statement.

b)

You can use group functions only in the column list of the select clause and in the WHERE clause of a SELECT statement.

c)

You can mix single row columns with group functions in the column list of a SELECT statement by grouping on the single row columns.

d)

You can pass column names, expressions, constants, or functions as parameter to an group function.

53.

Which keyword is used to eliminate duplicate value?

a)

Distinct

b)

All

c)

Top

d)

Having

54.

Which function is used to display number of record?

a)

Count

b)

Avg

c)

Total

d)

Count(*)

55.

What is the value of query “select round(23463.342,-2)”?

a)

23463.34

b)

23463.3

c)

23500

d)

23464

56.

When examining a row in a table, we refer to it as a...

a)

row number

b)

result number

c)

record

d)

result

57.

When examining a column in a table, we refer to it as a...

a)

field name

b)

folder name

c)

column number

d)

table name

58.

What would the SQL query pictured do?

a)

Find all the men

b)

Find all of the female writers

c)

Find all of Elgar's friends

d)

Find all the male writers

e)

Find all the fish

59.
What is missing in this code? SELECT * FROM WHERE genre = ‘action’ ORDER BY year ASC;
a)
Missing an AND
b)
Table name
c)
Capitalize action
d)
None of these
60.

The language used application programs to request data from the DBMS is referred to as __________

a)

DDL

b)

DML

c)

Query Language

d)

All of the mentioned

61.

Which of the following is not a type of SQL statement?

a)

Data Manipulation Language (DML)

b)

Data Definition Language (DDL)

c)

Data Control Language (DCL)

d)

Data Communication Language (DCL)

62.

Which SQL function is used to find the average value of any column?

a)

Mean()

b)

Avg()

c)

Average()

d)

Sum()

63.

Which would show all fields from the Pupils table?

a)

SELECT * FROM Pupils

b)

SELECT Name, Form FROM Pupils

c)

SELECT * FROM *

d)

SELECT * FROM Forms

64.

Which would find pupils with "er" anywhere in their name?

a)

SELECT * FROM Pupils Where Name = "%er"

b)

SELECT * FROM Pupils Where Name = "$er$"

c)

SELECT * FROM Pupils Where Name = "%er%"

d)

SELECT * FROM Pupils Where Name = "er%"

65.

Choose the correct query

a)

SELECT * FROM EMP WHERE NAME=NULL

b)

SELECT * FROM EMP WHERE NAME IS NULL;

c)

SELECT FROM EMP WHERE NAME IS NULL;

d)

SELECT *FROM EMP WHERE NAME IS 'NULL';

66.

Consider the following SQL statement. What type of statement is this? SELECT * FROM Employee;

a)

DML

b)

DDL

c)

DCL

d)

TCL

67.

Which of the following query contains error?

a)

SELECT * FROM Emp WHERE Empid=1001;

b)

SELECT Empid FROM Emp WHERE Empid=1001;

c)

SELECT Empid FROM Emp;

d)

SELECT Empid WHERE empid=1001;

68.

Which operator performs pattern matching?

a)

BETWEEN

b)

LIKE

c)

EXISTS

d)

None of These

69.

______________ constraint prevents NULL values

a)

UNIQUE

b)

NOT NULL

c)

NULL

d)

FOREIGN KEY

70.

A primary key can be NULL in the table? TRUE or FALSE

a)

TRUE

b)

FALSE