Question:

Let us consider two relations HISTORY and SCIENCE as depicted in the following Tables 1 and 2 respectively: 

Table 1: HISTORY
SNoNAMECLASS
1MOHAN6A
2SANJAY6B
3YOGESH7A

Table 2: SCIENCE
SNoNAMECLASS
1NARESH6B
2SANJAY6B
3YOGESH7A

 
What is the output of HISTORY - SCIENCE?

Show Hint

Set difference in databases means: “what’s in the first table but not in the second.” Watch for exact matches!
Updated On: Apr 28, 2025
  • SNoNAMECLASS
    1MOHAN6A
  • SNoNAMECLASS
    1MOHAN6A
    2SANJAY6B
    3YOGESH7A
  • SNoNAMECLASS
    1NARESH6B
    2SANJAY6B
    3YOGESH7A
  • SNoNAMECLASS
    1NARESH6B
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

To find the result of the set difference operation HISTORY - SCIENCE, follow these steps:
1. The set difference operation will return rows from the HISTORY table that are not present in the SCIENCE table.
2. Compare each row from HISTORY with every row in SCIENCE.
3. Identify rows in HISTORY with no matching row in SCIENCE based on 'NAME' and 'CLASS'.

The rows in HISTORY are:
- (1, MOHAN, 6A)
- (2, SANJAY, 6B)
- (3, YOGESH, 7A)

The rows in SCIENCE are:
- (1, NARESH, 6B)
- (2, SANJAY, 6B)
- (3, YOGESH, 7A)

By comparing,
- (1, MOHAN, 6A) is present in HISTORY but not in SCIENCE.
- (2, SANJAY, 6B) is present in both tables.
- (3, YOGESH, 7A) is present in both tables.

Thus, the only row not present in SCIENCE is:
SNoNAMECLASS
1MOHAN6A
Was this answer helpful?
0
0

Top Questions on Relational Algebra