0
7.6kviews
Write the sql queries

Consider the following relation for book club

Members (Member_Id,Name,Designation,Age)

Books (Book_Id,BookAuthor,BookTitle,BookPublisher,BookPrice)

Reserves (Member_Id,Book_Id,Date)

Write the sql queries for the following statements:

i. List the names of members who are professors older than 50 years

ii. List the titles of book reserved by professors

iii. Find the Id’s of members who have reserved books which cost more than Rs.200

iv. Find the authors and titles of book reserved on ’20-9-2012’

1 Answer
0
550views
  • SELECT Name FROM Members

    WHERE Designation=’Professor’

    AND Age>50

  • SELECT BookTitle

    FROM Members M, Books B, Reserves R

    WHERE M.Member_Id = R.Member_Id &&

    M.Designation = 'Professor'&&

    B.Book_Id = R.Book_Id

  • SELECT Member_Id

    FROM Books B, Reserves R

    WHERE B.Book_Id = R.Book_Id &&

    BookPrice > 200

  • SELECT BookAuthor, BookTitle

    FROM Books B, Reserves R

    WHERE B.Book_Id = R.Book_Id &&

    R.Date = ‘20-9-2012’

Please log in to add an answer.