# Recent questions tagged relational-algebra

1 vote
1
Let $pk(R)$ denotes primary key of relation $R$. A many-to-one relationship that exists between two relation $R_1$ and $R_2$ can be expressed as follows: $pk(R_2)\rightarrow pk(R_1)$ $pk(R_1)\rightarrow pk(R_2)$ $pk(R_2)\rightarrow R_1 \cap R_2$ $pk(R_1)\rightarrow R_1 \cap R_2$
2
With respect to relational algebra, which of the following operations are included from mathematical set theory? Join Intersection Cartisian product Project a and d b and c c and d b and d
1 vote
3
In a relational algebra ∩ is not a basic operator, to make it basic only relational operator we should have are X, – X, U U, –
4
Consider two $n \times 1$ vectors $u$ and $v$ , stored as table $U(\text{ind,val})$ and $V(\text{ind,val})$ with the same schema A row $(i,u_i)$ of table $U$ specifies the $i^{th}$ element of vector $u$ has value $u_i$ (similarly for $v$, ... $u + v$ of the two vectors $u$ and $v$. Explain your solution.
5
... How this implication holds true?? Selection operation is commutative. But is two project operation can be merge in one project operation? Can project operation removes duplicates too??
6
Suppliers(sid, sname, address) Parts(pid, pname, color) Catalog(sid, pid, cost) Find the pids of the most expensive parts supplied by suppliers named Yosemite Sham
7
Given relation catalog(sid, pid, cost) Find pairs of sids such that the supplier with the first sid charges more for some part than the supplier with the second sid what is the relational algebra expression for this?
8
Here why does the 5th query select * from employees natural join works_on where PID = 'X' AND PID='Y'; is not working The queries are The output are
1 vote
9
Given two relations R1 and R2, where R1 contains N1 tuples, R2 contains N2 tuples, and N2>N1> 0, give the minimum and maximum possible sizes (in tuples) for the result relation produced by each of the following relational algebra expressions. In each case, state any assumptions about ... difference) $R1 X R2$ (cartesian product) $σa=5(R1)$ (selection) $\pi a(R1)$ (projection) $R1/R2$ (division)
10
Consider the following relations: $\text{STD_CHOICES } (\underline{\text{Student_ID}}, \underline{\text{Course_ID}}, \text{Semester})$ and $\text{COURSE_ASSIGN} (\underline{\text{Teacher_ID}}, \underline{\text{Course_ID}}, \underline{\text{Semester}})$. The former ... output the ID for all the students who have not been taught by the same teacher in more than one course across all semesters.
11
We know that Relational Algebra is $Procedural$ whereas TRC and DRC are $Non-Procedural$ querry languages. But what exactly differentiates them? Please explain using some example. In Relational Algebra we give what to retrieve and ... https://stackoverflow.com/questions/32837278/difference-between-relational-algebra-and-relational-calculus/32841232#32841232 Please explain using some example
12
Let R = (A, B) and S = (A, C), and let r (R) and s(S) be relations. Using the special constant null, write tuple-relational-calculus expressions equivalent to each of the following: a. r $ROJ$ s b. r $FOJ$ s c. r $LOJ$ s
13
Consider two relations R1 , R2 with N1 and N2 tuples where N2 > N1 > 0, what are the minimum and maximum rows for the RA expression R2/R1 ?
14
Consider the employee database shown here. Give expressions in tuple relational calculus and domain relational calculus for each of the following queries: a. Find the names of all employees who work for First Bank Corporation . b. Find the names and cities of residence of ... street, city ) works (person name, company name, salary) company (company name, city) manages (person name, manager name)
15
Consider the following relational schema for a library: member(memb_no, name, dob) books(isbn, title, authors, publisher) borrowed(memb_no, isbn, date) Write the following queries in relational algebra. a. Find the names of members who have borrowed any book published by ... into account that if a member does not borrow any books, then that member does not appear in the borrowed relation at all.
16
Consider the relational database shown here. Give a relational-algebra expression for each of the following queries: a. Find the company with the most employees. b. Find the company with the smallest payroll. c. Find those companies whose employees earn a higher salary, on ... street, city ) works (person name, company name, salary) company (company name, city) manages (person name, manager name)
17
Using the university example, write relational-algebra queries to find the course sections taught by more than one instructor in the following ways: a. Using an aggregate function. b. Without using any aggregate functions.
18
Consider the relational database shown here, where the primary keys are underlined. Give an expression in the relational algebra to express each of the following queries: a. Find the names of all employees who work for First Bank Corporation . b. Find the names and ... , street, city ) works (person name, company name, salary) company (company name, city) manages (person name, manager name)
19
Write the following queries in relational algebra, using the university schema. a. Find the names of all students who have taken at least one Comp. Sci. course. b. Find the IDs and names of all students who have not taken any course offering before Spring ... at least one instructor. d. Find the lowest, across all departments, of the per-department maximum salary computed by the preceding query.
20
Describe how to translate join expressions in SQL to relational algebra.
21
Consider the relational database given below where the primary keys are underlined. Give an expression in tuple relational calculus for each of the following queries: a. Find all employees who work directly for Jones. b. Find all cities of residence of all employees who ... street, city ) works (person name, company name, salary) company (company name, city) manages (person name, manager name)
22
Let R = (A, B) and S = (A,C), and let r (R) and s(S) be relations.Write expressions in relational algebra for each of the following queries: a. {< a > | ∃ b (< a, b > ∈ r ∧ b = 7)} b. {< a, b, c > | < a, b > ∈ r ∧ < a, c > ∈ s} c. {< a > | ∃ c (< a, c > ∈ s ∧ ∃ b1, b2 (< a, b1 > ∈ r ∧ < c, b2 > ∈ r ∧ b1 > b2))}
23
Let the following relation schemas be given: R = (A, B,C) S = (D, E, F) Let relations r(R) and s(S) be given. Give an expression in the tuple relational calculus that is equivalent to each of the following: a. $\prod _A(r)$ b. $\sigma _{B =17} (r )$ c. r × s d. $\prod _{A,F} (\sigma _{C = D}(r × s))$
24
(Division operation): The division operator of relational algebra, , is defined as follows. Let r (R) and s(S) be relations, and let S ⊆ R; that is, every attribute of schema S is also in schema R. Then r s is a relation on ... relational algebra, without using division. (By doing so, you would have shown how to define the division operation using the other relational algebra operations.)
25
The natural outer-join operations extend the natural-join operation so that tuples from the participating relations are not lost in the result of the join. Describe how the theta-join operation can be extended so that tuples from the left, right, or both relations are not lost from the result of a theta join.
26
Consider the relational database given below, where the primary keys are underlined. Give an expression in the relational algebra to express each of the following queries: a. Find the names of all employees who live in the same city and on the same street as do their ... name, street, city ) works (person name, company name, salary) company (company name, city) manages (person name, manager name)
27
Write the following queries in relational algebra, using the university schema. a. Find the titles of courses in the Comp. Sci. department that have 3 credits. b. Find the IDs of all students who were taught by an instructor named Einstein; make sure there are ... Find the maximum enrollment, across all sections, in Autumn 2009. g. Find the sections that had the maximum enrollment in Autumn 2009.