0% found this document useful (0 votes)
45 views

DBMS PDF

Uploaded by

yr016619
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
45 views

DBMS PDF

Uploaded by

yr016619
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 13
Galgotia's University school of computer science and engineering lab assignment - 1 DBMS(E2UC302B) B.tech(3rd Semester) 2022-2026 submitted by Yasir Rahman section-02 Admission no. 22SCSE1010270 Submitted to:- Mr.Akhilesh sir Question 1. Inserts few records in it, Answer. The required code is- INSERT INTO book (book_code, 1S8N_NO,book_name,publisher,price,author_name,date_of_launch) vatues (00136789432, “Macbeth” "TH" ,100.25)"W.5"»"1967-11-38" (002, 14357689, "MAMLET™ 5TH" ,500.45"W.S" ,°1957-3-8"), (992, 34589654, "DRACULA™, "PHI" ,300.70)"8.57,°2987-9-12"), (00498765432, "NATURE" »"TH”,230.005"ROBERT LAFORE™ 1999-12-12" (@25,87659083,"s000 308", “TH",208 ((906,$643218, "CORALINE", “BP” 785.78,"H.G"» 1999-02-02"), (007,98675434, "MATILDA", "BPR" ,800.50,"R.0","1990-10-10"), (008, 56743209, "HOLES", "TPH" ,250.705"L.5","1958-01-€1" (00998767549, "Erma", “BPE”, 700.00,"3.8°," 1885-08-19"), (810, 98989768, "OTHELLLO™ "XYZ" )488.78,"W.S","2898-85-11"), (012,98909896 "DAY" "PHI™ 4800,005"N.H" »'1906-06-26')s SELECT * FROM BOOK; st: iy > Bh | econmpor fy Gy | wap cat conmees TE + i pate faite gene | caer teins | Pit Somer Made TH 0a ws a7at0 mms ono wt aS wees gue MOT md oD EW 00525 2 samme Oar md DOM tes 2 rasees AMET TH na) Ws arose 3 sms OUCHA AE OD as 87092 Ssemsaa naTiRE To 25000 ROMERTLAFORE —io-t212 s 87659043 GOOD 308TH (200.00 YASHWANTKANETKAR 1986-06-09. 5 sears COMUNE ER KG none 7 seers MATA o> am RD 1900-0 e sores HOST MLS sor {GON Sane Sp REE re aD ZF AS es Question 2. Increase the size of the book_name field to 10 characters| + WERE UE ARE INCREASING THE STZE OF SOOK_NANE FIELD TO 10 VARCHAR 45+ ALTER TABLE Book MODIFY Book Name VARCHAR(1); 47 -+ THIS TS EXAMPLE OF BOOK_MAME FIELD TO 10 VARCHAR INSERT INTO Book (Book_Code, ISBN_No, Book_Nare, Publisher Pri. VALUES (00022 ,268674,"junglebook™ ,"ACC™,900.50,°R.K*,“1976~ Author_Name, Date_of Launch) 20°); Output table for increasing the size of the Book_Name field to 10 characters tense ort | IB) 49 rawr tows Book_Code ISBN.No Bok Name Publisher an 12345673 Macbeth }10 88710 Good Jeb a e710 NATIRE 2 164674 jungebook 2 4566281 Hamlet 3 HH6648 race 4 us Night 3 79434 theo 6 637s BMA \7 7974 Holes 8 169484 Matlda 3 8534 Covalne OS S¥SAPIZRIF? ot: fy Hib Bb | eporyimpert: Gy [Gy | wrap cet content: Pree Auther Name Date_of Jaunch woz ws e512 200.00 Yahwant Kanetar 1990-01-01 29000 Roetlafee SPIN soso RK 19-10-20 0050 WS 1295-10-15 10054 Bs 1900-08-15 0000 Ew 1908-05-25 ws wen DA eae us wso101 Ro 1990-10-19 HG 1999-0242 on om Question 3. Display the total price of all the books of "TMH" publishing house. Answer. code for the total price of all the books of"TMH" publishing house- SELECT SUM(PRICE) AS total_price FROM book WHERE publisher = ‘7hit'; output- | Resuttrid | J] €) Fiter Rows: | export: Gq | wrap cell content: TA |_| total_price [> [1281.35 Question 4. Display the details of all the books of author "YASHWANT KANETKAR" and "ROBERT LAFORE". Answer. code for display the details of all the books of author "YASHWANT KANETKAR" and "ROBERT LAFORE"- SELECT * FROM book WHERE author_name = "YASHHANT KANETKAR" OR author_name = "ROBERT LAFORE"s Rent Grit | HEL Fer Room: ft: el ES [emoritmoort: BE iy [Wap at contr: HE bbook_code ISBN.NO _book.neme _publsher price author name oie_of lourch 98765432 NATURE TMH 230.00 ROBERT LAFORE 1999-12-12 87556043 GOCDJO8 TMH 200.00 _YASHWANTKANETKAR 1986-0509 To) = os = Quesion 5. Delete alll the books belonging to "PHI" publisher. Answer. code for displaying all the books belonging to "PHI" publisher, SELECT * FROM book WHERE publisher = ‘PHI’; 1 Result Grid | dl] €Y Fter Rows: ___| Bats hb BB | exrontmport: Fl Ely | Wren Cat Contents TE bbook_code T58NNO book.name publcher pre author name date_ofJounch -ou ‘esasess NIGHT = PHIS«00.00 EW 1908-05-25 2 90509893 AY Pa 900.00 MW 1906-06-28 > 24500653 DRACULA PHL 300. BS 1997-09-12 = = oo so os om Q6. Update the price of books by 5% which belong to “BPB’ publishers. Ans: Code for updating the price of books by 5% which belong to ‘BPB’ publishers. ~- THIS TS USED TO INCREASE THE PRICE BY S¥ . THE FORMULA TS NEW PRICE =OLD PRICE + (OLD PRICE * 5 / 100) UPDATE Book SET Price = Price * 1.05 WHERE Publisher = ‘SPS’; Output table of the updated price of books by 5% which belong to ‘BPB’ publishers. | Result Grid | [I] -€) Fiter Rows: __| ese: cl) E> BR | exporttimport: Fag Sy | we | Book_Code 1SBN_No Book Name Publisher Price _Author_Name Date_of Launch mit 12345678 Macbeth = TMH 100.25 WS 1985-12-31 10 88710 ‘Good Job TMH 200.00 YashwantKanetkar 1990-01-01 11 88710 NATURE TMH 250.00 Robert Lafore 1999-11-11 R 164674 junglebook ABC 900.50 RK 1970-10-20 2 4566281 Hamlet TMH 500.50 W.S 1895-10-15 3 4446848 (Dracula PHI 100.54 B.S 1900-08-15 4 789168 Night PHI 900.00 EW 1908-05-25 5 7894654 ‘Othello XYZ 400.00 W.S 1890-05-11 6 468785 EMMA 6PB 221.06 2A 1883-08-19 7 739784 Holes TMH 250.50 LS 1958-0101 8 169934 Matilda PB 882.56 RD 1990-10-10 9 89949 Coraine PB 865.99 H.C 1999-0202 fr Quesion 7. Create a new table "Author" with author details such as author id(primary key),name of the author, subject,contact details,research area etc. Answer. CREATE TABLE author( author_id INT NOT NULL, author_name VARCHAR(+5)} NOT NULL, subject VARCHAR(1@) NOT NULL, contact_detail DOUBLE, research_area VARCHAR(2¢@), PRIMARY KEY (author_id)); . ey BB | Exponimport: Ey [Hy |Wrep cet content: Quesion 8. insert records in it and display the records of those authors who have "web mining" as their research area. Answer| INSERT INTO author(author_id,author_name, subject ,contact_detail,research_ area) VALUES (907561, "VASHWANT KANETKAR", "ENGLISH" ,8976543578, "WEB MINING"), (754139, "LOUIS SACHAR™ "ENGLISH" 2345678890, "WEB MINING”), (84987, "WILLIAM SHAKESPEARE", "ENGLISH" 345678987, "HISTORY"), (987425, "ELIE WIESEL", “ENGLISH” 9898976543, "HISTORY"), (87947, "BRAM STOKER" ," ENGLISH" 2345678659, "WEB MINING"), (788845,"JANE AUSTEN”, "ENGLISH" 3456543457, "WEB MINING"), (997845 ,"RUDYARD KIPLING” "ENGLISH" 2345654278, "HISTORY") (887654, "KIPLING “, "ENGLISH" ,8976543210, "WEB MINING"); Quesion 9. Output table for displaying the inserted record to author table. Answer. eat: By ES Be | exponytmpont: ify By | wrap cet contents TH 987425 ELIE WIESEL HISTORY 997845 RUDYARD KIPLING HISTORY 7 om Quesion 10. Output table for displaying dsiplay the records of those authors who have "web mining” as their research area. Answer. | Result Grid | HH 4% Fer Rows: edt: lly > BE | eeporytemport: Bey Gig | wrap cat Content: TE aithorid author pame subject contact detal research area > (e747 BRAMSTOKER ENGLISH 2345678659 WEBMINING |754139 Louts SACHAR ENGLISH 2045678090 WeBMINING ‘7eee35 JANE AUSTEN ENGLISH 3456543457 WEBMINING 37654 KIPLING ENGLISH 9976542210 WeBMINING 907561 YASHWANTKANETKAR ENGLISH 9976543573 WEBMINING = os = om = Quesion 11. Display the records of the books where book name starts with 'C' or Answer. ~- WERE WE ARE DISPLAYING 8ODK TABLE WHERE BOCK WANE STARTS WITH ¢ oR 6 oR H SELECT * FON Book WERE Book Hane LIKE ‘CX’ OR Book Name LIKE “GOR Book. Hlame LIKE "k's 12)Output table for displaying the records of the of books where book name starts with ‘C’ or ‘Gor‘K’. 4n0 | Result Grid | J} ¢} Fiter Rows: ect: dy Es BL | Exportimoort: iy By | weer cel content: Hi . ISBN_No Book_Name Publisher Price Author Name Date_of_Launch 9 89943 Coraline BP 785.48 H.C 1999-02-02 oo

You might also like