wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

база

Total questions: 70

Worksheet time: 35mins

Name
Class
Date
1.

Choose the right order of the database design phases

a)

Subject area analysis, Conceptual Design, Logical Design, Physical Design

b)

Conceptual Design, Logical Design, Physical Design, Queries Implementation

c)

Subject area analysis, Logical Design, Conceptual Design, Physical Design

d)

Conceptual Design, Logical Design, Physical Design, DBMS Selection

2.

Which one of the following sorts rows in SQL?

a)

GROUP BY

b)

SORT BY

c)

ALIGN BY

d)

ORDER BY

3.

SQL query and data modification commands make up a(n) ____

a)

TCL

b)

DDL

c)

DCL

d)

DML

4.

Which of the following multi-row operators can be used with a subquery?

a)

ANY

b)

IN

c)

All of the given

d)

ALL

5.

The SQL BETWEEN operator...

a)

Specifies which tables we are selecting from

b)

Specifies a range of values

c)

Specifies primary and foreign keys

d)

Specifies which columns we are selecting from

6.

In ER Diagram by Chen's notation a relationship type is represented by...

a)

Rectangle

b)

Rhombus

c)

Ellipse

d)

Triangle

7.

LIKE operator uses __ and ___

a)

percent sign (%); underscore (_)

b)

question mark (?); asterisk (*)

c)

underscore (_); question mark (?)

d)

asterisk (*); percent sign (%)

8.

The SQL DROP TABLE clause is used to ...

a)

delete a column from the database

b)

delete a row from the table

c)

delete a table from the database

d)

delete a relationship from the database

9.

Union R1 R2 is ...

a)

the relation containing all tuples of R1 that do not appear in R2

b)

the relation containing all tuples that appear in R1, R2, or both

c)

the relation containing all tuples that appear only in both R1 and R2

d)

the relation containing all tuples of R2 that do not appear in R1

10.

If on the chart Table A is on the left side and Table B is on the right side, a right outer join will include in its answer ...

a)

Only the rows for which the values of the two tables' common attribute match exactly

b)

All rows from both Table A and Table B

c)

All the rows from Table B, with the corresponding details of Table A for those rows for which the value of the two tables' common attribute match exactly

d)

All the rows from Table A, with the corresponding details of Table B for those rows for which the values of the two tables' common attribute match exs

11.

Which of the following are considered as DBMS?

a)

PostgreSQL, MS Excel, Oracle, MS SQL Server

b)

PostgreSQL, Access, Oracle, MS Word

c)

PostgreSQL, Access, Oracle, MySQL

d)

PostgreSQL, Access, Oracle, MS Excel

12.

With SQL, how do you select a column named FirstName from a table named Persons?

a)

EXTRACT FirstName FROM Persons;

b)

GET FirstName FROM Persons;

c)

SELECT FirstName FROM Persons;

d)

SELECT Persons.FirstName;

13.

With SQL, how do you select a column named Firstname from a table named Persons?

a)

EXTRACT Firstname FROM Persons;

b)

GET First flame FROM Persons,

c)

SELECT Firstname FROM Persons,

d)

SELECT Persons.First flame;

14.

Which SQL function is used to retrieve a maximum value?

a)

MOST

b)

UPPER

c)

TOP

d)

MAX

15.

Which af the following is an SQL aggregate function?

a)

BETWEEN

b)

ALTER

c)

CHEATER

d)

MIN

16.

Subqueries can be used with the following statements ...

a)

SELECT, INSERT, UPDATE, DELETE

b)

only INSERT, UPDATE, DELETE

c)

only SELECT

d)

only CREATE TABLE

17.

The selection operation in relational algebra is identical to the __ clause in SQL

a)

ORDER BY

b)

SELECT

c)

WHERE

d)

FROM

18.

Insert three rows into the 'employees' table.

a)

INSERT INTO Employees

b)

SELECT Employees

c)

UPDATE Employees

d)

DELETE FROM Employees

19.

Select all employees who were hired before 2022-01-01

a)

WHERE HireDate

b)

ORDER BY HireDate

c)

GROUP BY HireDate

d)

FROM HireDate

20.

For a relation to be in 3NF, it should not contain __ attribute that is transitively dependent on __

a)

a non-primary key, the primary key

b)

a primary key, a non-primary key

c)

a non-primary key, a foreign key

d)

a primary key, a foreign key

21.

Which of the following is not a relational algebra operation?

a)

Selection

b)

Projection

c)

Manipulation

d)

Union

22.

What does follow after the SQL WHERE clause?

a)

Selection condition

b)

Name of the table we are selecting from

c)

Grouping attribute(s)

d)

List of columns to be selected

23.

A Students table contains 3 rows, a Groups table contains 2 rows. How many rows will be in the result of the following query: SELECT FROM Students CROSS JOIN Groups;

a)

6

b)

2

c)

3

d)

5

24.

__ specifies a search condition for a group or an aggregate function.

a)

HAVING Clause

b)

GROUP BY Clause

c)

WHERE Clause

d)

FROM Clause

25.

What keyword can be used to search for a string in a column?

a)

FIND STRING

b)

LIKE

c)

HAS STRONG

d)

CONTAINS STRING

26.

Create a table named 'projects' with columns 'id' (serial, primary key), 'name' (text), and 'start_date' (date). Then, add a unique constraint on the 'name' column. Which SQL statement satisfies the requirement?

a)

CREATE TABLE Projects ( id SERIAL PRIMARY KEY, name TEXT UNIQUE NOT NULL, start_date DATE NOT NULL );

b)

CREATE TABLE Projects ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, start_date DATE );

c)

CREATE TABLE Projects ( id SERIAL, name TEXT NOT NULL, start_date DATE NOT NULL, UNIQUE (start_date) );

d)

CREATE TABLE Projects ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, start_date DATE NOT NULL );

27.

The result of an SQL SELECT statement is a ____

a)

form

b)

fila

c)

table

d)

report

28.

You are given a table 'projects' with attributes 'id', 'name', 'start_date'. Write a query to find the name of the project with the most employees assigned. Which SQL statement returns the correct result?

a)

SELECT p.name FROM Projects p JOIN Project Assignments pa ON p.id = pa.project_id GROUP BY p.name ORDER BY COUNT(pa.employee_id) DESC LIMIT 1;

b)

SELECT name FROM Projects ORDER BY employee_id DESC LIMIT 1;

c)

SELECT p.name FROM Projects p LEFT JOIN Project Assignments pa ON p.id = pa.project_id GROUP BY p.name ORDER BY COUNT(p.id) ASC LIMIT 1;

d)

SELECT p.name, COUNT(pa.employee_id) FROM Projects p JOIN Project Assignments pa ON p.id = pa.project_id ORDER BY COUNT(pa.employee_id) DESC;

29.

Create a table named 'employees' with columns 'id' (integer, primary key), 'name' (text), and 'hire_date' (date). Which SQL statement correctly defines the table?

a)

CREATE TABLE Employees ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, hire_date DATE NOT NULL );

b)

CREATE TABLE Employees ( id SERIAL PRIMARY KEY, name TEXT, hire_date TEXT );

c)

CREATE TABLE Employees ( id INTEGER, name TEXT UNIQUE, hire_date DATE );

d)

CREATE TABLE Employees ( id INTEGER PRIMARY KEY, name VARCHAR NOT NULL, hire_date TIMESTAMP NOT NULL );

30.

Which SQL statement is used to extract data from a database?

a)

OPEN

b)

EXTRACT

c)

SELECT

d)

GET

31.

If on the chart Table A is on the left side and Table B is on the right side, a left outer join will include in its answer...

a)

All rows from both Table A and Table B

b)

All the rows from Table A, with the corresponding details of Table B for those rows for which the values of the two tables' common attribute match exactly

32.

Choose the JOIN without a join condition.

a)

CROSS

b)

OUTER

c)

USING

d)

INNER

33.

Which of the following SQL statements will select all records with all their columns from a table called Sales?

a)

SELECT ALL FROM Sales;

b)

DELETE FROM Sales;

c)

SELECT * FROM Sales WHERE Orderid < 1;

d)

SELECT * FROM Sales;

34.

What is meant by the term union compatibility?

a)

When two or more tables have the same number of rows

b)

Only when all columns of two or more tables have the same data types

c)

Only when two or more tables have the same number of columns

d)

When two or more tables have the same number of columns and when they have the same data types

35.

What is meant by the term union compatibility?

a)

When two or more tables have the same number of rows

b)

Only when all columns of two or more tables have the same data types

c)

Only when two or more tables have the same number of columns

d)

When two or more tables have the same number of columns and when they have the same data types

36.

The column of a table is a synonym for ...

a)

Attribute

b)

Tuple

c)

Entity

d)

Relationship

37.

Determine the type of the relationship between Courses and Teachers entities by its description: one course can be taught by many teachers, and one teacher can teach many courses.

a)

1-to-1

b)

None of the given

c)

1-to-M

d)

M-to-M

38.

A teacher may be assigned with exactly one position (like tutor, lecturer or professor). A position can be assigned to one or more teachers. A teacher is recorded with teacher identity code, name, address and date of birth. A position is recorded with name of the position and the identity code for the position. Identify a table with a Foreign Key(s) for the relationship between TEACHERS and POSITIONS.

a)

in the TEACHER'S table or in the POSITIONS table-irrelevant

b)

associative table between TEACHERS and POSITIONS tables

c)

TEACHERS

d)

POSITIONS

39.

Which of the following statements concerning normal forms is true?

a)

The lower the normal form number, the better the schema design is

b)

Each normal form contains a state of independent properties, unrelated to other normal forms

c)

A relation that is in second normal form is also in first normal form

d)

Schemas that are in second normal form are considered the best

40.

Entities Groups and Subjects have a many-to-many relationship. For this reason a new associative table between them should be created - Schedule table. Definitions of tables are: Groups (group_code (PK), group_name), Subjects (subject_code (PK), subject_name, description). Identify attributes in the Schedule table.

a)

schedule_id (PK), group_code (FK), subject_code (FK)

b)

schedule_id (PK), group_code (FK)

c)

schedule_id (PK), subject_name (FK)

d)

schedule_id (PK), group_name (FK), subject_name (FK)

41.

Choose the right order of the database design phases.

a)

Conceptual Design, Logical Design, Physical Design, DBMS Selection

b)

Conceptual Design, Logical Design, Physical Design, Queries Implementation

c)

Subject area analysis, Conceptual Design, Logical Design, Physical Design

d)

Subject area analysis, Logical Design, Conceptual Design, Physical Design

42.

Determine the type of the relationship between Students and Reader's cards entities by its description: one student has only one reader's card, and one reader's card can belong to only one student.

a)

M-to-M

b)

1-to-1

c)

1-to-M

d)

None of the given

43.

If a relation scheme is in 3NF then it is also in ...

a)

2NF

b)

4NF

c)

5NF

d)

None of the given

44.

The command to remove rows from CUSTOMER table is ...

a)

DROP FROM customer;

b)

REMOVE FROM customer;

c)

DELETE FROM customer;

d)

UPDATE FROM customer;

45.

SQL query and data modification commands make up a(n) __

a)

DDL

b)

TCL

46.

What type of relationship is described by the following rule? For one instance of entity A, there exists one or many instances of entity B; and for one instance of entity B, there exists one or many instances of entity A.

a)

one-to-one

b)

one-to-many

c)

many-to-many

d)

none of the given

47.

Determine the type of the relationship between Customers and Orders entities by its description: one customer can make many orders, and one order can be made by only one customer.

a)

1-to-1

b)

1 to M

c)

None of the given

d)

M-to M

48.

In the query SELECT address FROM users, what is the column being selected?

a)

address

b)

FROM

c)

SELECT

d)

Users

49.

A teacher teaches one or more groups, each of which is taught by one or more teachers. A teacher is recorded with teacher's ID and teacher's recorded with group code. Identify a table with a Foreign Key(s) for the relationship between TEACHERS and GROUPS.

a)

TEACHERS

b)

GROUPS

c)

in the TEACHER'S table or in the GROUPS table-irrelevant

d)

associative table between TEACHERS and GROUPS tables

50.

Which SQL function is used to retrieve a maximum value?

a)

MOST()

b)

UPPER()

c)

MAX()

d)

TOP()

51.

Choose the correct order of key words in a SELECT statement

a)

HAVING,ORDERBY,GROUPBY

b)

HAVING, GROUPBY,ORDERBY

c)

GROUPBY,ORDERBY,HAVING

d)

GROUPBY,HAVING,ORDERBY

52.

Which of the following is not a DML statement?

a)

ALTER TABLE

b)

INSERT

c)

UPDATE

d)

DELETE

53.

The SQL DROP TABLE clause is used to ...

a)

delete a relationship from the database

b)

delete a column from the database

c)

delete a table from the database

d)

delete a row from the table

54.

If you want to apply a second condition to your statement where both statements must be true, what keyword would you use between the conditions?

a)

TRUE

b)

BOTH

c)

AND

d)

WHERE

55.

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

a)

COUNTOF()

b)

SUM()

c)

COUNT()

d)

NUMBER()

56.

What is the keyword you would use before adding conditions to your query?

a)

CONDITIONS

b)

WHAT

c)

EQUALS

d)

WHERE

57.

Which SQL keyword is used to return in a query only different (unique) values?

a)

UNIQUE

b)

DISTINCT

c)

*

d)

DIFFERENT

58.

The SQL BETWEEN operator ...

a)

Specifies which columns we are selecting from

b)

Specifies which tables we are selecting from

c)

Specifies primary and foreign keys

d)

Specifies a range of values

59.

DBMS stands for ...

a)

Database Basic Management System

b)

None of the given

c)

Database Management System

d)

Database Administrator System

60.

Which of the following is an SQL aggregate function?

a)

CREATE

b)

MIN

c)

BETWEEN

d)

ALTER

61.

Choose the correct option to convert phone_number attribute from varchar to integer data type

a)

phone_number::varchar(3)

b)

phone_numbers

c)

phone_number::varchar("")

d)

phone_number to int

62.

Which of the following SQL statements deletes all rows from the table called Sales Data?

a)

DELETE Sales Data;

b)

DELETE FROM Sales Data;

c)

DELETE " FROM Sales Data;

d)

DELETE ALL Sales Data;

63.

Table is synonymous with the term ...

a)

Field

b)

Relation

c)

Record

d)

Column

64.

In an ER diagram by Chen's notation attributes are represented by ...

a)

Triangle

b)

Rhombus

c)

Ellipse

d)

Rectangle

65.

With SQL, how do you select a column named FirstName from a table named Persons?

a)

SELECT Persons.FirstName;

b)

EXTRACT FirstName FROM Persons;

c)

GET FirstName FROM Persons;

d)

SELECT FirstName FROM Persons;

66.

SQL can be used to ...

a)

create database structures only

b)

all of the given can be done by SQL

c)

query database data only

d)

modify database data only

67.

A primary key for an entity is ...

a)

relationship

b)

unique attribute

c)

tuple

d)

any attribute

68.

Which of the following is a DML statement?

a)

ALTER TABLE

b)

SELECT

c)

CREATE TABLE

d)

DROP TABLE

69.

What is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved.

a)

CHECK constraint

b)

Foreign key

c)

Subquery

d)

Alternate key

70.

Which of the SQL statements is correct?

a)

SELECT Username WITH Password FROM Users;

b)

SELECT Username, Password FROM Users;

c)

SELECT Username AND Password FROM Users;

d)

SELECT Username SELECT Password FROM Users;