SlideShare a Scribd company logo
1 of 8
Table Loan_Accounts –
AccNo Cust_Name Loan_Amount Installments Int_Rate Start_Date
1 R.K. Gupta 300000 36 12.00 19-07-2009
2 S.P. Sharma 500000 45 10.00 22-03-2008
3 K.P. Jain 300000 36 NULL 08-03-2007
4 M.P. Yadav 800000 60 10.00 06-12-2008
5 S.P. Sinha 200000 36 12.50 03-01-2010
6 P. Sharma 700000 60 12.50 05-06-2008
7 K.S. Dhall 500000 48 NULL 05-03-2008
Write SQL commands for the tasks 1 to 35:
Create Database and use it
1. Create the database LOANS.
2. Use the database LOANS.
Create Table/Insert Into
3. Create the table Loan_Accounts and insert tuples in it.
Simple Select
4. Display the details of all the loans.
5. Display the AccNo, Cust_Name and Load_Amount of all the loans.
Conditional Select using Where Clause
6. Display the details of all the loans with less than 40 installments.
7. Display the AccNo and Loan_Amount of all the loans started before 01-04-2009.
8. Display the Int_Rate of all the loans started after 01-04-2009.
Using NULL
9. Display the details of all the loans whose rate of interest is NULL.
10. Display the details of all the loans whose rate of interest in not NULL.
Using DISTINCT Clause
11. Display the amounts of various loans from the table Loan_Accounts. A loan amount should
appear only once.
12. Display the number of installments of various loans from the table Loan_Accounts. An
installment should appear only once.
Using Logical Operators (NOT, AND, OR)
13. Display the details of all the loans started after 31-12-2008 for which the number of installments
are more than 36.
14. Display the Cust_Name and Loan_Amount for all the loans which do not have number of
installments 36.
15. Display the Cust_Name and Loan_Amount for all the loans for which the loan amont is less than
500000 or int_rate is more than 12.
16. Display the details of all the loans which started in the year 2009.
17. Display the details of all the loans whose Loan_Amount is in the range 400000 o 500000.
18. Display the details of all the loans whose rate of interest is in the range of 11% to 12%.
Using IN Operator
19. Display the Cust_Name and Loan_Amount for all the loans for which the number of installments
are 24, 36 or 48.
Using BETWEEN Operator
20. Display the details of all the loans whose Loan_Amount is in the range 400000 to 500000. (Using
BETWEEN Operator)
21. Display the details of all the loans whose rate of interest is in the range 11% to 12%. (Using
BETWEEN Operator)
Using LIKE Operator
22. Display the AccNo, Cust_Name and Loan_Amount for all the loans for which the Cust_Name
ends with ‘Sharma’.
23. Display the AccNo, Cust_Name and Loan_Amount for all the loans for which the Cust_Name
ends with ‘a’.
24. Display the AccNo, Cust_Name and Loan_Amount for all the loans for which the Cust_Name
contains ‘a’.
25. Display the AccNo, Cust_Name and Loan_Amount for all the loans for which the Cust_Name
does not contain ‘P’.
26. Display the AccNo, Cust_Name and Loan_Amount for all the loans for which the Cust_Name
contains ‘a’ as the second last character.
Using ORDER BY clause
27. Display the details of all the loans in the ascending order of their Loan_Amount.
28. Display the details of all the loans in the descending order of their Start_Date.
29. Display the details of all the loans in the ascending order of their Loan_Amount and within
Loan_Amount in the descending order of their Start_Date.
Using UPDATE, DELETE, ALTER TABLE
30. Put the interest rate 11.50% for all the loans for which interest rate is NULL.
31. Increase the interest rate by 0.5% for all the laons for which the loan amount is more than
400000.
32. For each loan replace Interest with (Loan_Amount*Int_Rate*Installments) 12*100.
33. Delete the records of all the loans whose Start_Date is before 2007.
34. Delete the records of all the loans of ‘K.P. Jain’.
35. Add another column Category of type CHAR(1) in the Loan table.
Students –
AdmNo Name Class Sec RNo Address Phone
1271 Utkarsh
Madaan
12 C 1 C-32,
Punjabi
Bagh
4356154
1324 Naresh
Sharma
10 A 1 31, Mohan
Nagar
435654
1325 Md. Yusuf 10 A 2 12/21,
Chand
Nagar
145654
1328 Sumedha 10 B 23 59, Moti
Nagar
4135654
1364 Subya
Akhtar
11 B 13 12, Janak
Puri
NULL
1434 Varuna 12 B 21 69, Rohini NULL
1461 David
DSouza
11 B 1 D-34, Model
Town
243554,
98787665
2324 Satinder
Singh
12 C 1 1/2,
Gulmohar
Park
143654
2328 Peter Jones 10 A 18 21/32B,
Vishal
Enclave
24356154
2371 Mohini
Mehta
11 C 12 37, Raja
Garden
435654,
6765787
Sports Table –
AdmNo Game CoachName Grade
1324 Cricket Narendra A
1364 Volley Ball M.P. Singh A
1271 Volley Ball M.P. Singh B
1434 Basket Ball I. Malhotra B
1461 Cricket Narendra B
2328 Basket Ball I. Malhotra A
2371 Basket Ball I. Malhotra A
1271 Basket Ball I. Malhotra A
1434 Cricket Narendra A
2328 Cricket Narendra B
1364 Basket Ball I. Malhotra B
Based on these tables write SQL statements for the following queries:
1. Display the lowest and the highest classes from the table STUDENTS.
2. Display the number of students in each class from the table STUDENTS.
3. Display the number of students in class 10.
4. Display details of the students of Cricket Team.
5. Display the Admission number, name, class, section and roll number of the students whose
grade in Sports table is ‘A’.
6. Display the name and phone number of the students of class 12 who play some game.
7. Display the number of students with each coach.
8. Display the names and phone numbers of the students whose grade is ‘A’ and whose coach is
Narendra.
Items Table –
I_Code Name Category Rate
1001 Masala Dosa South Indian 60
1002 Vada Sambhar South Indian 40
1003 Idli Sambhar South Indian 40
2001 Chowmein Chinese 80
2002 Dimsum Chinese 60
2003 Soup Chinese 50
3001 Pizza Italian 240
3002 Pasta Italian 125
Bills Table –
BillNo Date I_Code Qty
1 2013-04-01 1002 2
1 2013-04-01 3001 1
2 2013-04-01 1001 3
2 2013-04-01 1002 1
2 2013-04-01 2003 2
3 2013-04-02 2002 1
4 2013-04-02 2002 4
4 2013-04-02 2003 2
5 2013-04-03 2003 2
5 2013-04-03 3001 1
5 2013-04-03 3002 3
Based on these tables write SQL statements for the following queries:
1. Display the average rate of a South Indian item.
2. Display the number of items in each category.
3. Display the total quantity sold for each item.
4. Display total quantity of each item sold but don’t display this data for the items whose total
quantity sold is less than 3.
5. Display the details of bill records along with Name of each corresponding item.
6. Display the details of the bill records for which the item is ‘Dosa’.
7. Display the bill records for each Italian item sold.
8. Display the total value of items sold for each bill.
Create Tables on the basis of details given below and fill details into them then based on these tables
write SQL Statements for the following queries:
Vehicle Table –
Field Type Null Key Default
RegNo Char(10) No PRI
RegDate Date YES NULL
Owner Varchar(30) YES NULL
Address Varchar(50) YES NULL
Challan Table –
Field Type Null Key Default
Challan_No Int(11) No PRI 0
Ch_Date Date Yes NULL
RegNo Char(10) YES NULL
Offence Int(3) YES NULL
Offence Table –
Field Type Null Key Default
Offence_Code Int(3) NO PRI 0
Off_desc Varchar(30) YES NULL
Challan_Amt Int(4) Yes NULL
1. Display the dates of first registration and last registration from the table Vehicle.
2. Display the number of challans issued on each date.
3. Display the total number of challans issued for each offence.
4. Display the toal number of vehicles for which the 3rd
and 4th
characters of RegNo are ‘6C’.
5. Display the total value of challans issued for which the Off_Desc is ‘Driving without License’.
6. Display details of the challans issued on ‘2013-04-03’ along with Off_Desc for each challan.
7. Display the RegNo of all vehicles which have been challaned more than once.
8. Display details of each challan alongwith vehicle details, Off_desc, and Challan_Amt.
Empp Table –
No Name Salary Zone Age Grade Dept
1 Mukul 30000 West 28 A 10
2 Kritika 35000 Centre 30 A 10
3 Naveen 32000 West 40 20
4 Uday 38000 North 38 C 30
5 Nupur 32000 East 26 20
6 Moksh 37000 South 28 B 10
7 Shelly 36000 North 26 A 30
Dpmt Table –
Dept DName MinSal MaxSal HOD
10 Sales 25000 32000 1
20 Finance 30000 50000 5
30 Admin 25000 25000 7
Based on these tables write SQL statements for the following queries:
1. Display the details of all the employees who work in Sales department.
2. Display the Salary, Zone and Grade of all the employees whose HOD is Nupur.
3. Display the Name and Department Name of all the employees.
4. Display the names of all the employees whose salary is not within the specified range for the
corresponding department.
5. Display the name of the department and the name of the corresponding HOD for all the
departments.
12th information practices mysql practice questions

More Related Content

What's hot

Polymorphic Table Functions in 18c
Polymorphic Table Functions in 18cPolymorphic Table Functions in 18c
Polymorphic Table Functions in 18cAndrej Pashchenko
 
Sql queries questions and answers
Sql queries questions and answersSql queries questions and answers
Sql queries questions and answersMichael Belete
 
Nested Queries Lecture
Nested Queries LectureNested Queries Lecture
Nested Queries LectureFelipe Costa
 
SQL practice questions set - 2
SQL practice questions set - 2SQL practice questions set - 2
SQL practice questions set - 2Mohd Tousif
 
DBMS lab manual
DBMS lab manualDBMS lab manual
DBMS lab manualmaha tce
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFOum Saokosal
 
Pure virtual function and abstract class
Pure virtual function and abstract classPure virtual function and abstract class
Pure virtual function and abstract classAmit Trivedi
 
Database Normalization
Database NormalizationDatabase Normalization
Database NormalizationArun Sharma
 
80 different SQL Queries with output
80 different SQL Queries with output80 different SQL Queries with output
80 different SQL Queries with outputNexus
 
SQL Macros - Game Changing Feature for SQL Developers?
SQL Macros - Game Changing Feature for SQL Developers?SQL Macros - Game Changing Feature for SQL Developers?
SQL Macros - Game Changing Feature for SQL Developers?Andrej Pashchenko
 
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAINFP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAINSyahriha Ruslan
 
Normalization in SQL | Edureka
Normalization in SQL | EdurekaNormalization in SQL | Edureka
Normalization in SQL | EdurekaEdureka!
 
Restricting and Sorting Data - Oracle Data Base
Restricting and Sorting Data - Oracle Data BaseRestricting and Sorting Data - Oracle Data Base
Restricting and Sorting Data - Oracle Data BaseSalman Memon
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functionsMarlom46
 

What's hot (20)

Polymorphic Table Functions in 18c
Polymorphic Table Functions in 18cPolymorphic Table Functions in 18c
Polymorphic Table Functions in 18c
 
Sql queries questions and answers
Sql queries questions and answersSql queries questions and answers
Sql queries questions and answers
 
Nested Queries Lecture
Nested Queries LectureNested Queries Lecture
Nested Queries Lecture
 
SQL practice questions set - 2
SQL practice questions set - 2SQL practice questions set - 2
SQL practice questions set - 2
 
DBMS lab manual
DBMS lab manualDBMS lab manual
DBMS lab manual
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
 
Pure virtual function and abstract class
Pure virtual function and abstract classPure virtual function and abstract class
Pure virtual function and abstract class
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
All questions
All questionsAll questions
All questions
 
80 different SQL Queries with output
80 different SQL Queries with output80 different SQL Queries with output
80 different SQL Queries with output
 
SQL Macros - Game Changing Feature for SQL Developers?
SQL Macros - Game Changing Feature for SQL Developers?SQL Macros - Game Changing Feature for SQL Developers?
SQL Macros - Game Changing Feature for SQL Developers?
 
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAINFP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
 
Sql joins
Sql joinsSql joins
Sql joins
 
Normalization in SQL | Edureka
Normalization in SQL | EdurekaNormalization in SQL | Edureka
Normalization in SQL | Edureka
 
User defined Function in SQL
User defined Function in SQLUser defined Function in SQL
User defined Function in SQL
 
Restricting and Sorting Data - Oracle Data Base
Restricting and Sorting Data - Oracle Data BaseRestricting and Sorting Data - Oracle Data Base
Restricting and Sorting Data - Oracle Data Base
 
Sql subquery
Sql  subquerySql  subquery
Sql subquery
 
Oracle Sql & PLSQL Complete guide
Oracle Sql & PLSQL Complete guideOracle Sql & PLSQL Complete guide
Oracle Sql & PLSQL Complete guide
 
Mysql joins
Mysql joinsMysql joins
Mysql joins
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
 

Viewers also liked

Simple class and object examples in java
Simple class and object examples in javaSimple class and object examples in java
Simple class and object examples in javaHarish Gyanani
 
Basics of file handling
Basics of file handlingBasics of file handling
Basics of file handlingpinkpreet_kaur
 
Difference between switch and ladder if
Difference between switch and ladder ifDifference between switch and ladder if
Difference between switch and ladder ifHarish Gyanani
 
Inline functions in c++
Inline functions in c++Inline functions in c++
Inline functions in c++Harish Gyanani
 
Sql like operator examples
Sql like operator examplesSql like operator examples
Sql like operator examplesHarish Gyanani
 
12th ip CBSE chapter 4 oop in java notes complete
12th ip CBSE  chapter 4 oop in java notes complete12th ip CBSE  chapter 4 oop in java notes complete
12th ip CBSE chapter 4 oop in java notes completeHarish Gyanani
 
Learn How to create pyramids in c
Learn How to create pyramids in cLearn How to create pyramids in c
Learn How to create pyramids in cHarish Gyanani
 
100 images for visual brainstorming
100 images for visual brainstorming100 images for visual brainstorming
100 images for visual brainstormingMarc Heleven
 

Viewers also liked (8)

Simple class and object examples in java
Simple class and object examples in javaSimple class and object examples in java
Simple class and object examples in java
 
Basics of file handling
Basics of file handlingBasics of file handling
Basics of file handling
 
Difference between switch and ladder if
Difference between switch and ladder ifDifference between switch and ladder if
Difference between switch and ladder if
 
Inline functions in c++
Inline functions in c++Inline functions in c++
Inline functions in c++
 
Sql like operator examples
Sql like operator examplesSql like operator examples
Sql like operator examples
 
12th ip CBSE chapter 4 oop in java notes complete
12th ip CBSE  chapter 4 oop in java notes complete12th ip CBSE  chapter 4 oop in java notes complete
12th ip CBSE chapter 4 oop in java notes complete
 
Learn How to create pyramids in c
Learn How to create pyramids in cLearn How to create pyramids in c
Learn How to create pyramids in c
 
100 images for visual brainstorming
100 images for visual brainstorming100 images for visual brainstorming
100 images for visual brainstorming
 

Similar to 12th information practices mysql practice questions

SQL practice questions set
SQL practice questions setSQL practice questions set
SQL practice questions setMohd Tousif
 
Introduction to Databases - Assignment_1
Introduction to Databases - Assignment_1Introduction to Databases - Assignment_1
Introduction to Databases - Assignment_1Mohd Tousif
 
DBMS 5 | MySQL Practice List - HR Schema
DBMS 5 | MySQL Practice List - HR SchemaDBMS 5 | MySQL Practice List - HR Schema
DBMS 5 | MySQL Practice List - HR SchemaMohammad Imam Hossain
 
SQL Practice Question set
SQL Practice Question set SQL Practice Question set
SQL Practice Question set Mohd Tousif
 
MASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docx
MASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docxMASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docx
MASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docxalfredacavx97
 
MASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docx
MASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docxMASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docx
MASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docxendawalling
 
Grading sheet major assignment 2 grading sheetcompetencyrequirement
Grading sheet major assignment 2 grading sheetcompetencyrequirementGrading sheet major assignment 2 grading sheetcompetencyrequirement
Grading sheet major assignment 2 grading sheetcompetencyrequirementoreo10
 
Final Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docx
Final Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docxFinal Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docx
Final Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docxcharlottej5
 
Final Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docx
Final Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docxFinal Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docx
Final Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docxlmelaine
 
Bis 345-final-exam-guide-set-1-new
Bis 345-final-exam-guide-set-1-newBis 345-final-exam-guide-set-1-new
Bis 345-final-exam-guide-set-1-newassignmentcloud85
 

Similar to 12th information practices mysql practice questions (20)

Mysqlbyjp
MysqlbyjpMysqlbyjp
Mysqlbyjp
 
SQL practice questions set
SQL practice questions setSQL practice questions set
SQL practice questions set
 
Introduction to Databases - Assignment_1
Introduction to Databases - Assignment_1Introduction to Databases - Assignment_1
Introduction to Databases - Assignment_1
 
DBMS 5 | MySQL Practice List - HR Schema
DBMS 5 | MySQL Practice List - HR SchemaDBMS 5 | MySQL Practice List - HR Schema
DBMS 5 | MySQL Practice List - HR Schema
 
SQL Practice Question set
SQL Practice Question set SQL Practice Question set
SQL Practice Question set
 
MASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docx
MASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docxMASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docx
MASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docx
 
MASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docx
MASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docxMASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docx
MASTER OF EARLY CHILDHOOD STUDIESCompetency Based LearningCh.docx
 
Sql Queries
Sql QueriesSql Queries
Sql Queries
 
Case study
Case studyCase study
Case study
 
Excel assignment
Excel assignmentExcel assignment
Excel assignment
 
Excel assignment
Excel assignmentExcel assignment
Excel assignment
 
LCC Asia Pacific_financialmodelling_excelshortcuts1
LCC Asia Pacific_financialmodelling_excelshortcuts1LCC Asia Pacific_financialmodelling_excelshortcuts1
LCC Asia Pacific_financialmodelling_excelshortcuts1
 
Grading sheet major assignment 2 grading sheetcompetencyrequirement
Grading sheet major assignment 2 grading sheetcompetencyrequirementGrading sheet major assignment 2 grading sheetcompetencyrequirement
Grading sheet major assignment 2 grading sheetcompetencyrequirement
 
Sql wksht-5
Sql wksht-5Sql wksht-5
Sql wksht-5
 
Final Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docx
Final Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docxFinal Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docx
Final Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docx
 
Final Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docx
Final Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docxFinal Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docx
Final Exam, Introductory Macroeconomics (Econ 2) Winter 2019.docx
 
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
 
Bis 345-final-exam-guide-set-1-new
Bis 345-final-exam-guide-set-1-newBis 345-final-exam-guide-set-1-new
Bis 345-final-exam-guide-set-1-new
 
Ar user guide
Ar user guideAr user guide
Ar user guide
 
Exercise 1.docx
Exercise 1.docxExercise 1.docx
Exercise 1.docx
 

Recently uploaded

ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 

Recently uploaded (20)

ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 

12th information practices mysql practice questions

  • 1. Table Loan_Accounts – AccNo Cust_Name Loan_Amount Installments Int_Rate Start_Date 1 R.K. Gupta 300000 36 12.00 19-07-2009 2 S.P. Sharma 500000 45 10.00 22-03-2008 3 K.P. Jain 300000 36 NULL 08-03-2007 4 M.P. Yadav 800000 60 10.00 06-12-2008 5 S.P. Sinha 200000 36 12.50 03-01-2010 6 P. Sharma 700000 60 12.50 05-06-2008 7 K.S. Dhall 500000 48 NULL 05-03-2008 Write SQL commands for the tasks 1 to 35: Create Database and use it 1. Create the database LOANS. 2. Use the database LOANS. Create Table/Insert Into 3. Create the table Loan_Accounts and insert tuples in it. Simple Select 4. Display the details of all the loans. 5. Display the AccNo, Cust_Name and Load_Amount of all the loans. Conditional Select using Where Clause 6. Display the details of all the loans with less than 40 installments. 7. Display the AccNo and Loan_Amount of all the loans started before 01-04-2009. 8. Display the Int_Rate of all the loans started after 01-04-2009. Using NULL 9. Display the details of all the loans whose rate of interest is NULL. 10. Display the details of all the loans whose rate of interest in not NULL. Using DISTINCT Clause 11. Display the amounts of various loans from the table Loan_Accounts. A loan amount should appear only once. 12. Display the number of installments of various loans from the table Loan_Accounts. An installment should appear only once.
  • 2. Using Logical Operators (NOT, AND, OR) 13. Display the details of all the loans started after 31-12-2008 for which the number of installments are more than 36. 14. Display the Cust_Name and Loan_Amount for all the loans which do not have number of installments 36. 15. Display the Cust_Name and Loan_Amount for all the loans for which the loan amont is less than 500000 or int_rate is more than 12. 16. Display the details of all the loans which started in the year 2009. 17. Display the details of all the loans whose Loan_Amount is in the range 400000 o 500000. 18. Display the details of all the loans whose rate of interest is in the range of 11% to 12%. Using IN Operator 19. Display the Cust_Name and Loan_Amount for all the loans for which the number of installments are 24, 36 or 48. Using BETWEEN Operator 20. Display the details of all the loans whose Loan_Amount is in the range 400000 to 500000. (Using BETWEEN Operator) 21. Display the details of all the loans whose rate of interest is in the range 11% to 12%. (Using BETWEEN Operator) Using LIKE Operator 22. Display the AccNo, Cust_Name and Loan_Amount for all the loans for which the Cust_Name ends with ‘Sharma’. 23. Display the AccNo, Cust_Name and Loan_Amount for all the loans for which the Cust_Name ends with ‘a’. 24. Display the AccNo, Cust_Name and Loan_Amount for all the loans for which the Cust_Name contains ‘a’. 25. Display the AccNo, Cust_Name and Loan_Amount for all the loans for which the Cust_Name does not contain ‘P’. 26. Display the AccNo, Cust_Name and Loan_Amount for all the loans for which the Cust_Name contains ‘a’ as the second last character. Using ORDER BY clause 27. Display the details of all the loans in the ascending order of their Loan_Amount. 28. Display the details of all the loans in the descending order of their Start_Date. 29. Display the details of all the loans in the ascending order of their Loan_Amount and within Loan_Amount in the descending order of their Start_Date.
  • 3. Using UPDATE, DELETE, ALTER TABLE 30. Put the interest rate 11.50% for all the loans for which interest rate is NULL. 31. Increase the interest rate by 0.5% for all the laons for which the loan amount is more than 400000. 32. For each loan replace Interest with (Loan_Amount*Int_Rate*Installments) 12*100. 33. Delete the records of all the loans whose Start_Date is before 2007. 34. Delete the records of all the loans of ‘K.P. Jain’. 35. Add another column Category of type CHAR(1) in the Loan table.
  • 4. Students – AdmNo Name Class Sec RNo Address Phone 1271 Utkarsh Madaan 12 C 1 C-32, Punjabi Bagh 4356154 1324 Naresh Sharma 10 A 1 31, Mohan Nagar 435654 1325 Md. Yusuf 10 A 2 12/21, Chand Nagar 145654 1328 Sumedha 10 B 23 59, Moti Nagar 4135654 1364 Subya Akhtar 11 B 13 12, Janak Puri NULL 1434 Varuna 12 B 21 69, Rohini NULL 1461 David DSouza 11 B 1 D-34, Model Town 243554, 98787665 2324 Satinder Singh 12 C 1 1/2, Gulmohar Park 143654 2328 Peter Jones 10 A 18 21/32B, Vishal Enclave 24356154 2371 Mohini Mehta 11 C 12 37, Raja Garden 435654, 6765787 Sports Table – AdmNo Game CoachName Grade 1324 Cricket Narendra A 1364 Volley Ball M.P. Singh A 1271 Volley Ball M.P. Singh B 1434 Basket Ball I. Malhotra B 1461 Cricket Narendra B 2328 Basket Ball I. Malhotra A 2371 Basket Ball I. Malhotra A 1271 Basket Ball I. Malhotra A 1434 Cricket Narendra A 2328 Cricket Narendra B 1364 Basket Ball I. Malhotra B
  • 5. Based on these tables write SQL statements for the following queries: 1. Display the lowest and the highest classes from the table STUDENTS. 2. Display the number of students in each class from the table STUDENTS. 3. Display the number of students in class 10. 4. Display details of the students of Cricket Team. 5. Display the Admission number, name, class, section and roll number of the students whose grade in Sports table is ‘A’. 6. Display the name and phone number of the students of class 12 who play some game. 7. Display the number of students with each coach. 8. Display the names and phone numbers of the students whose grade is ‘A’ and whose coach is Narendra. Items Table – I_Code Name Category Rate 1001 Masala Dosa South Indian 60 1002 Vada Sambhar South Indian 40 1003 Idli Sambhar South Indian 40 2001 Chowmein Chinese 80 2002 Dimsum Chinese 60 2003 Soup Chinese 50 3001 Pizza Italian 240 3002 Pasta Italian 125 Bills Table – BillNo Date I_Code Qty 1 2013-04-01 1002 2 1 2013-04-01 3001 1 2 2013-04-01 1001 3 2 2013-04-01 1002 1 2 2013-04-01 2003 2 3 2013-04-02 2002 1 4 2013-04-02 2002 4 4 2013-04-02 2003 2 5 2013-04-03 2003 2 5 2013-04-03 3001 1 5 2013-04-03 3002 3
  • 6. Based on these tables write SQL statements for the following queries: 1. Display the average rate of a South Indian item. 2. Display the number of items in each category. 3. Display the total quantity sold for each item. 4. Display total quantity of each item sold but don’t display this data for the items whose total quantity sold is less than 3. 5. Display the details of bill records along with Name of each corresponding item. 6. Display the details of the bill records for which the item is ‘Dosa’. 7. Display the bill records for each Italian item sold. 8. Display the total value of items sold for each bill. Create Tables on the basis of details given below and fill details into them then based on these tables write SQL Statements for the following queries: Vehicle Table – Field Type Null Key Default RegNo Char(10) No PRI RegDate Date YES NULL Owner Varchar(30) YES NULL Address Varchar(50) YES NULL Challan Table – Field Type Null Key Default Challan_No Int(11) No PRI 0 Ch_Date Date Yes NULL RegNo Char(10) YES NULL Offence Int(3) YES NULL Offence Table – Field Type Null Key Default Offence_Code Int(3) NO PRI 0 Off_desc Varchar(30) YES NULL Challan_Amt Int(4) Yes NULL
  • 7. 1. Display the dates of first registration and last registration from the table Vehicle. 2. Display the number of challans issued on each date. 3. Display the total number of challans issued for each offence. 4. Display the toal number of vehicles for which the 3rd and 4th characters of RegNo are ‘6C’. 5. Display the total value of challans issued for which the Off_Desc is ‘Driving without License’. 6. Display details of the challans issued on ‘2013-04-03’ along with Off_Desc for each challan. 7. Display the RegNo of all vehicles which have been challaned more than once. 8. Display details of each challan alongwith vehicle details, Off_desc, and Challan_Amt. Empp Table – No Name Salary Zone Age Grade Dept 1 Mukul 30000 West 28 A 10 2 Kritika 35000 Centre 30 A 10 3 Naveen 32000 West 40 20 4 Uday 38000 North 38 C 30 5 Nupur 32000 East 26 20 6 Moksh 37000 South 28 B 10 7 Shelly 36000 North 26 A 30 Dpmt Table – Dept DName MinSal MaxSal HOD 10 Sales 25000 32000 1 20 Finance 30000 50000 5 30 Admin 25000 25000 7 Based on these tables write SQL statements for the following queries: 1. Display the details of all the employees who work in Sales department. 2. Display the Salary, Zone and Grade of all the employees whose HOD is Nupur. 3. Display the Name and Department Name of all the employees. 4. Display the names of all the employees whose salary is not within the specified range for the corresponding department. 5. Display the name of the department and the name of the corresponding HOD for all the departments.