Question 71
HardWhy does projection in relational algebra remove duplicate tuples, while SQL's SELECT does not?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
DBMS
Why does projection in relational algebra remove duplicate tuples, while SQL's SELECT does not?
SQL removes duplicates too
Relations are sets, while SQL tables are multisets (bags)
Projection is slower
SQL is older
Sign up free to see the answer and a step-by-step explanation.
A foreign key column order_id in LineItem references Orders(id) with ON DELETE CASCADE. An order with 5 line items is deleted. How many rows are deleted in all?
5
0
1
6
Sign up free to see the answer and a step-by-step explanation.
A foreign key is declared ON DELETE RESTRICT. A parent row with existing child rows is deleted. What happens?
The children are deleted
The children are moved
The children's key becomes NULL
The delete is refused
Sign up free to see the answer and a step-by-step explanation.
In tuple relational calculus, what does an unsafe expression such as {t | ¬(t ∈ R)} mean?
It returns R
It describes an infinite set, so it can't be evaluated
It returns nothing
It returns R's complement within R
Sign up free to see the answer and a step-by-step explanation.
What is the degree and cardinality of a relation with 4 columns and 1,000 rows?
Degree 4, cardinality 1,000
Cardinality 4,000
Degree 1,000, cardinality 4
Degree 4,000
Sign up free to see the answer and a step-by-step explanation.
Which expression is equivalent to R ⋈_{R.a = S.a} S?
π_a(R) ∪ π_a(S)
R ÷ S
R − S
σ_{R.a = S.a}(R × S)
Sign up free to see the answer and a step-by-step explanation.
Two tables are union-compatible when:
They share a primary key
They have the same number of rows
They have the same name
They have the same number of columns with compatible domains, in the same order
Sign up free to see the answer and a step-by-step explanation.
A relation has a composite primary key (order_id, product_id). Which insert violates entity integrity?
(101, 8)
(102, 7)
(NULL, 7)
(101, 7)
Sign up free to see the answer and a step-by-step explanation.
Which is a valid reason to choose a surrogate primary key over a natural one such as email?
Natural values can change, and foreign keys referencing them would all need updating
Surrogate keys remove the need for indexes
Natural keys can't be unique
Surrogate keys are always shorter strings
Sign up free to see the answer and a step-by-step explanation.
What is a candidate key that is not chosen as the primary key called?
An alternate key
A super key only
A foreign key
A composite key
Sign up free to see the answer and a step-by-step explanation.