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)
113 views
MySQL Practicals
Uploaded by
venkat krishnan
AI-enhanced title
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
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)
113 views
MySQL Practicals
Uploaded by
venkat krishnan
AI-enhanced title
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
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
MySql Queries
PDF
No ratings yet
MySql Queries
9 pages
All Oracle SQL Questions and Answers
PDF
100% (2)
All Oracle SQL Questions and Answers
32 pages
Mysql-Asg 1 Ques-Loan
PDF
No ratings yet
Mysql-Asg 1 Ques-Loan
3 pages
Lab Answers
PDF
No ratings yet
Lab Answers
21 pages
2021 Ict 45
PDF
No ratings yet
2021 Ict 45
9 pages
Index: Prac. No Date of Experiment Prac. Name
PDF
No ratings yet
Index: Prac. No Date of Experiment Prac. Name
25 pages
Abir Chakraborty - 22312204
PDF
No ratings yet
Abir Chakraborty - 22312204
26 pages
S Q L - Notes
PDF
78% (9)
S Q L - Notes
25 pages
SQL Exercises
PDF
No ratings yet
SQL Exercises
15 pages
Oracle
PDF
No ratings yet
Oracle
16 pages
SQL Programs for Record Book
PDF
No ratings yet
SQL Programs for Record Book
6 pages
Some Python SQL Queries
PDF
No ratings yet
Some Python SQL Queries
4 pages
1,2,3,4
PDF
No ratings yet
1,2,3,4
15 pages
Menu - 634641184925996250 - CS4106 Database Management Systems Lab Assignment
PDF
0% (1)
Menu - 634641184925996250 - CS4106 Database Management Systems Lab Assignment
5 pages
SQLQUERI
PDF
No ratings yet
SQLQUERI
8 pages
Creating Database
PDF
No ratings yet
Creating Database
52 pages
SQL Record Questions(XII CS)
PDF
No ratings yet
SQL Record Questions(XII CS)
9 pages
Dbms Lab Note
PDF
No ratings yet
Dbms Lab Note
4 pages
Ch8 XII Solutions
PDF
No ratings yet
Ch8 XII Solutions
7 pages
Dbms Assignment
PDF
No ratings yet
Dbms Assignment
73 pages
Practicals
PDF
No ratings yet
Practicals
31 pages
SQL Lab Record1
PDF
No ratings yet
SQL Lab Record1
8 pages
DBMS LAB Assignment 1new
PDF
No ratings yet
DBMS LAB Assignment 1new
12 pages
MYSQL PRACTICAL FILE ASSIGNMENT
PDF
No ratings yet
MYSQL PRACTICAL FILE ASSIGNMENT
6 pages
Exercise - Employee Databasee
PDF
No ratings yet
Exercise - Employee Databasee
19 pages
Screenshot 2024-11-10 at 1.06.21 PM
PDF
No ratings yet
Screenshot 2024-11-10 at 1.06.21 PM
29 pages
DBMS 5Q
PDF
No ratings yet
DBMS 5Q
10 pages
Class XI Practical Assignment Mysql
PDF
33% (3)
Class XI Practical Assignment Mysql
6 pages
All Assignments
PDF
No ratings yet
All Assignments
104 pages
dbms sql (1)
PDF
No ratings yet
dbms sql (1)
34 pages
BA630 - SQL Assignment - Fa20
PDF
No ratings yet
BA630 - SQL Assignment - Fa20
14 pages
sql interview question for diploma
PDF
No ratings yet
sql interview question for diploma
3 pages
CE246 DBMS Practical List
PDF
0% (1)
CE246 DBMS Practical List
10 pages
CS Assignment
PDF
No ratings yet
CS Assignment
2 pages
083 Anshika Jain Ism Practical File
PDF
No ratings yet
083 Anshika Jain Ism Practical File
77 pages
AD3391 LAB EXERCISE
PDF
No ratings yet
AD3391 LAB EXERCISE
10 pages
Practical Material (Database System)
PDF
No ratings yet
Practical Material (Database System)
11 pages
Delhi Public School, GBN: SESSION 2022-23 Summer Holiday Homework
PDF
No ratings yet
Delhi Public School, GBN: SESSION 2022-23 Summer Holiday Homework
2 pages
DBMS Aggignment Manual
PDF
No ratings yet
DBMS Aggignment Manual
12 pages
QuestionBank LabPractcals
PDF
No ratings yet
QuestionBank LabPractcals
12 pages
SQL 3
PDF
0% (1)
SQL 3
7 pages
MCQs of MySQL
PDF
No ratings yet
MCQs of MySQL
3 pages
Practice Question CHP 2
PDF
No ratings yet
Practice Question CHP 2
6 pages
Dbms Lab
PDF
No ratings yet
Dbms Lab
37 pages
Top 50 SQL Questions
PDF
No ratings yet
Top 50 SQL Questions
15 pages
SQL Queries
PDF
No ratings yet
SQL Queries
27 pages
Simple Queries in SQL: Sample Database
PDF
No ratings yet
Simple Queries in SQL: Sample Database
34 pages
SQL Assignements
PDF
No ratings yet
SQL Assignements
5 pages
MYSQL Assignments
PDF
No ratings yet
MYSQL Assignments
39 pages
Extra Queries
PDF
No ratings yet
Extra Queries
17 pages
ADBMS Lab SachinBhardwaj
PDF
No ratings yet
ADBMS Lab SachinBhardwaj
29 pages
SQL Questions
PDF
No ratings yet
SQL Questions
19 pages
DBMS Lab
PDF
No ratings yet
DBMS Lab
19 pages
PU DBMS Parctical - 2019
PDF
No ratings yet
PU DBMS Parctical - 2019
5 pages
Dbms Lab Manual
PDF
No ratings yet
Dbms Lab Manual
17 pages
ISM file
PDF
No ratings yet
ISM file
16 pages
Create A Database by The Name Akcbus
PDF
No ratings yet
Create A Database by The Name Akcbus
5 pages
S.I.E.S College of Commerce and Economics: Laboratory Journal
PDF
No ratings yet
S.I.E.S College of Commerce and Economics: Laboratory Journal
56 pages
18bit0166 Ayush Kanaujia
PDF
No ratings yet
18bit0166 Ayush Kanaujia
12 pages
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