Define the relations as tables in sql, Database Management System

Assignment Help:

Consider the relations given below
Borrower (id_no, name)
Book (accno., title, author, borrower_idno)
(a) Define the above relations as tables in SQL forming real world assumptions about the kind of the fields. Define the primary keys and the foreign keys.
(b) For the above relations answer the subsequent queries in SQL
What are the titles of the books borrowed through the borrower whose id-no in 365.
(i) Find out the numbers and names of borrowers who have borrowed books on DBMS in ascending order in id_no.
(ii) List the names of borrowers who have borrowed at least two books.

a) Create table Book
(Accno int Primary Key,
title char(30),
author char(30),
borrow-idno int references Borrower_id.no );
Create table borrower
(id-no int Primary Key,
name char(30) );
b) (i) Select title from Book, Borrower where Borrower.id_no =Book.borrower-idno and borrower.id_no = 365
(ii) Select id_no, name from Borrower, Book where Borrower.id_no= Book.borrower_idno and title= ‘DBMS' order by id_no asc;
(iii) Select name from Borrower, Book where Borrower.id_no = book.borrower_id_no having count (*) > 2

 


Related Discussions:- Define the relations as tables in sql

ER DIAGRAM, draw ER diagram of student entity and course entity where attri...

draw ER diagram of student entity and course entity where attribute of student entity are student roll, student name, student phone and student address and attribute of course enti

What are multiple inheritances, What are multiple inheritances? Multipl...

What are multiple inheritances? Multiple inheritances allow a class to inherit variables and methods from many super classes.

What is the aim of logical schema, What is the aim of logical schema ? ...

What is the aim of logical schema ? The main motive of the logical schema is to ensure the portability of procedures and models on various physical schemas at runtime.

Structure of client server systems, Structure of Client Server Systems: In ...

Structure of Client Server Systems: In client/server architecture, clients show users who require services while servers give services. Both client and server are a combination of

Using relational algebra which query finds customers, Using Relational Alge...

Using Relational Algebra which query finds customers, who have a balance of over 1000 ? Using Relational Algebra Π Customer_name( σ balance >1000(Deposit)) is query to find cu

MULTI-LIST FILE ORGANIZATION, sir, could anybody help me in getting complet...

sir, could anybody help me in getting complete information about the mentioned topic

Computer, 1. Will you advise that your organization uses open source softwa...

1. Will you advise that your organization uses open source software and why? 2. Why is it important for business managers to have a basic understanding of the software development

Explain different addressing modes of 8086, 1. Explain different addressing...

1. Explain different addressing modes of 8086 Explanation of all addressing modes 2. Write a sequence of instructions to exchange two register contents using stack

Drop table command, DROP TABLE Command: When an existing object is not ...

DROP TABLE Command: When an existing object is not needed for further use, it is always better to eliminate it from the database. To remove the existing object from the databas

What are the states of transaction, What are the states of transaction? ...

What are the states of transaction? The states of transaction are:- a) Active b) Partially committed c) Failed d) Aborted e )Committed   f) Terminated

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd