Q. Write SQL commands for the following on the basis of given table :
(a) Select all the PROG type published by BPB from Library.
(b) Display a list of all books with Price more then 130 and sorted by Qty.
(c) Display all the books sorted by Price in ascending order.
Answer =
(a)
Select * from library
Where type = ‘PROG’ AND pub = ‘BPB’ ;
(b)
Select title from library
Where price >130
Order by Qty;
(c)
Select title from library
Order by price ;
Vjdhxvg
ReplyDelete???
DeleteSecond wala wrong hai
ReplyDeleteNo.
Deletebhai 3rd wala dekhna pls
ReplyDelete3rd is correct.
DeleteIn MySQL Default sorting is in ascending order.
Good job sir thakyou for helping🌚
Delete1. To create the above table structure with proper constraints.
ReplyDelete5. Display a report. Listing Book No. current value and misplacement charges for each book in the above
table. Calculate the misplacement charges for all books Price*1.25
6. Count the number of books published by PHI
8. Count the no of books in each Type.
9. Add one more attribute “No_of_copies” in the above table.
10. Update the new attribute value with 2 for each book.
11. Count the total number of Publishers.
can u please help me by giving this answer?
5. SELECT Listing Book No, price ,price*1.25 as misplacement chargesFROM library ;
Delete6.SELECT COUNT(*) FROM library WHERE pub="PHI";
9. ALTER TABLE library ADD no_of_copies int;
In the third part of this question why Asc is not written
ReplyDeleteBecause order by clause has default value 'asc'
DeleteRight 👍
DeleteWhy it's not written select title in b and c part as in question they have written display name of book .I am confusing .can u please give my answer..
ReplyDeleteBecause I have written * which mean to display all data.
DeleteBut we just have to display the names....not all records??
DeleteIt's just a different model of question to be asked But , Don't worry answers will be same for everything.
ReplyDelete😊
DeleteIn C part Ascending is not used
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )