This query is quite simple in terms that its very logical... let's see this step wise
Step 1: B_name =" Vijay" present in User relation having Card_no. as the key
Step 2: Card_no is an attribute of B_by relation having Acc_no as an attribute which will be referencing to the Book relation
Step 3: Book relation contains Title which will give titles for a particular Acc_no....we have to find Acc_no of such other similar Titles too...
Step 4: after we successfully found out the possible Acc_no of "Titles" issued by Vijay we join S_by and Book relations to find and display the S_name for the projected Acc_no.
hence the query becomes :
z = { t | ∀ a ∈ User ( a [B_name] = "VIJAY" ==> /* selecting tuples with B_name = "VIJAY"*/
∃ b ∈ B_by( a[Card_no] = b[Card_no] ∧ /* natural join of B_by(b) and User(a) for Card_no of "Vijay"*/
∃ c ∈ Book( c[Acc_no] = b[Acc_no]) ∧ /* natural join of Book(c) and B_by(b) for Acc_no of books issued to the Card_no of "VIJAY" */
∃ d ∈ Book( c[Title] = d[Title]) ∧ /* cartesian product of Book(c) with Book(d) to find Titles same as Titles issued by "VIJAY"*/
∃ e ∈ S_by( d[Acc_no] = e[Acc_no] ∧ t[S_name] = e[S_name] ) /* natural join of S_by(e) and relation d to find S_name for the all Titles issued by Vijay*/
)
)
}
I hope this is the correct solution. Still, any suggestion is Welcome. I face issues with brackets. Any help regarding that.