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

Neo4j, I have one assignment that has to be done in neo4j

I have one assignment that has to be done in neo4j

Differance between ddl and sdl, Differance between DDL and SDL? DDL and...

Differance between DDL and SDL? DDL and SDL - The data definition language (DDL) is used through DBA and database designers to describe internal schema, conceptual schema, and

What is substitutability, What is substitutability? Any method of a cla...

What is substitutability? Any method of a class-say A can equally well be adjured with any object belonging to any subclasses B of A. This characteristic leads to code reuse, a

What are the benefits of decomposing a system, What are the benefits of dec...

What are the benefits of decomposing a system? The benefits of decomposing a system into subsystems are that after decomposition, each individual component become smaller and e

The average amount of their orders , Make SQL statements for the following ...

Make SQL statements for the following scenarios. Your response should contain SQL statement, output and any other assumptions you have made to arrive at the answer. For Colorado cu

What are the ways in which signal can be generated, What are the ways in wh...

What are the ways in which signal can be generated A signal might be generated in many ways such as a Signal is result of particular physical condition. Whenever a process writ

Create table to evaluating websites-reasoning, Have a look around the site,...

Have a look around the site, and at some of the sites they have featured. These are all examples of bad design, and also offer an explanation about why they fall into this category

Fire dementpart, The State of NewYork certifies firefighters throughout sta...

The State of NewYork certifies firefighters throughout state and keep track all of them, as well as of the state’s fire departments. Each fire department has unique department numb

What is the difference between serial and sequential files, What is the dif...

What is the difference between serial and sequential files? How searching is applied on both?    Ans: A serial file is one where the records have been stored in the order where

Define the boyce-codd normal form, Define the Boyce-Codd Normal Form with i...

Define the Boyce-Codd Normal Form with instance and also Compare BCNF and 3NF.  Ans: BCNF: For each functional dependency X->Y in a set F of functional dependencies over relati

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