Recent questions tagged relational-algebra

0 0 votes
1 1 answer
94
94 views
Consider the relation $\mathrm{Sailors}(\mathrm{sid},\mathrm{sname},\mathrm{rating},\mathrm{age})$ and the following TRC expression: $$\{S\mid \neg(S\in \mathrm{Sailors})...
0 0 votes
1 1 answer
158
158 views
Consider $\mathrm{Flights}(\mathrm{num},\mathrm{src},\mathrm{dst})$, where each tuple represents a directed flight from $\mathrm{src}$ to $\mathrm{dst}$.Let $\mathrm{F}_1...
0 0 votes
1 1 answer
120
120 views
Consider $\mathrm{Employee}(\mathrm{eid},\mathrm{name},\mathrm{salary})$, $\mathrm{Project}(\mathrm{pid},\mathrm{title},\mathrm{budget})$, and $\mathrm{WorksOn}(\mathrm{e...
2 2 votes
1 1 answer
108
108 views
Consider $\mathrm{Locations}(\mathrm{locationid},\mathrm{name},\mathrm{state},\mathrm{altitude})$$\mathrm{TreeCoverage}(\mathrm{locationid},\mathrm{treetype},\mathrm{year...
2 2 votes
1 1 answer
84
84 views
Consider $\mathrm{X}(\mathrm{A},\mathrm{B})$ and $\mathrm{Y}(\mathrm{B},\mathrm{C})$.Which expression is equivalent to $\sigma_{\mathrm{A}<15\land\mathrm{C}\geq10}(\mathr...
1 1 vote
1 1 answer
118
118 views
Consider two relations $\mathrm{r}$ and $\mathrm{s}$ with schemas $\mathrm{R(A,B,C)}$ and $\mathrm{S(A,B,D)}$, respectively.The query is $\pi_{\mathrm{A}}(\sigma_{\mathrm...
0 0 votes
1 1 answer
82
82 views
Consider $\mathrm{A}(\mathrm{c1},\mathrm{c2},\mathrm{c3})$ and $\mathrm{B}(\mathrm{c1},\mathrm{c2},\mathrm{c3})$, where $\mathrm{c1}$ is the primary key of each relation....
1 1 vote
1 1 answer
75
75 views
Let $\mathrm{R}(\mathrm{A},\mathrm{B})$ and $\mathrm{S}(\mathrm{A},\mathrm{B})$ be relations under set semantics.Which expression is not always equivalent to the others?$...
0 0 votes
1 1 answer
77
77 views
Consider :$$\begin{aligned}\begin{gathered}\mathrm{Customer} \\[-2pt]\begin{array}{|c|c|}\hline\mathrm{cid} & \mathrm{name} \\\hline1 & \mathrm{Joe} \\2 & \mathrm{Betty} ...
1 1 vote
1 1 answer
72
72 views
Consider $\mathrm{Homes}(\mathrm{home\_id},\mathrm{city},\ldots)$ and $\mathrm{Transactions}(\mathrm{home\_id},\mathrm{sale\_price},\ldots)$.We want every home in Berkele...
2 2 votes
3 3 answers
113
113 views
Consider $ \mathrm{MEMBER}(\mathrm{personName}, \mathrm{groupName}) $ and $ \mathrm{PICTURE}(\mathrm{groupName}, \mathrm{picture}) $.Every person belongs to at least one ...
1 1 vote
1 1 answer
176
176 views
Consider$\mathrm{Player}(\mathrm{playerID}, \mathrm{name}, \mathrm{position}, \mathrm{height}, \mathrm{weight}, \mathrm{team})$$\mathrm{Game}(\mathrm{gameID}, \mathrm{hom...
0 0 votes
2 2 answers
128
128 views
Consider$\mathrm{Student}(\mathrm{sid}, \mathrm{sname}, \mathrm{major})$$\mathrm{EnrolledIn}(\mathrm{sid}, \mathrm{cid}, \mathrm{grade})$$\mathrm{Course}(\mathrm{cid}, \m...
0 0 votes
1 1 answer
90
90 views
Let $\mathrm{R}(\mathrm{X},\mathrm{Y})$ and $\mathrm{S}(\mathrm{Y})$.Which expression is equivalent to $\mathrm{R} \div \mathrm{S}$ without using the division operator?$\...
0 0 votes
1 1 answer
82
82 views
Consider$\mathrm{Suppliers}(\mathrm{SID}, \mathrm{sname}, \mathrm{address})$$\mathrm{Parts}(\mathrm{PID}, \mathrm{pname}, \mathrm{color})$$\mathrm{Catalog}(\mathrm{SID}, ...
0 0 votes
1 1 answer
80
80 views
Consider$\mathrm{Student}(\mathrm{snum},\mathrm{sname},\mathrm{major},\mathrm{level},\mathrm{age})$$\mathrm{Class}(\mathrm{name},\mathrm{meets\_at},\mathrm{room},\mathrm{...
1 1 vote
1 1 answer
133
133 views
Assume the expressions below are schema-valid and relations use set semantics.Which of the following are always true?$(\mathrm{R}\bowtie\mathrm{S})\bowtie\mathrm{T}=(\mat...
1 1 vote
1 1 answer
119
119 views
Consider the relations:$\mathrm{Authors(au\_id,au\_lname,au\_fname,phone,address,city,state,zip)}$$\mathrm{TitleAuthors(au\_id,title\_id,au\_ord,royaltyshare)}$$\mathrm{T...
1 1 vote
1 1 answer
81
81 views
Consider the relations:$\mathrm{Locations(locationid,name,state,altitude)}$ and $\mathrm{FallColors(week,year,locationid,color,peakpercent)}$.We want locations in New Y...
2 2 votes
1 1 answer
81
81 views
Consider the relations:$\mathrm{Posts(pid,folder,summary)}$ and $\mathrm{Postings(post,position,user,ptext)}$.Let $\mathrm{R_1}$ and $\mathrm{R_2}$ be two renamed copies ...
2 2 votes
1 1 answer
93
93 views
Consider the relation:$\mathrm{Marks(studentID,~courseID,~courseType,~score)}$Let, $\mathrm{M_1=\rho_{M_1}(Marks)}$ and $\mathrm{M_2=\rho_{M_2}(Marks)}$.Which expression ...
2 2 votes
2 2 answers
197
197 views
Consider the relations:$\mathrm{Users(username, name, email, password, address)}$and$\mathrm{FriendsWith(username, username2, sincewhen)}$.A friendship tuple indicates th...
2 2 votes
1 1 answer
110
110 views
Consider the relations:$\mathrm{STUDENT(name,regno,gpa,level,dept)}$$\mathrm{COURSE(cno,cname,dept)}$$\mathrm{TAKE(regno,cno)}$Using only the basic relational algebra ope...
2 2 votes
1 1 answer
110
110 views
Consider $R(a,b)$ and $S(c,d)$.Which relational algebra expression is equivalent to:SELECT a, d FROM R, S WHERE R.a 10 AND R.b = S.c;Use only the basic operators.$\pi_{a...
2 2 votes
1 1 answer
108
108 views
Let $R$ and $S$ be union-compatible relations.Which expression computes $R\cap S$ using only union and set difference?$(R\cup S)-((R-S)\cup(S-R))$ $(R\cup S)-(R-S)$ $(R-S...
2 2 votes
1 1 answer
124
124 views
Consider $\text{parts(pno, pname, price)}$.Which relational algebra expression returns exactly the names of all parts whose price is greater than $\$200$?$\pi_{\text{pnam...
2 2 votes
2 2 answers
295
295 views
Which of the following statements are correct?The HAVING CLAUSE is an optional clause which tells Oracle to group rows based on distinct values that exist for specified c...
6 6 votes
2 2 answers
813
813 views
Consider the given relations $X, Y$ and $Z$. The relation $X$ has three columns $P, Q$ and $R$. The relation $Y$ has three columns $P, Q$ and $S$. The relation $Z$ has tw...