Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
94 views
MySQL Practicals
Uploaded by
venkat krishnan
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save MySQL practicals For Later
Download
Save
Save MySQL practicals For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
94 views
MySQL Practicals
Uploaded by
venkat krishnan
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save MySQL practicals For Later
Carousel Previous
Carousel Next
Save
Save MySQL practicals For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 4
Search
Fullscreen
1. Consider a database LOANS with the following table: Table: LOANS. 1 [Rak Gupta] 300000 36 12.00 | 19-07-2009 | 90 2 |sp.sharma | 500000, a 10.00 {22-03-2008 | —te5p 3 _[KP.tain 300000 36 Nutt | 08-03-2007 | reap ‘4 [Mp yadav | 200000 60 10.00 | 06-12-2008 | — nas 5_[SP.sinha "200000 36 1250 | 05-01-2010 | —asop © [P.Sharma 700000 60 12.50 | 05-06-2008 | — 3509 7 [KS-Dhall 500000 nm Nutt [05-03-2008 | a9 ‘Answer the following questions. 1. Create the database LOANS, Ans. Mysql> Create Database LOANS; 2. Use the database LOANS. ‘Ans. Mysql> Use LOANS; 3. Create the table Loans and insert tuples in it. Ans Mysql>Create Table Loans (AccNo int primary key, Cust_Name varchar(30), Loan_Amount int, Instalment int Int_Rate number(5,3), Start_Date date, Interest number(7,2)) -Mysql> Insert into Loans values (1/RK. GUPTW,300000,36,12.0;2009-07-19'; 4. Display the details ofall the loans. Ans. Mysql> Select * from Loans; 5. Display the AccNo, Cust_Name, and Loan_Amount of all the loans. Ans. Mysql> Select AccNo,Cust_Name,Loan_Amount from Loan_Acc; 6. Display the details ofall te loans with less than 40 instalments. Ans. ‘Mysql> Select * from Loans where instalment <40; ‘Scanned with CamScanner= ery the AceNO and fe AccNo and Loan_ Am sly th Amount ofall the loans started before 01 POINT wsdl SEC AEENO, Loan_Armount om Looe ne hee wivete Start Date <2009-04.01; a. iply the tRat of al the loans started ater 01-04-2002 ‘Mysql Select Int Rate from Loans wi sos __ Muy Slet Fate fom eas where Sia. dte>'2009-005 ® splay the detalls ofall the loans whose rate of intrest is NULL 2 Mysa> Selec * fom Loans where ita fe NULL MF isply the deals of al the loans whose ate of interest NOT NULL os Masa Seect* Flom LOANS whore Int stels nt NUL: 11, cisly theamountsof various loans fom the able OANS.Aloanamountshouldappearonlyonce. ss. Mysab Select DISTINCT Loan_Amount fom LOANS; 12 Diplay the numberof instalments of various loans from the table LOANS. Am instalment should sppen only once. os. Mysql Select DISTINCT Instalment fom LOANS 13. Disply the detals ofall the loans started after 31-12-2008 for which the numberof instalments are moe than 36 os Mysal> Select * rom LOANS where Star_Date>'2008-12-31 and instalment>36; 14. Disply the detalls of all th loans inthe ascending order of thelr Loan_Amount ‘ins, _-Mysql> Select * from LOANS ORDER BY Loan_Amount; 15, Delete the records of ll the loans whose start date is before 2007. ‘es, Mysql> Delete From LOANS Where Year(Start_Date)<2007; 16. Delete the records ofall the loans of 'KP. Jan Jos, Mysql Delete From LOANS Where Cust_Name="P Jin’ 17. Add another column Category of type CHAR() in the Loan table. ‘ns, Mysql> Alter Table LOANS ADD\Category CHAR() Using Aggregate Functions 18. Display the sum of all Loan Amount whose Interest rateis greater than 10. fos, Mysal> Select sum(Loan_Amount) rom LOANS Where Interest >10; 18, splay the Maximum Interest from Loans table. Jos. Mysal> Select Matinterst fom LOANS: 2. Display the count of aloan holders whose name ends with Shara 405. Mya Select Count() from LOANS Where Cust Name Like Sharm 21 Display the count of all loan holders whose Interest is Null 4. Mysqt> Select Count frm LOANS Where Interests NUL: 2 bisplay the nterest-vise deal of Loan Account Holders os, ysl Selet* fom LOANS Group By Interest 23. spay the Interest-wise details of Loan Account Holders with atleast 10 stalments remaining As, yal select from LOANS Group By Interest Having Instalment>=10; 2 Dipayaheptevest ise count af al oan holders whose Intalment due s more than Sin each group. ‘ns, Mysals Select Count) from LOANS Group By Interest faving Instalment>s; ‘Scanned with CamScanner,25. Consider the EMP table and give the SQL statements for the following questions: EMP Si SS SE Da a ene 369_| SMITH. CLERK 16-12-1990 | 105000 | 20000 | 10 499_[ ANYA SALESMAN 20-02-1991 | 160000 | 20000 | 20 8566 _| MAHADEVAN | MANAGER (02-04-1991 | _ 2985.00 nuu_| 30 8654 | MOMIN ‘SALESMAN. 28-09-1991 | 125000 | 40000 | 20 '3698_[ BINA, MANAGER 5-01-1991 | 285000 | 25000 | 30 12882 _| SHIVANSH. MANAGER 09-06-1991 | 2450.00 nun_| 10 ‘e888 | SCOTT (ANALYST 09-12-1992 | 300000 | 15000 | 10 = AMIR PRESIDENT 7-11-1991 | 5000.00 wu | 20 ‘e844 KULDEEP SALESMAN 08-04-1992 | 1500.00 000 | 30) {@) Give the command to insert the record into the EMP table: Ang, insert into emp values(#369SMITH,/CLERK, 18-12-1990;1050,200,10; 1b) Write a query to display EmpName arid Sal of employees whose salary is areater than orequal t0 2200. ns. select empname, sal from emp where sal>=2200; {@) White a query to display details of employees who are not gettin ‘Ans, select * from emp where comm is NULL: (a) Waite 9 query to display employee name and salary of those ‘employees who don't have their salary in the range of 2500 to 4000, ‘Ans, select empname, sal from emP ‘Where sal not between 2500 and 4000: te) ite a query to display the name of employee whose name contains “ ‘ascending order of employee names: 19 commission. as thied alphabet in ‘Ans. select empname From emp Were empname like". -A%6" order by empnamet 1d commission of employees as (© Display the sum of salary an commission. [Ang select sal+comm As "To! (9) Show the average salary for all dearim ts al) From emp Group by aeptid Havind count 5: =Total Incentive" who are getting 1p where comm is NOT NULL: al Incentive” From er th more than § working people. ents wit Ans. select aval ‘Scanned with CamScanner(h) Ans. (i) Ans, 0 Ans. (ky Ans. wo Ans. (m) Ans. (n) Ans. (0) Ans. ® Ans. @ Ans. G) Ans. Display the distinct designation offered by the Organization. select distinct designation from emp; Display the names of employees who joined on or after 01/05/1991. Select empname From emp where DOJ>='1991/05/01'; Display the employee records in order by DOJ. select * From emp Order by DOJ; Display the maximum salary of employees in each Department. select max(sal) From emp Group by department; Update all the records as add ‘Mr.’ with EmpName. update emp set EmpName=concat('Mr,EmpName); Display the names of Employees who are working as salesman. select empname From EMP, where Designation = “Salesman”; Drop the emp table. drop table emp; Delete the records of all those employees who are working as clerk. delete from emp where designation="CLERK"; Increase the salary of manageis by 15%. update emp set sal= sal + 0.15*sal where designatio! Show details of employees who joined in the year 1991. select * from emp where year(DOJ)=1991; Delete the records of all those employees who are working as “SALESMAN” with salary-more than 1500. delete from emp where designation="SALESMAN" and sal>150¢ ‘Manager’; ‘Scanned with CamScanner,
You might also like
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Mark Manson
4/5 (6134)
Principles: Life and Work
From Everand
Principles: Life and Work
Ray Dalio
4/5 (627)
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Brene Brown
4/5 (1148)
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
Chris Voss
4.5/5 (935)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
4/5 (8215)
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Angela Duckworth
4/5 (631)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
4/5 (1253)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
4/5 (8365)
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Phil Knight
4.5/5 (860)
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Carmen Maria Machado
4/5 (877)
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Ben Horowitz
4.5/5 (361)
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
Margot Lee Shetterly
4/5 (954)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
4/5 (2923)
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
Ashlee Vance
4.5/5 (484)
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
Siddhartha Mukherjee
4.5/5 (277)
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Fredrik Backman
4.5/5 (4973)
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Frank McCourt
4.5/5 (444)
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
Colm Toibin
3.5/5 (2061)
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
Garth Stein
4/5 (4281)
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
Sarah M. Broom
4/5 (100)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
Meik Wiking
3.5/5 (447)
Yes Please
From Everand
Yes Please
Amy Poehler
4/5 (1988)
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Gilbert King
4.5/5 (278)
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Thomas L. Friedman
3.5/5 (2283)
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Roxane Gay
4/5 (1068)
The Outsider: A Novel
From Everand
The Outsider: A Novel
Stephen King
4/5 (1993)
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
Ruth Ware
3.5/5 (2641)
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
Betty Smith
4.5/5 (1936)
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
Viet Thanh Nguyen
4.5/5 (125)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Dave Eggers
3.5/5 (692)
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Doris Kearns Goodwin
4.5/5 (1912)
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
Hilary Mantel
4/5 (4074)
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Naomi Klein
4/5 (75)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
3.5/5 (830)
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Jennifer Egan
3.5/5 (901)
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Jay Sekulow
3.5/5 (143)
John Adams
From Everand
John Adams
David McCullough
4.5/5 (2544)
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
M L Stedman
4.5/5 (790)
DPP LimitsContinuityDifferentiability
PDF
No ratings yet
DPP LimitsContinuityDifferentiability
13 pages
DPP 32DifferentiationObjective
PDF
No ratings yet
DPP 32DifferentiationObjective
3 pages
Pandas Dataframe Notes
PDF
No ratings yet
Pandas Dataframe Notes
14 pages
Class 12 Project
PDF
No ratings yet
Class 12 Project
9 pages
Exercise-04 (B) : Subjective Level-Ii
PDF
No ratings yet
Exercise-04 (B) : Subjective Level-Ii
2 pages
Ray Optics & Optical Instruments, Home Work Sheet-1: Plane Mirror 1
PDF
No ratings yet
Ray Optics & Optical Instruments, Home Work Sheet-1: Plane Mirror 1
60 pages
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
George Packer
4/5 (45)
Little Women
From Everand
Little Women
Louisa May Alcott
4/5 (105)
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel
John le Carré
3.5/5 (109)