Font size
WorksheetsCPO Lesson 1.4 IE
Total questions: 24
Worksheet time: 15mins
A (natural) join is equivalent to a product and a select.
True
False
Let be a relation containing n tuples, and S be a relation containing m tuples.
How many tuples will the cross product of R and S (RxS) contain?
n+m
n\m
n*m
n^m
m^n
To be union compatible, two relations must:
Have the same attribute names
Have the same domains for their attributes
Like the same kind of food
Have the same number of attributes
A DB contains the following relations:
Employee(e_id, e_first_name, e_last_name, e_salary, e_birth_date)
Contact(c_id, e_id, c_first_name, c_last_name, c_birth_date) (e_id references the e_id of the employee they work with)
Match desired information (i.e. target content for the result relation) and the relational operations to use.
All information about contacts and the employee they work with
Product
Natural Join
Projection
Selection
A DB contains the following relations:
Employee(e_id, e_first_name, e_last_name, e_salary, e_birth_date)
Contact(c_id, e_id, c_first_name, c_last_name, c_birth_date) (e_id references the e_id of the employee they work with)
Match desired information (i.e. target content for the result relation) and the relational operations to use.
First names of all employees
Product
Natural Join
Projection
Selection
A DB contains the following relations:
Employee(e_id, e_first_name, e_last_name, e_salary, e_birth_date)
Contact(c_id, e_id, c_first_name, c_last_name, c_birth_date) (e_id references the e_id of the employee they work with)
Match desired information (i.e. target content for the result relation) and the relational operations to use.
All employee-contact combinations
Product
Natural Join
Projection
Selection
Based on the figure above, identify the number of tuples that will be returned by the following relational algebra query : σ Type = 'Saving' (Account)
2
3
6
0
Choose the CORRECT symbol of SELECT in the Relational Algebra
x
π
∩
σ
Identify the CORRECT output for table (Student Difference Lecturer) or (Student - Lecturer) in table above
Write the CORRECT relational algebra expression based on the figure above
π managerID, managerName ( σ workExperience = 5) (MANAGER)
σ managerID, managerName ( π workExperience = 5) (MANAGER)
π managerID, managerName ( σ workExperience > 5) (MANAGER)
σ managerID, managerName ( π workExperience > 5) (MANAGER)
Write the relational algebra to list the student's number and student's name whose age is 20 years old or state in Terengganu.
π StudentID, Name ( σ Age=20 AND State = "Terengganu" (STUDENT)
π StudentID, Name ( σ Age=20 OR State = "Terengganu" (STUDENT)
σ StudentID, Name ( π Age=20 AND State = "Terengganu" (STUDENT)
σ StudentID, Name ( π Age=20 OR State = "Terengganu" (STUDENT)
Based on the table, identify the output produced when σ Salary > 3000 ˅ City = ‘Batu Pahat’ (WORKER).
Which of the following is used to denote the selection operation in relational algebra?
Pi (Greek)
Sigma (Greek)
Lambda (Greek)
Omega (Greek)
The ___________ operation, denoted by −, allows us to find tuples that are in one relation but are not in another.
Union
Set-difference
Difference
Intersection
The minimal set of super key is called
Primary key
Secondary key
Candidate key
Foreign key
In the relational model, relationships between relations or tables are created by using:
composite keys
determinants
candidate keys
foreign keys
Which would show all fields from the Pupils table?
SELECT * FROM Pupils
SELECT Name, Form FROM Pupils
SELECT * FROM *
SELECT * FROM Forms
Which would find pupils with "er" anywhere in their name?
SELECT * FROM Pupils Where Name = "%er"
SELECT * FROM Pupils Where Name = "$er$"
SELECT * FROM Pupils Where Name = "%er%"
SELECT * FROM Pupils Where Name = "er%"
Return all dramas made after 2004.
SELECT * FROM movies WHERE genre = 'drama';
SELECT * FROM movies WHERE genre = 'drama' AND year > 2004;
SELECT * FROM movies WHERE genre = "drama' AND year < 2004;
SELECT * FROM movies WHERE imdb_rating = 7 AND LIMIT = 7
Write a code for the following: Return all romances that have an imdb_rating over 6.
SELECT * FROM movies WHERE genre = ‘romance’ AND imdb_rating > 6;
SELECT * FROM movies WHERE genre = ‘romance’ AND imdb_rating < 6;
SELECT imdb_rating, name FROM movie WHERE genre = ‘romance’ AND imdb_rating > 6;
SELECT * FROM movies WHERE genre = romance and imdb_rating < 6;
