search
Log In

sql doubt [closed]

0 votes
73 views
Given a Relation POSITION (Posting-No, Skill), then query to retrieve all distinct pairs of posting-nos requiring skill is

1.Select p1.posting-No, p2.posting-No from position p1, position p2 where p1.skill = p2.skill and p1.posting-No = p2.posting.No;

2. Select p1.posting-No, p2.posting-No from position p1, position p2 where p1.skill = p2.skill and p1.posting-No < p2.posting-No;

3.Select p.posting-No, p.posting-No from position p where p.skill = p.skill and p.posting-No < p.posting-No;

4. Select p1.posting-No, p2.posting-No from position p1, position p2 where p1.skill = p2.skill;
closed with the note: wrong question.
in Databases
closed by
73 views
0

@Shaik Masthan

how to solve these type of questions ?

0

i am sure, question is either wrong or missing some more data !

POSITION (Posting-No, Skill) ===> containing only 2 attributes ===> every row is unique

therefore printing original relation as it is ( i.e., select * from POSITION ) ====> printing distinct pair of (Posting-No, Skill)

 

what's wrong with option A ?

Select p1.posting-No, p2.posting-No from position p1, position p2 where p1.skill = p2.skill and p1.posting-No = p2.posting.No;

it doesn't print the pair  (Posting-No, Skill), it is printing the pair ( Posting-No, Posting-No )

Related questions

0 votes
1 answer
1
102 views
In this question:- https://gateoverflow.in/8225/gate2015-1-27 I am not understanding how the query is returning 2 . I think DISTINCT must be there to give the correct answer. Can you give some logical explanation?
asked Nov 12, 2018 in Databases Shamim Ahmed 102 views
1 vote
3 answers
2
217 views
Class(name, meets_at, room, fid) Faculty(fid, fname, deptid) Find the names of faculty members who teach in every room in which some class is taught
asked May 18, 2019 in Databases aditi19 217 views
0 votes
0 answers
3
108 views
Product(maker, model, type) PC(model, speed, ram, hd, price) Laptop(model, speed, ram, hd, screen, price) Printer(model, color, type, price) Find the maker(s) of the PC(s) with the fastest processor among all those PC 's that have the smallest amount of RAM pls check if my SQL ... p.model from PC p where p.speed IN( select max(p1.speed) from PC p1 where p1.ram IN( select MIN(p2.ram) from PC p2)))
asked May 8, 2019 in Databases aditi19 108 views
0 votes
0 answers
4
132 views
I got why query 2 is wrong. How do I approach to understand Query 1, is there a generic approach for solving questions like these which have no tables given?
asked Jan 8, 2019 in Databases amitqy 132 views
...