19,282 views
81 votes
81 votes

SQL allows duplicate tuples in relations, and correspondingly defines the multiplicity of tuples in the result of joins. Which one of the following queries always gives the same answer as the nested query shown below: 

select * from R where a in (select S.a from S)
  1. select R.* from R, S where R.a=S.a
  2. select distinct R.* from R,S where R.a=S.a
  3. select R.* from R,(select distinct a from S) as S1 where R.a=S1.a
  4. select R.* from R,S where R.a=S.a and is unique R

6 Answers

0 votes
0 votes
THE POSSIBLE THING THAT WE NEED TO CHECK IS THE IN OPERATOR CHECKS IS WHETHER THE PARTICULAR VALUE IS IN THE OTHER TABLE IT DOES NOT CHECK HOW MANY TIMES IT IS IN SO ANY VALUE WILL ONLY MATCH WITH  ONLY ONE VALUE IN THE SO IT IS LIKE WE NEED THE DISTINCT VALUES FROM S AS  IN WILL CHECK WHETHER THE VALUE IS PRESENT IN IT OR NOT
–5 votes
–5 votes
(A) select R.* from R, S where R.a=S.a

statement states that if R has duplicate tuples, then it will decide the join mutiplicity, so no need to filter out distict tuples

Please correct me if i am wrong !!!

Please explain me what does the D options do ?
Answer:

Related questions

45 votes
45 votes
6 answers
1
go_editor asked Sep 28, 2014
20,625 views
Consider a join (relation algebra) between relations $r(R)$ and $s(S)$ using the nested loop method. There are $3$ buffers each of size equal to disk block size, out of w...
61 votes
61 votes
3 answers
2
33 votes
33 votes
3 answers
4
go_editor asked Sep 28, 2014
7,210 views
Given an instance of the STUDENTS relation as shown as below$$\begin{array}{|c|c|c|c|c|} \hline \textbf {StudentID} & \textbf{StudentName} & \textbf{StudentEmail} & \text...