# SQL Query

160 views

Suppose there are two tuples in Animals relation with different IDs but of same type and in Adoption table there is a tuple with an ID that matches with the  ID of first tuple in Animal relation. AND during the query evaluation, the type of first tuple of the animal relation will not be selected whereas the SQL query will select type of second tuple of animal relation as there is no tuple in ADoption that have same Id as of second tuple of Animal relation .

Hence this is wrong to say that Distinct type of animals will be selected who have not had any adoption? right?

I know my answer is wrong here for the case when all Ids of the same type are also present in Adoption table . but the thing is given answer is also wrong here.

Correct me if i’m wrong.

0

Hence this is wrong to say that Distinct type of animals will be selected who have not had any adoption? right?

Simply the query returns

Distinct Types of the animals which there should be atleast one animal is not adopted !

or

Distinct Types of the animals which all animals of that type are not adopted !

0

please avoid unnecessary usage of screenshots !
0
I don't know what's the problem here but really brother it is very helpful to post a screenshot than typing the whole question as it saves more time and removes any confusion to readers :)

0
we can't find duplicates if you post screen shots....

there are more number of questions already present in GO, there is a high probability ( due most of the persons posting test series questions which are repeated by test series organizations ) that your question already been asked, and answered by someone.

## Related questions

1
380 views
According to me it should be – “Retrieve the names of all students with a lower rank, than all students with age < 18 ”
Consider relational schema $R(A,B,C)$ and $S(A,B,C)$ $1)$ Select * from $R$ where $(A,B,C)$ in (Select * from $S$) $2)$ Select * from $R$ where exists ( Select * from $S$ where R.A=S.A and R.B=S.B and R.C=S.C) $3)$ Select * from R where $(A,B,C)$ not in((Select * from $R$ where $(A,B,C)$ not in)Select * from S) Which of the following SQL expression equal to $R\cap S$?