edited by
5,276 views
2 votes
2 votes

Consider the following three SQL queries (Assume the data in the people table):

  1. Select Name from people where $\text{Age}>21$;
  2. Select Name from people where $\text{Height}>180$;
  3. Select Name from people where $(\text{Age}>21)$ or $(\text{Height}>180)$;

If the SQL queries $a$ and $b$ above, return $10$ rows and $7$ rows in the result set respectively, then what is one possible number of rows returned by the SQL query $c$?

  1. $3$
  2. $7$
  3. $10$
  4. $21$
edited by

3 Answers

3 votes
3 votes
When set a and set b all rows are distinct ans would be = 10+7 = 17

When set b is subset of set a than

10+7-7 = 10

Only these two options are preferable...
0 votes
0 votes

Option C

 Name from people where Age>21=10

 Name from people where Height>180=7

then those who have Age>21 and Height>180 will be (intersection) =7 names, which are included in query(a) output=10, then remaining names out of 10 will be 3 names that does not satisfy both condition but first condition.

therefore 7+3=10

 

0 votes
0 votes

Maximum We Get 17 Row

Suppose there are 7 people whose height > 180 but there age is <21(select based on height)

and there are 10 people whose age>21 but there height is <180(select based on age)

so we will get 10+7 =17 rows

 

 

Minimum We Get 10 Row

If 7 people have height >180 and age>21

and 3 people have height<180 and age>21

then we will get 7+3 = 10 rows

 

Answer:

Related questions

8.0k
views
2 answers
2 votes
go_editor asked Aug 11, 2016
7,963 views
Suppose ORACLE relation $R(A,B)$ currently has tuples $\{(1,2), (1,3), (3,4)\}$ and relation $S(B,C)$ currently has $\{(2,5), (4,6), (7,8)\}$.Consider the following two S...
4.1k
views
1 answers
2 votes
Sanjay Sharma asked Dec 30, 2015
4,062 views
Consider the following database table:Create table test( one integer, two integer, primary key(one), unique(two), check(one>=1 and <=10), check (two>=1 and <=5) );How man...
4.3k
views
2 answers
2 votes
go_editor asked Aug 11, 2016
4,254 views
Consider the following three tables $R, S$ and $T.$ In this question, all the join operations are natural joins $(\bowtie )$. $(\pi )$ is the projection operation of a re...
4.3k
views
1 answers
1 votes
go_editor asked Aug 11, 2016
4,319 views
Which of the following statements regarding the features of the object-oriented approach to databases are true?The ability to develop more realistic models of the real wo...