retagged by
550 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
retagged by

2 Answers

Best answer
5 votes
5 votes

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.
Answer:

Related questions

3 votes
3 votes
1 answer
4
Bikram asked Aug 26, 2017
411 views
What is the number of rows returned by an SQL query on the below EMP table?$\begin{array}{|c|c|c|} \hline \text{eno} & \text{ename} & \text{manager} \\ \hline 1 & A & \te...