wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

quiz sql

Total questions: 78

Worksheet time: 39mins

Name
Class
Date
1.

Determine the Normal Form of the table:

Teachers (PK teacher_id, PK depart_id, teacher_Iname, email, depart_name)

a)

1 NF

b)

2 NF

c)

3 NF

d)

0 NF

2.

A teacher teaches one or more subjects, each of which is taught by one or more teachers. De are:

Teachers (teacher_id (PK), name, birthdate)

Subjects (subject_code (PK), name, description)

Identify a type of the relationship between Teachers and Subjects tables.

a)

many (teachers)-to-many (subjects)

b)

one(teachers)-to-many(subjects)

c)

one(teachers)-to-one(subjects)

3.

Primary keys made up of more than one single attributes are called

a)

Composite Primary key

b)

Candidate Primary key

c)

Alternate Primary key

4.

A functional dependency is a logical relationship between or among

a)

Attributes

b)

Columns

c)

Tuples

5.

In an ER diagram an entity is represent by a

a)

Rectangle

b)

Oval

c)

Triangle

d)

Rhombus

6.

Complete the code to drop the table Faculties:

a)

DROP TABLE FACULTIES ;

b)

DELETE TABLE FACULTIES ;

7.

Complete the code to create the table Subjects (subj id (PK), name):

CREATE TABLE Subjects(

subj_id int ___________ ,

name varchar(10));

a)

PRIMARY KEY

b)

FOREIGN KEY

8.

Can a Foreign key be NULL?

a)

Yes

b)

No

9.

Determine the type of the relationship between Students and Groups entities by its description: "One s can be enrolled only in one group, and one group contains many students"

a)

1-to-M

b)

1-to-1

c)

M-to-M

10.

Determine the type of the relationship between Products and Orders entities by its description: "One produc can be included in many orders, and one order can include many products"

a)

M to M

b)

1 to 1

c)

1 to M

11.

Determine what functional dependency is in this table

Teachers (PK teacher_id, Iname, email, FK dep_id)

a)

Full

b)

Not Full

12.

Which of the following are considered as DBMS?

a)

PostgreSQL, Access, Oracle, MySQL

b)

-

c)

-

d)

-

13.

Complete the code for the following table Faculties (facult_id (PK), name):

______ Faculties

SET name='Information Technology'

WHERE name='IT';

a)

UPDATE

b)

SET

c)

TABLE

d)

ALTER

14.

Determine the primary key by the description of the table: Students (stud id, Iname, fname,

a)

stud_id

b)

lname

c)

fname

15.

Complete the code to create the table Departments (dep_id (PK), name), where name attribute has constraint:

CREATE TABLE Departments dep_id int PRIMARY KEY,

name varchar(10) ________ );

a)

NOT NULL

b)

NULL

c)

FOREIGN KEY

d)

UNIQUE

16.

The another name for a row is

a)

Record

b)

Column

c)

Data

17.

Complete the code to create the table Teachers (teach_id (PK), lastname), where lastname unique constraint:

CREATE TABLE Teachers( teach_id int PRIMARY KEY,

lastname varchar(10) _______ );

a)

UNIQUE

b)

NOT NULL

c)

NULL

18.

Doctors may prescribe several appointments for one patient. One appointment is focused on only one pa

Patients(patient_id(PK), fname, Iname, age)

Appointments(app_id(PK), time, day_of_week) Identify a table with a Foreign Key(s) for the relationship between Patients table and Appointments tab

a)

Appointments

b)

in the table Appointments or in the Patients table - both options are correct

c)

associative table between Appointments and Patients tables

d)

Patients

19.

Complete the code to add a new column to the table Courses.

ALTER TABLE Courses _____________ credits int;

a)

ADD COLUMN

b)

ALTER COLUMN

c)

NEW COLUMN

20.

Third normal form is based on the concept of …

a)

Transitive dependency

b)

Partial dependency

21.

Complete the code to drop the table Teachers:

DROP _____________ ;

a)

TABLE Teachers

b)

Teachers

c)

Teachers(teacher_id)

22.

A relation in which the intersection of each row and column contains one and only one value is

a)

1NF

b)

2NF

c)

0NF

d)

3NF

23.

Complete the code to drop a column from the table Subjects:

ALTER TABLE Subjects _______________ name;

a)

DROP COLUMN

b)

DELETE COLUMN

c)

DEL COLUMN

24.

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

a)

Rhombus

b)

Rectangle

c)

Oval

25.

How many rows (maximum number) will be deleted by the following code from the table (PK), name): DELETE FROM Subjects WHERE subject_id=1;

write the number here: 1

a)

1

b)

2

c)

0

26.

Complete the code to create the table Subjects (subj_id (PK), name):

CREATE TABLE Subjects( subjid int, name varchar(10),

______________ (subj id));

a)

PRIMARY KEY

b)

FOREIGN KEY REFERENCES TO

c)

FOREIGN KEY

27.

There is a bank that serves many customers, each of which can have one / several accour savings account, a salary account, etc. Determine the type of relationship between the cu accounts entity?

a)

one-to-many

b)

one-to-one

c)

many-to-many

28.

Which of the following is not a phase of database development?

a)

DBMS Selection

b)

-

c)

-

d)

-

29.

Which of the following is not a DDL statement?

a)

ALTER

b)

DROP

c)

CREATE

d)

INSERT

30.

There is a bank, which serves a lot of customers, each of customer can have one/several accounts, for example, saving account, salary account, etc. Identify a table with a Foreign Key(s) for the relationship between Customers table and Accounts table.

a)

Accounts

b)

Customers

c)

associative table between Customers and Accounts tables

d)

in the Customers table or in the Accounts table - both options are correct

31.

A relation in which the intersection of each row and column contains one and only one value is said to be in

a)

1 NF

b)

2 NF

c)

3 NF

d)

0 NF

32.

In an diagram by Chen notation attributes are represented by

a)

Elipse

b)

Oval

c)

Rectangle

d)

Rhombus

33.

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

a)

1-to-M

b)

1-to-1

c)

M-to-M

34.

Can a Foreign key be duplicate?

a)

Yes

b)

No

35.

Complete the code to delete all rows from the following table Faculties (facult_id (PK), name):

a)

DELETE FROM Faculties

b)

DELETE Faculties

c)

DEL FROM Faculties

36.

Complete the code to add a new record with incomplete information for the following table: Teachers (teach_id (PK), firstname, lastname,

dateofbirth):

INSERT INTO Teachers (teach_id, ______________________________)

VALUES (1, 'First name', 'Last name');

a)

firstname, lastname

b)

fname,lname

c)

first_name,l_name

37.

Complete the code to create the table Departments (dep_id (PK), name, faculty_id), where faculty_id is a FK to the table Faculties:

CREATE TABLE Departments dep_id int PRIMARY KEY, name varchar(10), faculty_id int,

_______________________ (faculty_id) REFERENCES Faculties(faculty_id));

a)

FOREIGN KEY

b)

FOREIGN

c)

FK

38.

Determine the Normal Form of the table:

a)

1NF

b)

3NF

c)

2NF

d)

0NF

39.

Complete the code to drop a column from the table Schedule:

ALTER TABLE _________________________;

a)

Schedule DROP COLUMN

b)

DROP COLUMN

c)

ALTER COLUMN DROP TABLE

40.

Key to represent relationship between tables is called

a)

FOREIGN KEY

b)

FOREIGN

c)

FK

41.

A faculty might include several departments, and a department belongs to one faculty. Identify a table with a Foreign Key(s) for the relationship between FACULTIES and DEPARTMENTS.

a)

associative table between FACULTIES and DEPARTMENTS tables

b)

in both FACULTIES and DEPARTMENTS tables

c)

DEPARTMENTS

d)

FACULTIES

42.

Complete the code to drop the table Subjects:

________________ Subjects;

a)

DROP TABLE

b)

DELETE TABLE

c)

DEL TABLE

d)

ALTER TABLE DROP TABLE

43.

Complete the code to drop the table Schedule :

______________ Schedule;

a)

DROP TABLE

b)

DELETE TABLE

c)

DEL TABLE

d)

ALTER TABLE DROP TABLE

44.

Determine the type of the relationship between Products and Orders entities by its description: "One product can be included in many orders, and one order can include many products"

a)

None of the given

b)

1-to-1

c)

1-to-M

d)

M-to-M

45.

Third normal form is based on the concept of … of…

a)

Primary dependency

b)

Partial dependency

c)

Foreign dependency

d)

Transitive dependency

46.

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

a)

Ellipse

b)

Rhombus

c)

Triangle

d)

Rectangle

47.

There is a company that specializes in repairing various equipment. This company takes orders from customers every day. They have a team of specialists, each of whom can perform various orders, however one order is related to only one specialist. Based on this description, determine the type of relationship between specialists entity and orders entity?

a)

one-to-one

b)

many-to-many

c)

one-to-many

48.

Which of the following language is used to specify database structure?

a)

Data Manipulation Language

b)

Data Management Language

c)

Data Development Language

d)

Data Definition Language

49.

Determine the Normal Form of the table:

a)

1NF

b)

2NF

c)

0NF

d)

3NF

50.

Entity Relationship model consists of a collection of basic objects called … and relationships among these objects.

a)

None of the given

b)

Functions

c)

Entities

d)

Models

51.

Determine the Normal Form of the table:

a)

1 NF

b)

2 NF

c)

3 NF

d)

0 NF

52.

A teacher may be assigned with exactly one position, like tutor, lecturer or professor. A position must be assigned to one or more teachers. A teacher is recorded with teacher identity code, name, address and date of birth. A position is associated with name of the position and the identity code for the position.

Identify a type of the relationship between TEACHERS and POSITIONS entities.

a)

one (teachers)-to-one (positions)

b)

one (teachers)-to-many (positions)

c)

one (positions)-to-many (teachers)

d)

many (teachers)-to-many (positions)

53.

Determine the Normal Form of the table:

a)

1 NF

b)

2 NF

c)

3 NF

d)

0 NF

54.

Determine what functional dependency is in this table

a)

full

b)

there is no right answer here

c)

transitive

d)

partial

55.

Determine what functional dependency is in this table

a)

transitive

b)

there is no right answer here

c)

full

d)

partial

56.

There is a bank which serves a lot of customers, each of customer can have one several accounts for example saving account salary account etc identify a table with a Foreign Key(s) for the

relationship between Customers table and Accounts table.

a)

Accounts

b)

Customers

c)

associative table between Customers and Accounts tables

d)

in the Customers table or in the Accounts table - both options are correct

57.

A primary key for an entity is

a)

A unique attribute

b)

a random value assigned to each record

c)

an optional feature with no significant role in database design

58.

There is a bank, which has several departments lke i department, finance HR etc. There are a lot of employees and each of them belongs to only one department identify a table with a Foreign Keys) for the relationship between Departments table and Employees table

a)

Departments

b)

Employees

c)

Department_Employees

d)

in the Departments table or in the Employees table - both options are correct

59.

There is a bank, which serves a lot of customers each of customer can have one severa accounts for example, saving account salary account etc identify a table with a Foreign Key(s) for the relationship betiveen Customers table and Accounts table.

a)

Customers

b)

Accounts

c)

Customer_Accounts

d)

in the Customers table or in the Accounts table - both options are correct

60.

Complete the code to add a new column to the table Subjects:

_______________ Sutjects ADD COLUMN name varchar(25);

a)

ALTER TABLE

b)

CHANGE

c)

ALTER

d)

ADD TABLE

61.

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

a)

1-to-1

b)

1-to-M

c)

M-to-M

62.

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-M

b)

1-to-1

c)

M-to-M

63.

Which of the following is not a DDL statement?

a)

INSERT

b)

CREATE TABLE

c)

ALTER TABLE

d)

DROP TABLE

64.

A teacher may be assigned with exactiy one position, like tutor, lecturer or professor. A position must be assigned to one or more teachers. Ateacher is recorded with teacher identity code name address and date of birth. A position is associated with name of the position and the identity code for the position. identify a type of the relationship betiween TEACHERS and POSITIONS entities

a)

One-to-One Relationship

b)

Many-to-One Relationship

c)

One-to-Many Relationship

d)

Many-to-Many Relationship

65.

What SQL structure is used to limit column values of a table?

a)

CHECK Constraint

b)

INDEX Structure

c)

FOREIGN KEY Constraint

d)

VIEW Constraint

66.

A table with Foreign Key(s) for the relationship between FACULTIES and DEPARTMENTS is:

a)

FACULTIES

b)

DEPARTMENTS

c)

FACULTY_DEPARTMENTS

d)

in the FACULTIES table or in the DEPARTMENTS table - both options are correct

67.

The FD X-> Y is a full dependency in a relation R if there is . attribute A that can be . X and the dependency still holds

a)

At least one removed from

b)

Another attribute B that can be added to X, and the dependency still holds.

c)

Y is a subset of X

d)

No attribute in R that can be added to X, and the dependency still holds

68.

Complete the code to create the table Teachers (teachid (PK), lastname), where lastname attribute has the not null constraint:

CREATE TABLE Teachersf teach_id int PRIMARY KEY lastname varchar(10) __________

a)

NULL

b)

NOT NULL

c)

UNIQUE

69.

Which of the following is not a phase of database development?

a)

Planning

b)

DBMS Selection

c)

Implementation

d)

Optimization

70.

Which SQL keyword is used to specify conditional search?

a)

FIND

b)

LOCATE

c)

WHERE

d)

SEARCH_CONDITION

71.

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

a)

FETCH

b)

EXTRACT

c)

SELECT

d)

RETRIEVE

72.

The column of a table is referred to as the

a)

Row

b)

Cell

c)

Field

d)

Attribute

73.

Normalization is ...

a)

The process of creating random data in a database.

b)

A method to increase data redundancy for faster retrieval.

c)

A technique to decrease data integrity in a database.

d)

the process of arranging information stored in a database in a way, which redundancy and ambiguity

74.

SQL

a)

Structured Query Language

b)

Systematic Query Logic

c)

Sequential Query Link

d)

Synchronized Query Layer

75.

Table is synonymous with the term

a)

Relation

b)

Document

c)

File

d)

Collection

76.

Complete the code for the following table Subkects(subj_id(PK),name,credits):

___________________

SET credits=credits+1;

a)

UPDATE Subjects

b)

ALTER TABLE Subjects

c)

MODIFY TABLE Subjects

d)

INCREMENT Subjects

77.

Complete the code for the following table Groups(group_id(PK),name):

DELETE FROM Groups

_______ group_id=1;

a)

WHERE

b)

SET

c)

UPDATE

d)

INSERT

78.

Determine what functional dependency is in this table

a)

full

b)

partial

c)

there is no right answer here

d)

transitive