Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Tests  >  Database Management System (DBMS)  >  Test: Joins in Relational Algebra - Computer Science Engineering (CSE) MCQ

Test: Joins in Relational Algebra - Computer Science Engineering (CSE) MCQ


Test Description

10 Questions MCQ Test Database Management System (DBMS) - Test: Joins in Relational Algebra

Test: Joins in Relational Algebra for Computer Science Engineering (CSE) 2024 is part of Database Management System (DBMS) preparation. The Test: Joins in Relational Algebra questions and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus.The Test: Joins in Relational Algebra MCQs are made for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: Joins in Relational Algebra below.
Solutions of Test: Joins in Relational Algebra questions in English are available as part of our Database Management System (DBMS) for Computer Science Engineering (CSE) & Test: Joins in Relational Algebra solutions in Hindi for Database Management System (DBMS) course. Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free. Attempt Test: Joins in Relational Algebra | 10 questions in 30 minutes | Mock test for Computer Science Engineering (CSE) preparation | Free important questions MCQ to study Database Management System (DBMS) for Computer Science Engineering (CSE) Exam | Download free PDF with solutions
Test: Joins in Relational Algebra - Question 1

Let the following functional dependencies hold for relation R1(A, B, C) and R2(B, D, E)

B → A, A → C, the relation R1 contains 35 tuples and relation R2 contains 34 tuples. What is maximum number of tuples possible in natural join R1 and R2?

Detailed Solution for Test: Joins in Relational Algebra - Question 1

For given relation R1(A, B, C) and R2(B, D, E), functional dependencies are given only for relation R1, not for R2 And the candidate key for R1 is B, so all 35 value must be unique in R1. To get the maximum number of tuples in output, there can be two possibilities.

  • All 34 values of B in R2 are the same and there is an entry in R1 that matches with this value. In this case, we get 34 tuples in output.

Example:

Consider an example, suppose there is two tables R1(A, B, C) consists of 5 tuples and R2( B, D, E) consists of 4 tuples only.

Natural join of R1 and R2 (R1 * R2) gives: 4

Test: Joins in Relational Algebra - Question 2

In relational databases, the natural join of two tables is:

Detailed Solution for Test: Joins in Relational Algebra - Question 2

Natural join is used to join two relations having any number of attributes. It is denoted by a symbol ( ⨝). It is the combination of projection and filtered cartesian product. It optimizes the query as the cartesian product gives unnecessary results and set union and set intersection operations are application only on those relations that have an equal number of attributes with the same data types. 

Example: Given two relation employee and departments. 

Employee:


Department:

Query: Find the name of all employees from Employee with their respective Department names using natural join :

The result will be: 

1 Crore+ students have signed up on EduRev. Have you? Download the App
Test: Joins in Relational Algebra - Question 3

Consider Join of a relation R with a relation S. If R has m tuples and S has n tuples, then maximum and minimum sizes of the Join respectively are

Detailed Solution for Test: Joins in Relational Algebra - Question 3

Consider an example, suppose there is two tables Employee(Eid, Ename) consists of 5 tuples and department(Eid, Did) consists of 3 tuples only.

Natural join of employee and department(Employee * Department) gives:
m×n = 5 × 3 = 15
Therefore maximum size is m × n

Minimum size: 
When Both the relations have a common attribute but no tuple in both relations match.
∴ minimum size = 0.

Test: Joins in Relational Algebra - Question 4

______ operation preserves those tuples that would be lost in____

Detailed Solution for Test: Joins in Relational Algebra - Question 4

R relation:

S relation:

Natural join of Relation R and S, assuming C as A in Relation S

Full outer join of Relation R and S

So we can say that outer join operation preserves those tuples that would be lost in natural join so option 2 is the correct answer.

Test: Joins in Relational Algebra - Question 5

Consider the relations r(A, B) and s(B, C), where s.B is a primary key and r.B is a foreign key referencing s.B. Consider the query


Let LOJ denote the natural left outer-join operation. Assume that r and s contain no null values.

Which one of the following queries is NOT equivalent to Q?

Detailed Solution for Test: Joins in Relational Algebra - Question 5

will include record with b> = 5 but other three queries will not.

Test: Joins in Relational Algebra - Question 6

Consider two database relations R and S having 3 tuples in R and 2 tuples in S. what is the maximum number of tuples that could appear in the natural join of R and S?

Detailed Solution for Test: Joins in Relational Algebra - Question 6

Given: two relations R and S having tuples 3 and 2 respectively. 
So, their natural join will contain maximum of 3 * 2= 6 tuples.

Example:
Consider table R (a, b) as ;

Relation S(a, c) as :

Here, the natural join of R and S will be :

So, it contains total of 6 tuples.

Test: Joins in Relational Algebra - Question 7

Which of the following Relational Algebra operations can be used when you want to keep all the tuples of the first relation irrespective of whether or not they have matching tuples in the second relation?

Detailed Solution for Test: Joins in Relational Algebra - Question 7

A JOIN clause is used to combine rows from two or more tables, based on a related column between them.
Here are the different types of the JOINs in SQL:

  1. (INNER) JOIN: Returns records that have matching values in both tables
  2. LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right table
  3. RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left table
  4. FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table
  5. We can see that left join keeps all the elements from the first relation irrespective of their presence in second relation.

Diagram to visualize joins:

Test: Joins in Relational Algebra - Question 8

The following relation records the age of 500 employees of a company, where empNo (Indicating the employee number) is the key:
empAge(empNo, age)

Consider the following relational algebra expression:

Q. What does the above expression generate?

Detailed Solution for Test: Joins in Relational Algebra - Question 8

Consider the empAge(empNo, age) Table

We run the following Query on above Table 

We get Output Table as 


Hence the Output is "Employees whose age greater than at least one employee" or "Employees whose age is no minimum".

Test: Joins in Relational Algebra - Question 9

Consider two relations R1(A, B) with the tuples (1, 5), (3, 7) and R2(A, C) = (1, 7), (4, 9). Assume that R(A, B, C) is the full natural outer join of R1 and R2. Consider the following tuples of the form (A, B, C): a = (1, 5, null), b = (1, null, 7), c = (3, null, 9), d = (4, 7, null), e = (1, 5, 7), f = (3, 7, null), g = (4, null, 9). Which one of the following statements is correct?

Detailed Solution for Test: Joins in Relational Algebra - Question 9

Full natural outer join of R1 and R2 is :

Hence option 3 is correct:

Test: Joins in Relational Algebra - Question 10

Joining a table with itself is called

Detailed Solution for Test: Joins in Relational Algebra - Question 10

Self-Join:

A self-join is a join in which the table is joined with itself to get the appropriate results. In this case, it is necessary to ensure that the join statement defines an ALIAS name for both copies of the tables to avoid column ambiguity. Example:

Query:
SELECT A. Coursename AS Course, B. Coursename AS Prerequisite_Course
FROM Course A, Course B
WHERE, A.Precourse = B.CourseID;

OUTPUT

62 videos|66 docs|35 tests
Information about Test: Joins in Relational Algebra Page
In this test you can find the Exam questions for Test: Joins in Relational Algebra solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Joins in Relational Algebra, EduRev gives you an ample number of Online tests for practice

Top Courses for Computer Science Engineering (CSE)

Download as PDF

Top Courses for Computer Science Engineering (CSE)