Awesome q2a theme
0 votes
27 views

Consider the following relations:

Which of the following query gives suppliers names who have submitted at least one ‘Harvest’ brand item? (sno in item is the foreign key referencing sno in supplier).
I. Select sname FROM Supplier S, Item t where t.brand = ‘Harvest’
II. Select sname FROM Supplier S where sno IN (Select sno FROM Item where brand = ‘Harvest’)

 

What will be the correct answer for above question?

in Databases by (135 points) | 27 views
0
the ans should be only 2nd
 as SQL does only cartesian product and not natural join! In 1st it should have done S.sno=t.sno! that would do a natural join!

1 Answer

0 votes
I think the answer should be Both a and b.

Since ,sno in item is foreign key references to sno in supplier ,so there can be a natural join on sno and also given brand="harvest" ,so it will fulfil the required condition.

And 2 is also correct because we can use "IN" for selecting atleast one item .
by (9 points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Top Users 2020 Aug 03 - 09
  1. Mellophi

    98 Points

  2. Ashutosh777

    70 Points

  3. Kushagra गुप्ता

    12 Points

  4. srestha

    11 Points

  5. arjun12

    10 Points

  6. prakhar2810

    8 Points

  7. sdutta

    7 Points

  8. shivarajkumar

    6 Points

  9. kuldeep kumar07

    6 Points

  10. toppoavinash

    6 Points

Weekly Top User (excluding moderators) will get free access to GATE Overflow Test Series for GATE 2021
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.
Top Users Aug 2020
  1. Mellophi

    104 Points

  2. Ashutosh777

    73 Points

  3. Shaik Masthan

    13 Points

  4. srestha

    13 Points

  5. Kushagra गुप्ता

    12 Points

  6. arjun12

    10 Points

  7. Unnayan kumar

    8 Points

  8. prakhar2810

    8 Points

  9. sdutta

    7 Points

  10. Sourav Kar

    7 Points

7,725 questions
1,826 answers
11,148 comments
95,095 users