The Gateway to Computer Science Excellence
+1 vote
96 views

$(e.Fname$|$ EMPLOYEE(e)\ AND\ ((\forall_{d})[ (DEPENDENT(d)\ AND\ d.ssn= e.ssn \ AND\ (d.sex='M'))\rightarrow (d.age>30))] )$ 

EMPLOYEE    
Fname SSn Sex
Ram 1 M
Shyam 2 M
Ravi 3 M
Sita 4 F
DEPENDENT    
SSN SEX AGE
1 M 35
1 F 25
1 M 15
2 M 50
2 F 13
3 F 20
4 F 24

on the basis of above instances of tables, which of the following option is true of output of above query??

  1. $Ram,Shyam,Ravi,Sita$
  2. $Shyam ,Ravi,Sita$
  3. $Shyam$
  4. $Empty$
in Databases by Boss (10.8k points)
edited by | 96 views

1 Answer

+1 vote
Best answer

(∀d) [(DEPENDENT(d) AND d.ssn=e.ssn AND (d.ssn="M′))→d.age>30)

I HOPE IT'S MISTAKENLY TYPED. AND THE ORIGINAL ONE 

(∀d) [ DEPENDENT(d) AND d.ssn=e.ssn AND ( (d.sex='M′)  → ( d.age>30) ) ]

 

it means all dependents  of a employee

WHO ARE MALE should have their age as grater than 30 ( p->q form ) ------> satisfied by Shyam,ravi, sita

                    or it can be read as

 have their age less than 30 then they should not Male Dependents ( ~q->~p form ) ------> satisfied by Shyam,ravi, sita

 

if you didn't understand ===> recall p->q in preposition logic where it's truth value should be TRUE

 

∴ Option B is right

by Veteran (65.7k points)
edited by
0
i think ravi and sita are in output not because of age less than 30 they are in because they are not male in dependent table, which makes p implies q true.
0
@shaik

"2) have their age less than 30 ------> satisfied by ravi, sita"

why it is required here?
0
and

"WHO ARE MALE should have their age as grater than 30 ------> satisfied by Shyam"

Ram also satisfying this condition

right?
0
@ srestha Mam,

for ram there is one dependent who is male but does not have age grater than 30

therefore ram can not be in output.
0
no ma'am Ram is not satisfying condition .because for all whose ssn is matching age should be  > 30 .but there is one tuple for Ram age is 15 so it become false .so ram is not in result.
+1
@srestha..p---->q if p is true and q is false than only its false otherwise its true in all cases...so in case of ravi and sita p is false(means dependent sex is not male) so whatever may be q either its true or false we dont care because your output will always be true...so these 2 results included in our output.!
+1

Prateek Raghuvanshi , yes you reason is right, i updated in my answer, Thanx for correction.

0

@Shubham @Shaik

$(e.Fname$|$ EMPLOYEE(e)\ AND\ ((\forall_{d})[ \sim (DEPENDENT(d)\ AND\ d.ssn= e.ssn \ AND\ (d.sex="M'))\vee d.age>30)] )$

OR


$(e.Fname$|$ EMPLOYEE(e)\ AND\ ((\forall_{d})[ (\sim DEPENDENT(d)\ \vee \ d.ssn\neq e.ssn \vee \ (d.sex\neq "M'))\vee d.age>30)] )$

See I have removed $\rightarrow$ with$\sim \vee$ and Now output is coming only Sita

because statement is Fname of the those employee those who are not dependent or not male or those who have age greater than 30

rt?

0
@shrestha actually you have done mistake in changing p-->q  i.e e.ssn= d.ssn( not not equal too )when you remove implication p-->q will.change to (p'vq) that complement wont be applied on whole..
0
@srestha, actually parentasization is also wrong in question... I updated in my answer... Please check it.
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,370 answers
198,506 comments
105,274 users