942 views
0 0 votes

A relational database contains two tables student and department in which student table has columns (roll_no, name and dept_id )and department table has columns (dept-id and dept-name). The following insert statements were executed successfully to populate the empty tables:

Insert into department values (1, 'Mathematics');
Insert into department values(1, 'Physics');
Insert into department values(1, 'Navin', 1);
Insert into student values (2, 'Ravi', 2);
Insert into student values (3, `Gitu', 1);

How many rows and columns will be retrived by the following SQL, statement?

Select * from student, department;

A. 0 row and 4 columns **
B. 3 rows and 4 columns
C. 3 rows and 5 columns
D. 6 rows and 5 columns

2 Answers

0 0 votes


Answer should be (B) 3 rows, 4 coumns

Rollno Name Dept id Dept Name
1 Navin 1 Math
2 Ravi 2 Physics
3 Gitu 1 math
0 0 votes
Depratment table(D):

---------------------------

1   Mathematics

1   Physics

 

student table(S):

------------------------------------

1 Navin 1

2 Ravi   2

3 Gitu   1

 

Now, we are taking the cross product of 2 tables: So, result contains following columns:

S.roll_no      S.name     S.dept_id    D.dept_id     D.dept_name

----------------------------------------------------------------------------------------------------------------

Combine the columns only when its join operation because join operation is considered as set operation on column names.

So, (D) is correct answer.
Position:
Show:

Related questions

0 0 votes
1 1 answer
1.5k
1.5k views
0 0 votes
1 1 answer
1.1k
1.1k views
anonymous asked Jun 26, 2016
1,092 views
0 0 votes
0 0 answers
345
345 views
sumit goyal 1 asked Dec 16, 2017
345 views
1 1 vote
1 answers 1 answer
750
750 views
sumit goyal 1 asked Jul 18, 2017
750 views
There are 6 periods in each working day of a school. In how many ways can one organize 5 subjects such that each subject is allowed at least one period?sol :5 subjects ca...