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

Describe query evaluation engine, Describe Query evaluation engine? Que...

Describe Query evaluation engine? Query Evaluation engine: Vehicle executes low-level instructions obtained through the DML compiler. The Storage Manager Components gives in

Illustrate the term- abstracting out common behaviour, Illustrate the term-...

Illustrate the term- Abstracting Out Common Behaviour Inheritance is not every time recognised during analysis phase of development, thus it is necessary to re-evaluate object

Example-revoke all on emp from mca12, Example:  //REVOKE ALL ON EMP FROM MC...

Example:  //REVOKE ALL ON EMP FROM MCA12;                              (All permissions will be cancelled) You can also cancel only some of the permissions. Drop: A user-

Give short note on the following terms- dirty pages and etl, Give short not...

Give short note on the following terms:Dirty pages and ETL a.) Dirty pages. These are buffer pages which comprise modifications which haven't been written to disk. b.

Define sequence, Define Sequence A sequence is a set of integers 1, 2, ...

Define Sequence A sequence is a set of integers 1, 2, 3 that are generated in order on demand. Sequences are regularly used in databases because lots of applications require ev

What is object containment, What is object containment? References amon...

What is object containment? References among objects can be used to model dissimilar real-world concepts.

RDBMS, DISADVANTAGES OF RDBMS

DISADVANTAGES OF RDBMS

Relational algebra, Consider the relation schemas as follows. works (per...

Consider the relation schemas as follows. works (person name, company name, salary); lives (person name, street, city); located in(company name, city); managers (person name

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