Worksheetsоч много
Total questions: 134
Worksheet time: 1hrs 7mins
The database has a Courses table with the following columns: course id, course name, number
of credits. Select which of the following constraints can be implemented for this table?
The number of credits can be from 1 to 6
books for each course should be available in the university library
course grades must range from 0 to 100%
courses must last 3 months
The database has a Schedule table with the following columns: schedule_id, course_id,
teacher_id, group_id, time, room, day_of_week. Select which of the following constraints can be
implemented for this table?
lesson time can be from 08:00 to 22:00
lessons should be interesting
students must attend all lessons
after each lesson, students must complete homework
The Books table has the following columns: ISBN - unique code of the book edition, title of
the book, author of the book, number of pages. Which of these columns can be the Primary key?
ISBN
title
author
pages
A primary key for an entity is
unique attribute
any attribute
first row
type of relationship
Choose the right order of the database design phases
Subject area analysis, Conceptual Design, Logical Design, Physical Design
Subject area analysis, Logical Design, Conceptual Design, Physical Design
>Conceptual Design, Logical Design, Physical Design, Queries Implementation
Conceptual Design, Logical Design, Physical Design, Queries Implementation
Conceptual Design, Logical Design, Physical Design, DBMS Selection
Database is a collection of…
data
programs
modules
none of the given
DBMS stands for …
Database Management System
None of the given
Database Basic Management System
Database Administrator System
A teacher teaches one or more groups, each of which is taught by one or more teachers. The
TEACHERS table has teacher_id, teacher_name columns. The GROUPS table has group_id, name
columns. Identify a table with a Foreign Key(s) for the relationship between TEACHERS and GROUPS
tables.
associative table between TEACHERS and GROUPS tables
TEACHERS
GROUPS
in the TEACHERS table or in the GROUPS table - both options are correct
‹question> A teacher may be assigned with exactly one position. A position must be assigned to one or many teachers. The TEACHERS table has teacher id, teacher name, birthdate columns. The
POSITIONS table has position id, position name columns. Identify a type of the relationship between TEACHERS and POSITIONS entities
one (positions)-to-many (teachers)
one (teachers)-to-many (positions)
one (teachers)-to-one (positions)
many (teachers)-to-many (positions)
A teacher may be assigned with exactly one position. A position must be assigned to one or
more teachers. The TEACHERS table has teacher id, teacher name, birthdate columns. The POSITIONS
table has position_id, position_name columns. Identify a table with a Foreign Key(s) for the relationship
between TEACHERS and POSITIONS tables
TEACHERS and POSITIONS tables.
TEACHERS
POSITIONS
associative table between TEACHERS and POSITIONS tables
in the TEACHERS table or in the POSITIONS table - both options are correct
A teacher teaches one or more groups, each of which is taught by one or more teachers. The
TEACHERS table has teacher_id, teacher_name columns. The GROUPS table has group_id, name
columns. Identify a type of the relationship between TEACHERS and GROUPS tables
many (teachers)-to-many (groups)
one (teachers)-to-many (groups)
one (groups)-to-many (teachers)
one (teachers)-to-one (groups)
A teacher teaches one or more subjects, each of which is taught by one or more teachers.
Definitions of the entities are: Teachers (teacher_id, name, birthdate), Subjects (subject_id, name,
description). Identify a type of the relationship between TEACHERS and SUBJECTS tables.
many (teachers)-to-many (subjects)
one (teachers)-to-one (subjects)
one (teachers)-to-many (subjects)
one (subjects)-to-many (teachers)
A teacher teaches one or more subjects, each of which is taught by one or more teachers.
Definitions of entities are: Teachers (teacher_id, name, birthdate), Subjects (subject_id, name,
description). Identify a table with a Foreign Key(s) for the relationship between TEACHERS and
SUBJECTS tables.
associative table between Teachers and Subjects tables
Teachers
Subjects
in the Teachers table or in the Subjects table - both options are correct
Entities Groups and Subjects have a many-to-many relationship type. 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
schedule_id (PK), group_code (FK), subject_code (FK)
schedule_id (PK), group_name (FK), subject_name (FK)
schedule_id (PK), group_code (FK)
schedule_id (PK), subject_name (FK)
Determine the relationship type between Courses and Teachers entities by the description:
"One course can be taught by many teachers, and one teacher can teach many courses"
many-to-many
one-to-one
one-to-many
none of the given
Determine the relationship type between Students and Groups entities by the description:
"One student can be enrolled only in one group, and one group contains many students".
one-to-many
one-to-one
many-to-many
none of the given
Determine the relationship type between Students and Readers entities by the description:
"One student has only one reader's card, and one reader's card can belong to only one student".
one-to-one
one-to-many
many-to-many
none of the given
In an ER-diagram an entity is represent by a
Rectangle
Ellipse
Rhombus
Circle
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.
many-to-many
one-to-many
one-to-one
What type of relationship is described by this rule? For one instance of entity A, there exists
one or many instances of entity B; but for one instance of entity B, there exists one instance of entity A…
one-to-many
many-to-many
one-to-one
What type of relationship is described by this rule? One instance of entity A can be associated
with one instance of entity B. and one instance of entity B can be associated with one instance of entity A
one-to-one
one-to-many
many-to-many
A relation in which the intersection of each row and column contains one and only one value
is said to be in
1NF
0NF
2NF
3NF
An entity with atomic attributes that has no partial functional dependencies is in … form
2NF
0NF
3NF
1NF
Can a Foreign key be duplicate?
Yes
No
In an ER diagram an entity is represent by a …
Rectangle
Rhombus
Table is synonymous with the term …
Relation
Field
Column
Record
The another name for a row is …
Record
Relationship
Entity
Attribute
The column of a table is a synonym for …
Attribute
Relationship
Tuple
Entity
… operator is used to convert from one data type into another.
::
%
Select the functional dependency according to the table description: Teachers (teacher id
(PK), last_name, department_id)
full
partial
transitive
none of the given
To check if a value in a column is null, the … operator is used.
IS NULL
BETWEEN
Table names can be aliased to another using the … operator.
CAST
Select the functional dependency according to the table description: Students (study id (PK).
last_name, group_id)
full
partial
transitive
none of the given
Select the functional dependency according to the table description: Groups (group_id (PK),
group_name)
full
partial
transitive
none of the given
Select the functional dependency according to the table description: Courses (course id (PK),
course_name, credits)
full
partial
transitive
none of the given
Select the Normal Form by the table description: Teachers (teacher id (PK), last_name,
department_id)
3NF
1NF
2NF
0NF
Select the Normal Form by the table description: Courses (course id (PK), major id (PK), course name, credits, majorname)
3 NF
2 NF
1 NF
0 NF
Select the Normal Form by the table description: Groups (group_id (PK), group_name,
advisor id, advisor last name)
2 NF1
0 NF1
1 NF
3 NF
Select the Normal Form by the table description: Students (stud_id (PK), last_name,
subject ids)
0 NF
1 NF
2 NF
3 NF
Answer if the next table has a partial dependency: Courses (course_id (PK), major_id (PK),
course_name, credits, major name)
yes
no
Answer if the next table has a partial dependency: Schedule (teacher id (PK), groupid
(PK).
course id (PK), time, room)
no
yes
Answer if the next table has a partial dependeney: Teachers (teacher_id (PK), last_name,
department id)
no
yes
Answer if the next table has a partial dependency: Groups (group_id (PK), group_name,
adviser_id, adviser_last name)
no
yes
A functional dependency is a logical relationship between or among …
attributes
rows
tables
databases
Select the Normal Form by the table description: Teachers (teacher id (PK), Name, email,
department id, department name)
2NF
1NF
0NF
3NF
Select the Normal Form by the table description: Students (study id (PK), group_id (PK).
Name, email, group_name)
2NF
0NF
3NF
1NF
Select the Normal Form by the table description: Students (stud id (PK), group id, Iname,
email, group_name)
2NF
0NF
3NF
1NF
Select the Normal Form by the table description: Schedule (teacher_id (PK), subject_id (PK).
teacher Name, time, subject name)
1NF
2NF
3NF
0NF
Select the Normal Form by the table description: Teachers (teacher_id (PK), department_id
((PK), teacher Jname, email, department name)
2NF
0NF
3NF
1NF
Select the Normal Form by the table description: Schedule (teacher_id (PK), subject_id,
teacher Name, time, subject_name)
2NF
0NF
3NF
1NF
Select the Normal Form by the table description: Schedule (sch id (PK), teacher id,
subject_id, time)
2NF
1NF
3NF
0NF
Select the Normal Form by the table description: Departments (department id (PK), name,
teacher Just names)
2NF
1NF
0NF
3NF
Third normal form is based on the concept of…
Transitive dependency
Foreign dependency
Partial dependency
Primary dependency
Which normal form is considered "good" for relational database design?
3NF
1NF
0NF
2NF
Complete the code to create the table Teachers (teach id (PK), last_name, depart_id (FK)):
CREATE TABLE Teachers(teach_id int PRIMARY KEY, last name varchar(20), depart_id int,
(depart_id) REFERENCES Departments(depart_id));
FOREIGN KEY
KEY
PRIMARY KEY
FOREIGN
Complete the code to create the table Departments (deptid (PK), dep_name): CREATE TABLE
Departments(depid int
dep_name varchar(15));
PRIMARY KEY
PRIMARY
KEY
FOREIGN KEY
Complete the code to create the table Students (stud_id (PK), last_name): CREATE TABLE
Students(stud_id int, last name varchar(20),
(stud_id));
PRIMARY KEY
FOREIGN KEY
KEY
PRIMARY
Complete the code to create the table Groups (group id (PK), group name):
Groups( group_id int PRIMARY KEY, group_name varchar(20));
CREATE TABLE
CREATE
TABLE
ALTER TABLE
The SQL command which allows to change the structure of a table is
ALTER TABLE
CREATE TABLE
DROP TABLE
ALTER DATABASE
Which of the following SQL statements can be used to create a table?
CREATE TABLE
ALTER TABLE
ADD TABLE
CREATE DATABASE
Complete the code to create the table Courses (course id (PK), name): CREATE TABLE
Courses( course id int
name varchar(10));
PRIMARY KEY
PRIMARY
KEY
FOREIGN KEY
Which of the following language is used to specify database structure?
Data Definition Language
Data Development Language
Data Manipulation Language
Data Management Language
INSERT INTO
UPDATE
CREATE TABLE
DELETE FROM
Complete the code: DELETE FROM Students___stud id=2:
WHERE
WHEN
WITH
AND
Complete the code for the following table Departments (depart_id (PK), name): UPDATE Departments___name='IT WHERE depart_id=1;
SET
WHERE
FOR
GET
Complete the code for the following table Faculties (facult_id (PK), name):___Faculties SET name='Information Technology 'WHERE name='IT';
UPDATE
INSERT
CHANGE
ALTER TABLE
Complete the code for the following table Faculties (faculty id (PK), name): DELETE FROM
Faculties___facult_jd=1;
WHERE
SET
WITH
WHEN
Complete the code for the following table Groups (group_id (PK), name):___SET
name='Database Design' WHERE group_id==1;
UPDATE Groups
ALTER TABLE Groups
UPDATE
Groups
Complete the code for the following table Groups (group_id (PK), name): DELETE FROM
Groups___group_id 1;
WHERE
WHEN
WITH
DROP
Complete the code for the following table Students (stud_id (PK), lastname): DELETE FROM
Students WHERE…=1
stud_id
student_number
id
PK
Complete the code for the following table Subjects (subj id (PK), name, credits): UPDATE
Subjects SET credits=5___credits=3;
WHERE
WHEN
IF
WITH
Complete the code for the following table Subjects (subj id (PK), name, credits):___SETcredits=credits+1;
UPDATE Subjects
UPDATE
Subjects
ALTER TABLE Subjects
Complete the code for the following table: Faculties (facult_id (PK), name): INSERT INTO___(1, IT):
Faculties VALUES
Faculties
VALUES
TABLE Faculties
Complete the code for the following table Groups (group_id (PK), group_name):___VALUES (1, "SIS-01");
INSERT INTO Groups
INSERT Groups
ADD ROW Groups
UPDATE Groups
Complete the code for the following table Groups (group_id (PK), group_name):___INTO Groups VALUES (I, 'SIS-01");
INSERT
UPDATE
DELETE
ADD ROW
Complete the code for the following table Schedule (sch_id (PK), group_id, subj_id, teach_id,
time, room): INSERT INTO Schedule (sch_id group_id, subj_id,___VALUES (1, 1, 1, '08:00');
time
room
date
teach_id
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___Faculties (faculty_id));
REFERENCES
FOREIGN KEY
TO
PRIMARY KEY
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));
FOREIGN KEY
REFERENCES
FOREIGN
PRIMARY KEY
Complete the code to create the table Departments (deptid (PK), dep_name), where dep_name
attribute has the not null constraint: CREATE TABLE Departments( deptid int PRIMARY KEY, dept name
varchar(10)___);
NOT NULL
UNIQUE
IS NULL
PRIMARY KEY
Complete the code to create the table Departments (deptid (PK), dep name), where dept name
attribute has the unique constraint: CREATE TABLE Departments(dep id int PRIMARY KEY, dep name
varchar(10)___);
UNIQUE
NOT NULL
IS UNIQUE
PRIMARY KEY
Complete the code to create the table Subjects (subj_id (PK), name):___(subjid
int PRIMARY KEY, name yarchar(10));
CREATE TABLE
ALTER TABLE
CREATE DATABASE
TABLE
Complete the code to drop the table Coumes___Cersa
DROP TABLE
DROP COLUMN
DELETE TARLE
REMOVE TABLE
The SQL DROP TABLE clause is wied to___
delete a table from the database
delete a column from the database
delete a relationship from the database
delete a row from the table
The statement in SQL which allows to change the structure of a table is
…
ALTER TABLE
UPDATE
CREATE TABLE
CHANGE TABLE
<question> What does SQL stand for?
Structured Query Language
Strict Query Language
Standard Query Language
Strong Query Language
Which of the following language is used to
specify database structure?
Data Definition Language
Data Development Language
Data Manipulation Language
Data Management Language
With SQL, how do you select all the records from a table named "Persons" where the value of
the column "FirstName" is "Peter"?
SELECT * FROM Persons WHERE FirstName<>'Peter'
SELECT [all] FROM Persons WHERE FirstName='Peter'
SELECT * FROM Persons WHERE FirstName='Peter
SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter
With SQL, how do you select all the records from a table named "Persons" where the
"FirstName" is "Peter" and the "LastName" is "Jackson"?
SELECT FirstName='Peter', LastName='Jackson' FROM Persons;
SELECT * FROM Persons WHERE
FirstName<>'Peter' AND LastName<>'Jackson';
SELECT * FROM Persons WHERE FirstName 'Peter' AND LastName='Jackson';
SELECT * FROM Persons WHERE LastName='Jackson';
Which of the following is the correct order of keywords for SQL SELECT statements?
SELECT, FROM, WHERE
FROM, WHERE, SELECT
WHERE, FROM,SELECT
SELECT,WHERE,FROM
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?
AND
BOTH
TRUE
WHERE
Union R1 U R2 is …
is the relation containing all tuples of R1 that do not appear in R2
is the relation containing all tuples that appear only in both R1 and R2
is the relation containing all tuples that appear in R1, R2, or both
None of the given
EXCEPT in SQL is analogous to
Intersection operator of relational algebra
Cartesian product operator of relational algebra
Difference operator of relational algebra
Join operator of relational algebra
Complete the code:
Students VALUES (1,'FirstNamel','LastNamel','2000-01-01',I);
INSERT INTO
UPDATE
CREATE TABLE
DELETE FROM
Complete the code: DELETE FROM Students___stud_id=2;
WHERE
WHEN
WITH
AND
Complete the code for the following table Departments (depart_id (PK), name): UPDATE
Departments___name='IT' WHERE depart_id=1;
SET
WHERE
Set difference R1 - R2 is …
is the relation containing all tuples that appear in R1, R2, or both
is the relation containing all tuples that appear only in both R1 and R2
is the relation containing all tuples of R1 that do not appear in R2
None of the given
Intersection R1 N R2 is …
is the relation containing all tuples that appear in R1, R2, or both
is the relation containing all tuples of R1 that do not appear in R2
is the relation containing all tuples that appear only in both R1 and R2
None of the given
The FULL OUTER JOIN keyword combines the results of both … and … joins.
LEFT, INNER
INNER, RIGHT
LEFT, RIGHT
INNER CROSS
LIKE 'SIS-_' can give 'SIZE-2301' as the answer
True
False
How to select all data from student table starting the name from letter 'r"?
SELECT * FROM student WHERE name LIKE 'r%';
SELECT * FROM student WHERE name LIKE "%r%';
SELECT * FROM student WHERE name LIKE "%r';
SELECT * FROM student WHERE name LIKE '_r%';
Aggregate function … selects the minimum value.
min()
minimum()
least()
small()
The … clause sets the selection condition for aggregate functions or group rows created by the
GROUP BY clause.
HAVING
GROUP BY
WHERE
ORDER BY
Aggregate function … selects the number of occurrences (the number of tuples that satisfy a
selection condition).
count()
number()
sum()
The … operator (which must follow a comparison operator) compares the value of attribute to
every value returned by the subquery. The result is true if all rows yield true. The result is false if any
false result is found.
ALL
ANY
EXISTS
EVERY
Write the possible operator when a result of a subquery is multiple values (multiple fields).
IN
«=»
«<>»
none of the given
Select the condition when the «=» operator can be used with a subquery.
The result of the subquery is one value (one field)
the subquery contains the GROUP BY keyword
The result of the subquery is multiple values (multiple fields)
none of the given
Find all the tuples having temperature greater than 'Paris'.
SELECT FROM weather WHERE temperature > (SELECT FROM weather WHERE city =
'Paris')
SELECT * FROM weather WHERE temperature > (SELECT city FROM weather WHERE city
= 'Paris')
SELECT * FROM weather WHERE temperature > 'Paris' temperature
<variant>SELECT * FROM weather WHERE temperature > (SELECT temperature FROM weather
WHERE city = 'Paris')
What keyword is used to create a CTE?
WITH
BY
USING
CTE
Which of the following multi-row operators can be used with a subquery?
ALL only
ANY only
IN only
All of the given
Which of the following is used to denote the projection operation in relational algebra?
Pi (Greek)
Sigma (Greek)
Lambda (Greek)
Omega (Greek)
Which of the following is not a relational algebra operation?
Selection
Projection
Manipulate
Union
What statement is used to create a view?
CREATE VIEW
ADD VIEW
NEW VIEW
CREATE TABLE
EXCEPT in SQL is analogous to
Intersection operator of relational algebra
Cartesian product operator of relational algebra
Difference operator of relational algebra
Join operator of relational algebra
What operator tests column for the absence of data?
IS NULL operator
EXISTS operator
Union R1 R2 is …
is the relation containing all tuples of R1 that do not appear in R2
is the relation containing all tuples that appear only in both R1 and
R2
is the relation containing all tuples that appear in R1, R2, or both
None of the given
Set difference R1 - R2
is
…
is the relation containing all tuples that appear in R1, R2, or both
is the relation containing all tuples that appear only in both R1 and R2
is the relation containing all tuples of R1 that do not appear in R2
None of the given
With SQL, how can you return the numbers
SELECT COUNT(*) FROM Persons;
SELECT COLUMNS(*) FROM Persons;
Which SQL statement will selects all rows from a table called "Customers" and orders the
result by "customer name"?
SELECT * FROM Customers ORDER BY customer_name;
SELECT * FROM Customers ORDER ON customer_name;
Which of the following are the five built-in aggregate functions provided by SQL?
COUNT, SUM, AVG, MAX, MIN
TOTAL, AVERAGE, HIGHEST, LOWEST, and RANGESUM, AVG, MIN, MAX, MULTI
A subquery in an SQL SELECT statement is enclosed in
braces - {…}
CAPITAL LETTERS
parenthesis - (…)
brackets - […]
SQL allows testing the emptiness of a subquery's result using the … keyword.
EXISTS
ANY
ALL
IS NULL
WmI SQL, how df
do yo
the column "FirstName" starts wit
rts with an "a"
SELECT * FROM Persons WHERE FirstName LIKE 'a%';
SELECT FROM Persons WHERE FirsiName LIKE %a':
LIKE operator uses
and
percent sign (%); underscore(_)
underscore(); question mark (?)
Choose the correct order of keywords in a SELECT statement
GROUP BY, HAVING, ORDER BY
HAVING, ORDER BY, GROUP BY
The … operator compares the value of attribute to each value returned by the subquery. This
keyword (which must follow a comparison operator) returns TRUE if the comparison is TRUE for any of
the values in the column that the subquery returns.
ANY
ALL
EXISTS
AT LEAST
Choose the correct option to convert phone number attribute from varchar to integer data type
phone number::varchar(3)
phone number:into
phone_number::yarchar(*)
phone_number to int
What is a result of "CAST (phone_number AS INTEGER)"?
phone_number attribute will be converted into integer data type
phone_number attribute will be converted from integer into yarchar data type
phone number attribute will be converted to lower case
phone number
attribute
will
be converted to upper case
LIKE 'SIS-%' can give 'SIZE-2301' as the answer
True
False
… operator is used to convert from one data type into another.
CAST
IS NULL
DISTINCT
LIKE
SQL provides the … operator for pattern matching.
LIKE
IS NULL
CAST
DISTINCT
Which SQL keyword is used to return only different (unique) values?
DISTINCT
UNIQUE
DIFFERENT
*
To check if a value in a column is not null, the … operator is used.
IS NOT NULL
DISTINCT
BETWEEN
LIKE
Column names can be aliased to another using the … operator.
AS
LIKE
CAST
What is the meaning of LIFE %4040%
Answer has two O's in it, at any position
Answer has more than two O's
