Question: create database bse; use bse; create table author(author_id int primary key,author_name varchar(20)); create table publisher(publisher_id int primary key,publisher_name varchar(20)); create table book1(book_id int primary key,ISBN
create database bse;
use bse;
create table author(author_id int primary key,author_name varchar(20));
create table publisher(publisher_id int primary key,publisher_name varchar(20));
create table book1(book_id int primary key,ISBN varchar(20),publisher_id int,Title varchar(20),author_id int, price int,Foreign key(publisher_id) references publisher(publisher_id), Foreign key(author_id) references author(author_id), Foreign key(publisher_id) references publisher(publisher_id));
Insert into author values(40,'James');
Insert into author values(50,'Scott');
Insert into author values(60,'David');
insert into author values(70,'Stuart');
Insert into publisher values(131,'Lap Lambert');
Insert into publisher values(132,'Thomson Reuters');
Insert into publisher values(133,'Wiley');
Insert into book1 values(1,'999-17-129',131,'database',40,5000);
Insert into book1 values(2,'989-11-143',132,'Ride sharing system',50,2000);
Insert into book1 values(3,'965-12-133',133,'Performance Evaluation System',50,1000);
Insert into book1 values(4,'987-15-276',133,'OOP concepts',60,7000);
insert into book1 values(5,'999-17-281',133,'Mathematics',60,7000);
Question 1: By using the given Books, publisher, author database. Write the Queries for the following questions: [30 Marks]
- Display book id, title and price of those books whose price is within the range of smallest book price and 3000.
- Display all information of the book whose price is 40% greater than the Database book price?
- Display the book id and title of those books who has the same price. Order the output in descending order of their book id?
- Display the publisher name and id of those publishers who has published at least 3 books. 03
- Display book Id and author name of all books whether author has written any book or not?
- Create a view named bookshop such that it displays the id of those books whose title contains alphabet D and price is above 2000.
- Display the 3rd highest price of the book along with their book id?
- Display publisher names and first 50 percent characters of the book Title column in lower case?
- Display the book title and publisher names in one column named Books_Author, show only those books_author values whose length is greater than 30?
Display the last three characters of the book title column?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
