This assignment consists of a series of SQL questions. For each question, you will need to include:
• SQL query.
• An explanation of the query. Please include explanations as a comment AFTER your query, e.g., enclosed within a /* comments block */ ). See the first example in the SQL tutorial for a comment. You don’t need to explain straightforward code in comments. Only the parts that are interesting or different, so that we understand what you did.
Drop table If it Exist
drop table Authors;
drop table Books_Authors;
drop table Members;
drop table issue_detail;
Create Necessary Table
Create table Authors(Au_ID number(4),Au_Lname varchar(20),Au_Fname varchar(20),phone varchar(10),Address varchar(20),city varchar(20),state varchar(10),country varchar(10),postalCode number(7));
desc Authors;
insert into Authors values(101,'viral','Rajgor','123','108
A','bhuj','gujrat','India',370001);
insert into Authors values(102,'Devji','Chhanga','444','10
A','Rannal','gujrat','India',370301);
Select * from Authors;
Create table Books_Authors(Book_ID number(5),Au_ID
number(5));
desc Books_Authors;
insert into Books_Authors values(201,101);
insert into Books_Authors values(201,102);
insert into Books_Authors values(204,101);
insert into Books_Authors values(205,101);
Select * from Books_Authors;
Create table Members(Member_ID number(5),First_name
varchar(20),Last_name varchar(20),member_Since
number(4),Exipry_date date,Address1 varchar(20),Address2
varchar(20),city varchar(10),state varchar(20),zipcode
number(7),phone_num number(5),Balance number(10,2));
desc Members;
insert into Members
values(301,'Bhatt','Poonam',2002,'01-dec-2022','10 A','12
-B','Bhuj','gujrat',370001,123,23.45);
Select * from Members;
Create table issue_detail(issue_Detail_ID number(5),item_copy_ID
number(5),Member_ID number(5),issue_date date,due_date
date,return_date date,comments varchar(20));
desc issue_detail;
insert into issue_detail
values(401,501,301,'01-mar-2020','10-mar-2020','09-mar-2020','emj');
Select * from issue_detail;
Query:
Select 'Authors' "Type",Au_Lname"Last Name",Au_Fname "First
Name",count(*)"Books Count" from Authors inner join Books_Authors
on Authors.Au_ID=Books_Authors.Au_ID group by
Au_Lname,Au_Fname
union
Select 'Member' "Type",Last_name"Last Name" ,First_name "First
Name",count(*)"Books Count" from Members inner join issue_detail on
Members.Member_ID=issue_detail.Member_ID group by
Last_name,First_name;
if you still have any Problem regarding this question please comment and if you like my code please appreciate me by thumbs up thank you.........
This assignment consists of a series of SQL questions. For each question, you will need to...
Write a query to display author ID, author first, last name, and the number of subjects (book subject count) for authors who have published books in more than one subject area (book subject). CHECKOUT PATRON PK Pat ID FK1 Book Num FK2 Pat ID Check Out Date Check Due Date Check In Date Pat FName Pat LName Pat Type BOOK AUTHOR PK Au ID Book Title Book Year Book Cost Book Subject Au FName Au LName Au BirthYear FK1 Pat...
c) Write an ER Diagram for the following Library database. Identify all the Entities, Relationships and Attributes. Underline the primary keys and mark the different constraints. You can add an I attribute as a primary key for an entity to make t unique if necessary. Library has a number of branches in the city, each branch having a name, address and librarian. Books have title, authors and publisher. A book can have multiple authors but a single publisher. Note that same...
Write just one SQL statement per question 1. Display Publisher ID, Publisher Name and Total Number of Books published by each publisher. 2. List Publisher ID, Publisher Name, Title and price of the highest priced book. 3. List Order ID, Customer ID, Order Date, and Number of Items in each order. Order the data by Customer ID in ascending (A – Z) order. 4. Display Title, Category and Profit for each book in the children and computer category. 5. Display...
Write the following SQL statements in Microsoft Access by using the Books database from Week 2 Assignment 2. Once complete, copy and paste the SQL statements in a Microsoft Word document: Write SQL statements: To update the publisher name from READ WITH US to READ FOR US To verify the updated name field for the publisher with ID 6 To make the following updates to the Publisher table (be careful with WHERE): Make Contact="John Travolta" for publisher with ID number...
Part I. Create a library check-out database using Microsoft SQL Server that stores data about books, patrons, and the check-out process. Books (BookID, BookName, Author, YearPublished) Patrons (PatronsID, PatronsName, PatronsAddress, PatronsBirthday) CheckInOut (TransactionID, PatronID, BookID, CheckOutDate, NumDay, ReturnDate, Late, Fees, Paid) - the NumDay field contains the number of days patrons can keep the book, if the return date is over the number of day, then the Late field will have a Y value and a fee of $1.00 per...
The CIS Department at Tiny College maintains the Free Access to Current Technology (FACT) library of e- books. FACT is a collection of current technology e-books for use by faculty and students. Agreements with the publishers allow patrons to electronically check out a book, which gives them exclusive access to the book online through the FACT website, but only one patron at a time can have access to a book. A book must have at least one author but can...
Use the SQL statements provided to create your tables. Write one SQL statement for each of the following problems. You can only use the conditions listed in the tasks. E.g., in task 1, you cannot manually look up pid of Information Systems undergraduate program. Here is the given code: drop table textbook_schedule cascade constraints; drop table textbook_author cascade constraints; drop table schedule cascade constraints; drop table course cascade constraints; drop table textbook cascade constraints; drop table author cascade constraints; drop...
The primary keys are underlined. The foreign keys are denoted by asterisks (*). Description of the schema: • person — keeps track of the people who borrow books from the library. The attributes contain personal and contact information. • author — keeps track of personal information about authors. • publisher — keeps track of the publisher information. To keep it simple, most of the attributes have been truncated in the sample database. 1 trivial dependencies are things like X→X or...
Write the following questions as queries in SQL. Use only the operators discussed in class (in particular, no outer joins are allowed). Please use renaming consistently! The following database schema is given: RESEARCHER(rid,name,institution,city,country) PAPER(title,journal,volume,number,year) AUTHOR(resid,title) where rid is the identifier (primary key) of RESEARCHER, name is the researcher’s name, institution is where the researcher works, and city and country the city and country where the institution is located; title is the paper identifier (primary key) of PAPER, journal is the...
Objectives: The main objective of this assignment is checking students’ ability to implement membership functions. After completing this assignment, students will be able to: implement member functions convert a member function into a standalone function convert a standalone function into a member function call member functions implement constructors use structs for function overloading Problem description: In this assignment, we will revisit Assignment #1. Mary has now created a small commercial library and has managed...