SlideShare a Scribd company logo
Sample Table – Worker
WORKER_IDFIRST_NAMELAST_NAME SALARY JOINING_DATE DEPARTMENT
001 Monika Arora 100000 2014-02-20 09:00:00 HR
002 Niharika Verma 80000 2014-06-11 09:00:00 Admin
003 Vishal Singhal 300000 2014-02-20 09:00:00 HR
004 Amitabh Singh 500000 2014-02-20 09:00:00 Admin
005 Vivek Bhati 500000 2014-06-11 09:00:00 Admin
006 Vipul Diwan 200000 2014-06-11 09:00:00 Account
007 Satish Kumar 75000 2014-01-20 09:00:00 Account
008 Geetika Chauhan 90000 2014-04-11 09:00:00 Admin
Sample Table – Bonus
WORKER_REF_ID BONUS_DATE BONUS_AMOUNT
1 2016-02-20
00:00:00
5000
2 2016-06-11
00:00:00
3000
3 2016-02-20
00:00:00
4000
1 2016-02-20
00:00:00
4500
2 2016-06-11
00:00:00
3500
Sample Table – Title
WORKER_REF_ID WORKER_TITLE AFFECTED_FROM
1 Manager 2016-02-20 00:00:00
2 Executive 2016-06-11 00:00:00
8 Executive 2016-06-11 00:00:00
5 Manager 2016-06-11 00:00:00
4 Asst. Manager 2016-06-11 00:00:00
7 Executive 2016-06-11 00:00:00
6 Lead 2016-06-11 00:00:00
3 Lead 2016-06-11 00:00:00
Perform Following Task
1. Create Tables and Insert data (First data using Insert query rest can be feeded.)
2. Write an SQL query to print details of the Workers whose FIRST_NAME ends with
‘h’ and contains six alphabets.
3. Change Last_Name Columns name to Surname.
4. Write an SQL query to print details of the Workers whose SALARY lies between
100000 and 500000.
5. Write an SQL query to fetch the count of employees working in the department
‘Admin’.
6. Write an SQL query to fetch the no. of workers for each department in the
descending order.
7. Write an SQL query to print details of the Workers who are also Managers.
8. Select Top 10 salaries and Employees Full name from Worker table.
9. Write an SQL query to fetch the list of employees with the same salary.
Question-1. Create Tables and Insert data (First data using Insert query rest can be
feeded.)
Answer 1.
CREATE TABLE WORKER(
WORKER_ID NUMBER(4),
FIRST_NAME VARCHAR2(10),
LAST_NAME VARCHAR2(10),
SALARY NUMBER(10),
JOINING_DATE TIMESTAMP ,
DEPARTMENT VARCHAR2(10));
insert into worker(Worker_id,first_name,last_name,salary,joining_date,department)
values(worker_seq.nextval,'Monika','Arora',100000,TIMESTAMP '2014-02-20
09:00:00','HR');
insert into worker(Worker_id,first_name,last_name,salary,joining_date,department)
values(worker_seq.nextval,'Niharika','Verma',80000,TIMESTAMP '2014-06-11
09:00:00','Admin');
insert into worker(Worker_id,first_name,last_name,salary,joining_date,department)
values(worker_seq.nextval,'Vishal','Singhal',300000,TIMESTAMP '2014-02-20
09:00:00','HR');
insert into worker(Worker_id,first_name,last_name,salary,joining_date,department)
values(worker_seq.nextval,'Amitabh','Singh',500000,TIMESTAMP '2014-02-20
09:00:00','Admin');
insert into worker(Worker_id,first_name,last_name,salary,joining_date,department)
values(worker_seq.nextval,'Vivek','Bhati',500000,TIMESTAMP '2014-06-11
09:00:00','Admin');
insert into worker(Worker_id,first_name,last_name,salary,joining_date,department)
values(worker_seq.nextval,'Vipul','Diwan',200000,TIMESTAMP '2014-06-11
09:00:00','Acount');
insert into worker(Worker_id,first_name,last_name,salary,joining_date,department)
values(worker_seq.nextval,'Satish','Kumar',75000,TIMESTAMP '2014-01-20
09:00:00','Acount');
insert into worker(Worker_id,first_name,last_name,salary,joining_date,department)
values(worker_seq.nextval,'Geetika','Chauhan',90000,TIMESTAMP '2014-04-11
09:00:00','Admin');
Question-2:- Write an SQL query to print details of the Workers whose FIRST_NAME
ends with ‘h’ and contains six alphabets.
Answer-2:-
Select * from Worker where FIRST_NAME like '_____h';
Question-3:- Change Last_Name Columns name to Surname.
Answer-3:- ALTER TABLE Worker RENAME COLUMN Last_name TO Surname;
Question-4:-. Write an SQL query to print details of the Workers whose SALARY lies
between 100000 and 500000.
Answer-4:- select * from worker where salary between 100000 and 500000;
Queston-5:- Write an SQL query to fetch the count of employees working in the department
‘Admin’.
Answer-5:-
select count (*) from worker where department ='Admin';
Question-6:- Write an SQL query to fetch the no. of workers for each department in the
descending order
Answer-6:-
SELECT DEPARTMENT, count(WORKER_ID) No_Of_Workers
FROM worker
GROUP BY DEPARTMENT
ORDER BY No_Of_Workers DESC;
Question-7:- Write an SQL query to print details of the Workers who are also Managers.
Answer-7:-
SELECT DISTINCT W.FIRST_NAME, T.WORKER_TITLE
FROM Worker W
INNER JOIN Title T
ON W.WORKER_ID = T.WORKER_REF_ID
AND T.WORKER_TITLE in ('Manager');
Question-8:- Select Top 10 salaries and Employees Full name from Worker table.
Answer-8:-
SELECT * FROM (SELECT * FROM Worker ORDER BY Salary
DESC)
WHERE ROW NUM <= 10;
Question-9:- Write an SQL query to fetch the list of employees with the same salary.
Answer-9:-
Select distinct W.WORKER_ID, W.FIRST_NAME, W.Salary
from Worker W, Worker W1
where W.Salary = W1.Salary
and W.WORKER_ID != W1.WORKER_ID;
Important dbms practical  question
Ad

More Related Content

Similar to Important dbms practical question (20)

Apurv Gupta, BCA ,Final year , Dezyne E'cole College
 Apurv Gupta, BCA ,Final year , Dezyne E'cole College Apurv Gupta, BCA ,Final year , Dezyne E'cole College
Apurv Gupta, BCA ,Final year , Dezyne E'cole College
dezyneecole
 
SQL Top 10 Interview QnA By Rishabh Mishra in Hindi.pdf
SQL Top 10 Interview QnA By Rishabh Mishra in Hindi.pdfSQL Top 10 Interview QnA By Rishabh Mishra in Hindi.pdf
SQL Top 10 Interview QnA By Rishabh Mishra in Hindi.pdf
SudhanshuPandey222889
 
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole College
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole CollegeDivyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole College
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole College
dezyneecole
 
Pooja Bijawat,Bachelor Degree in Computer Application
Pooja Bijawat,Bachelor Degree in Computer ApplicationPooja Bijawat,Bachelor Degree in Computer Application
Pooja Bijawat,Bachelor Degree in Computer Application
dezyneecole
 
Simran kaur,BCA Final Year 2015
Simran kaur,BCA Final Year 2015Simran kaur,BCA Final Year 2015
Simran kaur,BCA Final Year 2015
dezyneecole
 
Nikhil Khandelwal BCA 3rd Year
Nikhil Khandelwal BCA 3rd YearNikhil Khandelwal BCA 3rd Year
Nikhil Khandelwal BCA 3rd Year
dezyneecole
 
Sql Queries
Sql QueriesSql Queries
Sql Queries
User1test
 
BIS05 Introduction to SQL
BIS05 Introduction to SQLBIS05 Introduction to SQL
BIS05 Introduction to SQL
Prithwis Mukerjee
 
Complex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptxComplex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptx
metriohanzel
 
DBMS Lab
DBMS LabDBMS Lab
DBMS Lab
Neil Mathew
 
Employ leave dtb
Employ leave dtbEmploy leave dtb
Employ leave dtb
rajnish kumar
 
1- Return the names- IDS- and average salary of the top 10 employees w.docx
1- Return the names- IDS- and average salary of the top 10 employees w.docx1- Return the names- IDS- and average salary of the top 10 employees w.docx
1- Return the names- IDS- and average salary of the top 10 employees w.docx
todd991
 
DBMS Notes selection projection aggregate
DBMS Notes selection projection aggregateDBMS Notes selection projection aggregate
DBMS Notes selection projection aggregate
Sreedhar Chowdam
 
Exercise 1.docx
Exercise 1.docxExercise 1.docx
Exercise 1.docx
TitaTressid
 
Labexer9
Labexer9Labexer9
Labexer9
ANURAG VIJ
 
On SQL Managment studioThis lab is all about database normalizatio.pdf
On SQL Managment studioThis lab is all about database normalizatio.pdfOn SQL Managment studioThis lab is all about database normalizatio.pdf
On SQL Managment studioThis lab is all about database normalizatio.pdf
infomalad
 
RELATIONAL DATABASES & Database designCIS276EmployeeNumFir.docx
RELATIONAL DATABASES & Database designCIS276EmployeeNumFir.docxRELATIONAL DATABASES & Database designCIS276EmployeeNumFir.docx
RELATIONAL DATABASES & Database designCIS276EmployeeNumFir.docx
sodhi3
 
Database Concepts Team Project.pptx
Database Concepts Team Project.pptxDatabase Concepts Team Project.pptx
Database Concepts Team Project.pptx
LizSmith823201
 
SQL practice questions - set 3
SQL practice questions - set 3SQL practice questions - set 3
SQL practice questions - set 3
Mohd Tousif
 
SQL BASIC QUERIES
SQL  BASIC QUERIES SQL  BASIC QUERIES
SQL BASIC QUERIES
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Apurv Gupta, BCA ,Final year , Dezyne E'cole College
 Apurv Gupta, BCA ,Final year , Dezyne E'cole College Apurv Gupta, BCA ,Final year , Dezyne E'cole College
Apurv Gupta, BCA ,Final year , Dezyne E'cole College
dezyneecole
 
SQL Top 10 Interview QnA By Rishabh Mishra in Hindi.pdf
SQL Top 10 Interview QnA By Rishabh Mishra in Hindi.pdfSQL Top 10 Interview QnA By Rishabh Mishra in Hindi.pdf
SQL Top 10 Interview QnA By Rishabh Mishra in Hindi.pdf
SudhanshuPandey222889
 
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole College
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole CollegeDivyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole College
Divyansh Mehta,BCA Final Year 2015 ,Dezyne E'cole College
dezyneecole
 
Pooja Bijawat,Bachelor Degree in Computer Application
Pooja Bijawat,Bachelor Degree in Computer ApplicationPooja Bijawat,Bachelor Degree in Computer Application
Pooja Bijawat,Bachelor Degree in Computer Application
dezyneecole
 
Simran kaur,BCA Final Year 2015
Simran kaur,BCA Final Year 2015Simran kaur,BCA Final Year 2015
Simran kaur,BCA Final Year 2015
dezyneecole
 
Nikhil Khandelwal BCA 3rd Year
Nikhil Khandelwal BCA 3rd YearNikhil Khandelwal BCA 3rd Year
Nikhil Khandelwal BCA 3rd Year
dezyneecole
 
Complex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptxComplex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptx
metriohanzel
 
1- Return the names- IDS- and average salary of the top 10 employees w.docx
1- Return the names- IDS- and average salary of the top 10 employees w.docx1- Return the names- IDS- and average salary of the top 10 employees w.docx
1- Return the names- IDS- and average salary of the top 10 employees w.docx
todd991
 
DBMS Notes selection projection aggregate
DBMS Notes selection projection aggregateDBMS Notes selection projection aggregate
DBMS Notes selection projection aggregate
Sreedhar Chowdam
 
On SQL Managment studioThis lab is all about database normalizatio.pdf
On SQL Managment studioThis lab is all about database normalizatio.pdfOn SQL Managment studioThis lab is all about database normalizatio.pdf
On SQL Managment studioThis lab is all about database normalizatio.pdf
infomalad
 
RELATIONAL DATABASES & Database designCIS276EmployeeNumFir.docx
RELATIONAL DATABASES & Database designCIS276EmployeeNumFir.docxRELATIONAL DATABASES & Database designCIS276EmployeeNumFir.docx
RELATIONAL DATABASES & Database designCIS276EmployeeNumFir.docx
sodhi3
 
Database Concepts Team Project.pptx
Database Concepts Team Project.pptxDatabase Concepts Team Project.pptx
Database Concepts Team Project.pptx
LizSmith823201
 
SQL practice questions - set 3
SQL practice questions - set 3SQL practice questions - set 3
SQL practice questions - set 3
Mohd Tousif
 

More from TEJVEER SINGH (13)

Software engineering lecture notes
Software engineering lecture notesSoftware engineering lecture notes
Software engineering lecture notes
TEJVEER SINGH
 
Software testing lecture notes
Software testing  lecture notesSoftware testing  lecture notes
Software testing lecture notes
TEJVEER SINGH
 
Introduction to cloud computing
Introduction to cloud computingIntroduction to cloud computing
Introduction to cloud computing
TEJVEER SINGH
 
HOW TO DOWNLOAD MICROSOFT WORD IN ANDROID, and How to convert doc file into ...
HOW TO DOWNLOAD MICROSOFT WORD  IN ANDROID, and How to convert doc file into ...HOW TO DOWNLOAD MICROSOFT WORD  IN ANDROID, and How to convert doc file into ...
HOW TO DOWNLOAD MICROSOFT WORD IN ANDROID, and How to convert doc file into ...
TEJVEER SINGH
 
Computer graphics unit 4th
Computer graphics unit 4thComputer graphics unit 4th
Computer graphics unit 4th
TEJVEER SINGH
 
Most Important C language program
Most Important C language programMost Important C language program
Most Important C language program
TEJVEER SINGH
 
Multi Banking System
Multi Banking SystemMulti Banking System
Multi Banking System
TEJVEER SINGH
 
Design principle of pattern recognition system and STATISTICAL PATTERN RECOGN...
Design principle of pattern recognition system and STATISTICAL PATTERN RECOGN...Design principle of pattern recognition system and STATISTICAL PATTERN RECOGN...
Design principle of pattern recognition system and STATISTICAL PATTERN RECOGN...
TEJVEER SINGH
 
Computer network questions
Computer network questionsComputer network questions
Computer network questions
TEJVEER SINGH
 
#How to install mongoDB and also setup path
#How to install mongoDB and also setup path#How to install mongoDB and also setup path
#How to install mongoDB and also setup path
TEJVEER SINGH
 
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracaleDriver
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracaleDriverjava.lang.ClassNotFoundException: oracle.jdbc.driver.OracaleDriver
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracaleDriver
TEJVEER SINGH
 
Oracle 10g Installation Guide
Oracle 10g Installation GuideOracle 10g Installation Guide
Oracle 10g Installation Guide
TEJVEER SINGH
 
Shift reduce parser
Shift reduce parserShift reduce parser
Shift reduce parser
TEJVEER SINGH
 
Software engineering lecture notes
Software engineering lecture notesSoftware engineering lecture notes
Software engineering lecture notes
TEJVEER SINGH
 
Software testing lecture notes
Software testing  lecture notesSoftware testing  lecture notes
Software testing lecture notes
TEJVEER SINGH
 
Introduction to cloud computing
Introduction to cloud computingIntroduction to cloud computing
Introduction to cloud computing
TEJVEER SINGH
 
HOW TO DOWNLOAD MICROSOFT WORD IN ANDROID, and How to convert doc file into ...
HOW TO DOWNLOAD MICROSOFT WORD  IN ANDROID, and How to convert doc file into ...HOW TO DOWNLOAD MICROSOFT WORD  IN ANDROID, and How to convert doc file into ...
HOW TO DOWNLOAD MICROSOFT WORD IN ANDROID, and How to convert doc file into ...
TEJVEER SINGH
 
Computer graphics unit 4th
Computer graphics unit 4thComputer graphics unit 4th
Computer graphics unit 4th
TEJVEER SINGH
 
Most Important C language program
Most Important C language programMost Important C language program
Most Important C language program
TEJVEER SINGH
 
Multi Banking System
Multi Banking SystemMulti Banking System
Multi Banking System
TEJVEER SINGH
 
Design principle of pattern recognition system and STATISTICAL PATTERN RECOGN...
Design principle of pattern recognition system and STATISTICAL PATTERN RECOGN...Design principle of pattern recognition system and STATISTICAL PATTERN RECOGN...
Design principle of pattern recognition system and STATISTICAL PATTERN RECOGN...
TEJVEER SINGH
 
Computer network questions
Computer network questionsComputer network questions
Computer network questions
TEJVEER SINGH
 
#How to install mongoDB and also setup path
#How to install mongoDB and also setup path#How to install mongoDB and also setup path
#How to install mongoDB and also setup path
TEJVEER SINGH
 
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracaleDriver
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracaleDriverjava.lang.ClassNotFoundException: oracle.jdbc.driver.OracaleDriver
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracaleDriver
TEJVEER SINGH
 
Oracle 10g Installation Guide
Oracle 10g Installation GuideOracle 10g Installation Guide
Oracle 10g Installation Guide
TEJVEER SINGH
 
Ad

Recently uploaded (20)

🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...
🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...
🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...
SanjeetMishra29
 
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
Guru Nanak Technical Institutions
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
May 2025 - Top 10 Read Articles in Network Security and Its Applications
May 2025 - Top 10 Read Articles in Network Security and Its ApplicationsMay 2025 - Top 10 Read Articles in Network Security and Its Applications
May 2025 - Top 10 Read Articles in Network Security and Its Applications
IJNSA Journal
 
Frontend Architecture Diagram/Guide For Frontend Engineers
Frontend Architecture Diagram/Guide For Frontend EngineersFrontend Architecture Diagram/Guide For Frontend Engineers
Frontend Architecture Diagram/Guide For Frontend Engineers
Michael Hertzberg
 
7- Bearing..pptx 7- Bearing..pptx7- Bearing..pptx
7- Bearing..pptx 7- Bearing..pptx7- Bearing..pptx7- Bearing..pptx 7- Bearing..pptx7- Bearing..pptx
7- Bearing..pptx 7- Bearing..pptx7- Bearing..pptx
abdokhattab2015
 
Using the Artificial Neural Network to Predict the Axial Strength and Strain ...
Using the Artificial Neural Network to Predict the Axial Strength and Strain ...Using the Artificial Neural Network to Predict the Axial Strength and Strain ...
Using the Artificial Neural Network to Predict the Axial Strength and Strain ...
Journal of Soft Computing in Civil Engineering
 
Urban Transport Infrastructure September 2023
Urban Transport Infrastructure September 2023Urban Transport Infrastructure September 2023
Urban Transport Infrastructure September 2023
Rajesh Prasad
 
HSE Induction for heat stress work .pptx
HSE Induction for heat stress work .pptxHSE Induction for heat stress work .pptx
HSE Induction for heat stress work .pptx
agraahmed
 
Design Optimization of Reinforced Concrete Waffle Slab Using Genetic Algorithm
Design Optimization of Reinforced Concrete Waffle Slab Using Genetic AlgorithmDesign Optimization of Reinforced Concrete Waffle Slab Using Genetic Algorithm
Design Optimization of Reinforced Concrete Waffle Slab Using Genetic Algorithm
Journal of Soft Computing in Civil Engineering
 
Unleashing the Power of Salesforce Flows &amp_ Slack Integration!.pptx
Unleashing the Power of Salesforce Flows &amp_ Slack Integration!.pptxUnleashing the Power of Salesforce Flows &amp_ Slack Integration!.pptx
Unleashing the Power of Salesforce Flows &amp_ Slack Integration!.pptx
SanjeetMishra29
 
Introduction to Additive Manufacturing(3D printing)
Introduction to Additive Manufacturing(3D printing)Introduction to Additive Manufacturing(3D printing)
Introduction to Additive Manufacturing(3D printing)
vijimech408
 
Domain1_Security_Principles --(My_Notes)
Domain1_Security_Principles --(My_Notes)Domain1_Security_Principles --(My_Notes)
Domain1_Security_Principles --(My_Notes)
efs14135
 
Health & Safety .........................
Health & Safety .........................Health & Safety .........................
Health & Safety .........................
shadyozq9
 
introduction to Rapid Tooling and Additive Manufacturing Applications
introduction to Rapid Tooling and Additive Manufacturing Applicationsintroduction to Rapid Tooling and Additive Manufacturing Applications
introduction to Rapid Tooling and Additive Manufacturing Applications
vijimech408
 
Modeling the Influence of Environmental Factors on Concrete Evaporation Rate
Modeling the Influence of Environmental Factors on Concrete Evaporation RateModeling the Influence of Environmental Factors on Concrete Evaporation Rate
Modeling the Influence of Environmental Factors on Concrete Evaporation Rate
Journal of Soft Computing in Civil Engineering
 
PYTHON--QUIZ-1_20250422_002514_0000.pptx
PYTHON--QUIZ-1_20250422_002514_0000.pptxPYTHON--QUIZ-1_20250422_002514_0000.pptx
PYTHON--QUIZ-1_20250422_002514_0000.pptx
rmvigram
 
22PCOAM16 Unit 3 Session 23 Different ways to Combine Classifiers.pptx
22PCOAM16 Unit 3 Session 23  Different ways to Combine Classifiers.pptx22PCOAM16 Unit 3 Session 23  Different ways to Combine Classifiers.pptx
22PCOAM16 Unit 3 Session 23 Different ways to Combine Classifiers.pptx
Guru Nanak Technical Institutions
 
Compressive Strength Estimation of Mesh Embedded Masonry Prism Using Empirica...
Compressive Strength Estimation of Mesh Embedded Masonry Prism Using Empirica...Compressive Strength Estimation of Mesh Embedded Masonry Prism Using Empirica...
Compressive Strength Estimation of Mesh Embedded Masonry Prism Using Empirica...
Journal of Soft Computing in Civil Engineering
 
🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...
🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...
🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...
SanjeetMishra29
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
May 2025 - Top 10 Read Articles in Network Security and Its Applications
May 2025 - Top 10 Read Articles in Network Security and Its ApplicationsMay 2025 - Top 10 Read Articles in Network Security and Its Applications
May 2025 - Top 10 Read Articles in Network Security and Its Applications
IJNSA Journal
 
Frontend Architecture Diagram/Guide For Frontend Engineers
Frontend Architecture Diagram/Guide For Frontend EngineersFrontend Architecture Diagram/Guide For Frontend Engineers
Frontend Architecture Diagram/Guide For Frontend Engineers
Michael Hertzberg
 
7- Bearing..pptx 7- Bearing..pptx7- Bearing..pptx
7- Bearing..pptx 7- Bearing..pptx7- Bearing..pptx7- Bearing..pptx 7- Bearing..pptx7- Bearing..pptx
7- Bearing..pptx 7- Bearing..pptx7- Bearing..pptx
abdokhattab2015
 
Urban Transport Infrastructure September 2023
Urban Transport Infrastructure September 2023Urban Transport Infrastructure September 2023
Urban Transport Infrastructure September 2023
Rajesh Prasad
 
HSE Induction for heat stress work .pptx
HSE Induction for heat stress work .pptxHSE Induction for heat stress work .pptx
HSE Induction for heat stress work .pptx
agraahmed
 
Unleashing the Power of Salesforce Flows &amp_ Slack Integration!.pptx
Unleashing the Power of Salesforce Flows &amp_ Slack Integration!.pptxUnleashing the Power of Salesforce Flows &amp_ Slack Integration!.pptx
Unleashing the Power of Salesforce Flows &amp_ Slack Integration!.pptx
SanjeetMishra29
 
Introduction to Additive Manufacturing(3D printing)
Introduction to Additive Manufacturing(3D printing)Introduction to Additive Manufacturing(3D printing)
Introduction to Additive Manufacturing(3D printing)
vijimech408
 
Domain1_Security_Principles --(My_Notes)
Domain1_Security_Principles --(My_Notes)Domain1_Security_Principles --(My_Notes)
Domain1_Security_Principles --(My_Notes)
efs14135
 
Health & Safety .........................
Health & Safety .........................Health & Safety .........................
Health & Safety .........................
shadyozq9
 
introduction to Rapid Tooling and Additive Manufacturing Applications
introduction to Rapid Tooling and Additive Manufacturing Applicationsintroduction to Rapid Tooling and Additive Manufacturing Applications
introduction to Rapid Tooling and Additive Manufacturing Applications
vijimech408
 
PYTHON--QUIZ-1_20250422_002514_0000.pptx
PYTHON--QUIZ-1_20250422_002514_0000.pptxPYTHON--QUIZ-1_20250422_002514_0000.pptx
PYTHON--QUIZ-1_20250422_002514_0000.pptx
rmvigram
 
22PCOAM16 Unit 3 Session 23 Different ways to Combine Classifiers.pptx
22PCOAM16 Unit 3 Session 23  Different ways to Combine Classifiers.pptx22PCOAM16 Unit 3 Session 23  Different ways to Combine Classifiers.pptx
22PCOAM16 Unit 3 Session 23 Different ways to Combine Classifiers.pptx
Guru Nanak Technical Institutions
 
Ad

Important dbms practical question

  • 1. Sample Table – Worker WORKER_IDFIRST_NAMELAST_NAME SALARY JOINING_DATE DEPARTMENT 001 Monika Arora 100000 2014-02-20 09:00:00 HR 002 Niharika Verma 80000 2014-06-11 09:00:00 Admin 003 Vishal Singhal 300000 2014-02-20 09:00:00 HR 004 Amitabh Singh 500000 2014-02-20 09:00:00 Admin 005 Vivek Bhati 500000 2014-06-11 09:00:00 Admin 006 Vipul Diwan 200000 2014-06-11 09:00:00 Account 007 Satish Kumar 75000 2014-01-20 09:00:00 Account 008 Geetika Chauhan 90000 2014-04-11 09:00:00 Admin Sample Table – Bonus WORKER_REF_ID BONUS_DATE BONUS_AMOUNT 1 2016-02-20 00:00:00 5000 2 2016-06-11 00:00:00 3000 3 2016-02-20 00:00:00 4000 1 2016-02-20 00:00:00 4500 2 2016-06-11 00:00:00 3500 Sample Table – Title WORKER_REF_ID WORKER_TITLE AFFECTED_FROM 1 Manager 2016-02-20 00:00:00 2 Executive 2016-06-11 00:00:00 8 Executive 2016-06-11 00:00:00 5 Manager 2016-06-11 00:00:00 4 Asst. Manager 2016-06-11 00:00:00 7 Executive 2016-06-11 00:00:00 6 Lead 2016-06-11 00:00:00 3 Lead 2016-06-11 00:00:00
  • 2. Perform Following Task 1. Create Tables and Insert data (First data using Insert query rest can be feeded.) 2. Write an SQL query to print details of the Workers whose FIRST_NAME ends with ‘h’ and contains six alphabets. 3. Change Last_Name Columns name to Surname. 4. Write an SQL query to print details of the Workers whose SALARY lies between 100000 and 500000. 5. Write an SQL query to fetch the count of employees working in the department ‘Admin’. 6. Write an SQL query to fetch the no. of workers for each department in the descending order. 7. Write an SQL query to print details of the Workers who are also Managers. 8. Select Top 10 salaries and Employees Full name from Worker table. 9. Write an SQL query to fetch the list of employees with the same salary. Question-1. Create Tables and Insert data (First data using Insert query rest can be feeded.) Answer 1. CREATE TABLE WORKER( WORKER_ID NUMBER(4), FIRST_NAME VARCHAR2(10), LAST_NAME VARCHAR2(10), SALARY NUMBER(10), JOINING_DATE TIMESTAMP , DEPARTMENT VARCHAR2(10)); insert into worker(Worker_id,first_name,last_name,salary,joining_date,department) values(worker_seq.nextval,'Monika','Arora',100000,TIMESTAMP '2014-02-20 09:00:00','HR'); insert into worker(Worker_id,first_name,last_name,salary,joining_date,department) values(worker_seq.nextval,'Niharika','Verma',80000,TIMESTAMP '2014-06-11 09:00:00','Admin'); insert into worker(Worker_id,first_name,last_name,salary,joining_date,department) values(worker_seq.nextval,'Vishal','Singhal',300000,TIMESTAMP '2014-02-20 09:00:00','HR'); insert into worker(Worker_id,first_name,last_name,salary,joining_date,department) values(worker_seq.nextval,'Amitabh','Singh',500000,TIMESTAMP '2014-02-20 09:00:00','Admin'); insert into worker(Worker_id,first_name,last_name,salary,joining_date,department)
  • 3. values(worker_seq.nextval,'Vivek','Bhati',500000,TIMESTAMP '2014-06-11 09:00:00','Admin'); insert into worker(Worker_id,first_name,last_name,salary,joining_date,department) values(worker_seq.nextval,'Vipul','Diwan',200000,TIMESTAMP '2014-06-11 09:00:00','Acount'); insert into worker(Worker_id,first_name,last_name,salary,joining_date,department) values(worker_seq.nextval,'Satish','Kumar',75000,TIMESTAMP '2014-01-20 09:00:00','Acount'); insert into worker(Worker_id,first_name,last_name,salary,joining_date,department) values(worker_seq.nextval,'Geetika','Chauhan',90000,TIMESTAMP '2014-04-11 09:00:00','Admin'); Question-2:- Write an SQL query to print details of the Workers whose FIRST_NAME ends with ‘h’ and contains six alphabets. Answer-2:- Select * from Worker where FIRST_NAME like '_____h';
  • 4. Question-3:- Change Last_Name Columns name to Surname. Answer-3:- ALTER TABLE Worker RENAME COLUMN Last_name TO Surname;
  • 5. Question-4:-. Write an SQL query to print details of the Workers whose SALARY lies between 100000 and 500000. Answer-4:- select * from worker where salary between 100000 and 500000; Queston-5:- Write an SQL query to fetch the count of employees working in the department ‘Admin’. Answer-5:- select count (*) from worker where department ='Admin';
  • 6. Question-6:- Write an SQL query to fetch the no. of workers for each department in the descending order Answer-6:- SELECT DEPARTMENT, count(WORKER_ID) No_Of_Workers FROM worker GROUP BY DEPARTMENT ORDER BY No_Of_Workers DESC;
  • 7. Question-7:- Write an SQL query to print details of the Workers who are also Managers. Answer-7:- SELECT DISTINCT W.FIRST_NAME, T.WORKER_TITLE FROM Worker W INNER JOIN Title T ON W.WORKER_ID = T.WORKER_REF_ID AND T.WORKER_TITLE in ('Manager'); Question-8:- Select Top 10 salaries and Employees Full name from Worker table. Answer-8:- SELECT * FROM (SELECT * FROM Worker ORDER BY Salary DESC) WHERE ROW NUM <= 10;
  • 8. Question-9:- Write an SQL query to fetch the list of employees with the same salary. Answer-9:- Select distinct W.WORKER_ID, W.FIRST_NAME, W.Salary from Worker W, Worker W1 where W.Salary = W1.Salary and W.WORKER_ID != W1.WORKER_ID;