in Databases retagged by
536 views
0 votes
0 votes

Consider the following set of relations:
      EMP   (eno, ename , dno)  
      DEPT (dno, dname)

Primary key columns are underlined and dno in EMP is a foreign key referring primary key of DEPT table.

Now, consider the following queries:

QUERY: $1$

SELECT *  FROM emp e, dept d WHERE e.dno = d.dno;

QUERY : $2$

SELECT * FROM emp NATURAL JOIN dept;

Which of the following statements are TRUE regarding the above queries?

  1. Both Query:1 and Query:2 returns same number of rows.
  2. Both Query:1 and Query:2 returns same number of columns.
  3. Both Query:1 and Query:2 returns different number of rows.
  4. Both Query:1 and Query:2 returns different number of columns.
  1. I, II only
  2. III, IV only
  3. II, III only
  4. I, IV only
in Databases retagged by
by
536 views

2 Answers

5 votes
5 votes
Best answer

Query 1   first we do the cross product of both table

return  tuple in which dno (of student table ) =dno (dno of department ) 

during the cross product two different dno attribute will be created  one from the  student table and one from the dept table 

eno, ename , s.dno, d.dno,dname

Query 2 natural join takes place on the common attribute 

so only those tuple will be created in which  dno (of student table ) =dno (dno of department ) 

and the result table contain only one dno 

eno, ename , dno, dname

so the option d is answer

selected by
0 votes
0 votes
@BIkrram sir how both queries can give different no. of columns.
by

4 Comments

Because of Natural join in query 2 ..
0
0

do u mean in query1 () eno, name , dno , dnumber , dname will be attributes 
and in query2 
eno, ename , dno, dname will be attributes

1
1
yes correct..
0
0

what is dnumber here?

0
0
Answer:

Related questions