SlideShare a Scribd company logo
1 of 3
Download to read offline
SQLAssignment – 2
Written and Compiled by : Mohd Tousif
1. Display the highest,lowest,sum and average salaries of all employees. Label the columns as
Maximum, Minimum, Sum, Average respectively. Round your results to the nearest whole
number.
2. Determine the number of managers without listing them. Label the column Number of
Managers.
3. Write a query to display the difference between the highest and lowest salaries. Label the
column DIFFERENCE.
4. Display the manager number and the salary of the lowest paid employee for that manager.
Exclude any one whose manager is not known. Exclude any groups whose where the maximum
salary is 6,000 or less.
5. Write a query to extract the year from hire_date column of the EMPLOYEES table for those
employees who work in department 80.
6. Display the highest,lowest,sum and average salaries of all employees for each job type. Label
the columns as Maximum, Minimum, Sum, Average respectively. Round your results to the
nearest whole number.
7. Write a query to display the number of people with the same job.
8. Write a query to display each department name, location number, number of employees and the
average salary of all employees in that department. Label the columns Name, Location, Number
of People and Salary respectively. Round the average to two decimal places.
9. Create an Emp table with the following criteria:
Eno number(6)
Ename varchar2(30)
Sal number(8,2)
deptno number(4)
10. Add a table – level primary key constraint to the EMP table on the ID column. The constraint
should be named at creation. Name the constraint my_emp_id_pk.
11. Create a primary key constraint to the DEPT table using the ID column. The constraint should
be named at the time of creation. Name the constraint my_dept_id_pk.
12. Add a column dept_id to the EMP table. Add a foreign key reference on the EMP table that
ensures that the employee is not assigned to a non-existent department. Name the constraint
my_emp_dept_id_fk.
13. Modify the EMP table. Add a commission column of number datatype, precision 2, scale 2. Add
a constraint to the commission column that ensures that a commission value is greater than zero.
14. Remove the table Emp from the database
15. Clear the recyclebin
16. Display the highest,lowest,sum and average salaries of all employees for each job type. Label
the columns as Maximum, Minimum, Sum, Average respectively.
17. Write a query to display the number of people with the same job.
18. Write a query to display each department name, location number, number of employees and the
average salary of all employees in that department. Label the columns Name, Location, Number
of People and Salary respectively. Round the average to two decimal places.
19. Create a table student_marks with the following conditions
(a) Roll number with the data type number of size 3 and should not have null values
(b) Year with the data type number of size 1 and should not have null values
(c) Marks with the data type number of size 5,2 and should not have null values
(d) Remarks with the data type varchar2 of size 20
The roll number should be between 1 and 250 , year should be between 1 and 3 , marks should
be between 0 and 100. Give appropriate constraint names.
20. Create a table student with the following conditions
(a) Roll number with the data type number of size 3
(b) City with the data type varchar2 of size 20
(c) Name with the data type varchar2 of size 30
None of the column should have a null value. The roll number should be with the range of 1 to
250. The length of the city should be 3 and all the characters should be in uppercase. First
character of the name should be in capital letters. Give appropriate constraint names.
21. Create a table stud with the following conditions
(a) Roll number with the data type number of size 3
(b) Name with the data type varchar2 of size 30
(c) Year with the data type date
(d) Branch with the data type varchar2 of size 20
(e) EN with the data type number of size 4
Define an unique on the column EN. Define a composite primary key on the columns Roll
number,year and branch. Give appropriate constraint names.
22. Create a table supplier with the following conditions
(a) Supplier_Id with the data type number of size 10
(b) Supplier_name with the data type varchar2 of size 30
(c) Contact_name with the data type varchar2 of size 30
Define a primary key on Supplier_Id. Supplier_Name should not contain null values.
23. Create a table products with the following conditions:
(a) Product_Id with the data type number of size 10
(b) Sup_Id with the data type number of size 10
Refer Supplier_Id of supplier table to Sup_Id of products table.
Give appropriate constraint names.
24. Create a table product with the following conditions
(a) Product_Id with the data type number of size 5
(b) Product_name with the data type varchar2 of size 20
(c) Supplier_name with the data type varchar2 of size 20
(d) Unit_Price with the data type number of size 10
Define priamry key on Product_Id. Product name and Supplier name should not be null. Unit
Price should be more than 5000.
25. Create a table order_items with the following conditions
(a) Order_Id with the data type number of size 5
(b) Product_Id with the data type number of size 5
Define priamry key on Order Id and foreign key on Product_Id reference product table
product_id. Give appropriate constraint names.
26. Enter 5 records into each of the tables student_marks, student, stud, supplier, products, product,
order_items and produce one error if violating the rules.
27. Remove all the constraints created above from the database.
28. Remove the tables student_marks,student,stud,supplier,products,product,order_items from the
database.
29. Clear the recycle bin.
30. Create a table with the name stud_marks(sid,sname,city).
31. Insert the values into the above table for sid column, using sequence created in Q23 and rest
other column values must be user defined. Enter 10 records.
32. Write a query to display the last name,department number and department name for all
employees.
33. Write a query to display the employee last name , department name, location id, and city of all
employees who earn a commission.
34. Create a unique listing of all jobs that are in department 80. Include the location of the
department in the output.
35. Write a query to display the employee last name , department name, location id, and city of all
employees who earn a commission.
36. Write a query that displays the last name, job, department name, salary and grade for all
employees.
37. Write a query to display the name and hire date of any employee hired after employee Davies.
38. Display the employee's last name and department name for all employees who have an 'a'.
39. Create a query that displays the employee last names, department numbers, and all the
employees who work in the same department as a given employee.
40. Create a query that displays the last name, job, department name, salary and grade for all
employees.
41. Write a query to display Employee id , name , salary , department id , department name ,
manager id though there are employees existing in a department or not.
42. Write a query to display the details of employees whose designation is same as designation of
the employee of "Shipping" department.

More Related Content

What's hot

Microsoft Office: Practice Questions
Microsoft Office: Practice Questions Microsoft Office: Practice Questions
Microsoft Office: Practice Questions Makaha Rutendo
 
DBMS 6 | MySQL Practice List - Rank Related Queries
DBMS 6 | MySQL Practice List - Rank Related QueriesDBMS 6 | MySQL Practice List - Rank Related Queries
DBMS 6 | MySQL Practice List - Rank Related QueriesMohammad Imam Hossain
 
Simran kaur,BCA Final Year 2015
Simran kaur,BCA Final Year 2015Simran kaur,BCA Final Year 2015
Simran kaur,BCA Final Year 2015dezyneecole
 
Mr20 enus 10-Report Design in Management Reporter 2.0 for Microsoft Dynamics®...
Mr20 enus 10-Report Design in Management Reporter 2.0 for Microsoft Dynamics®...Mr20 enus 10-Report Design in Management Reporter 2.0 for Microsoft Dynamics®...
Mr20 enus 10-Report Design in Management Reporter 2.0 for Microsoft Dynamics®...Sami JAMMALI
 
DATABASE PROJECT
DATABASE PROJECTDATABASE PROJECT
DATABASE PROJECTabdul basit
 
Closing Work Orders
Closing Work OrdersClosing Work Orders
Closing Work Orderskalebhanly
 
Ms excel excersices
Ms excel excersicesMs excel excersices
Ms excel excersicesHEENA PRUTHI
 

What's hot (12)

Database Joins
Database JoinsDatabase Joins
Database Joins
 
Microsoft Office: Practice Questions
Microsoft Office: Practice Questions Microsoft Office: Practice Questions
Microsoft Office: Practice Questions
 
Vijay Kumar
Vijay KumarVijay Kumar
Vijay Kumar
 
DBMS 6 | MySQL Practice List - Rank Related Queries
DBMS 6 | MySQL Practice List - Rank Related QueriesDBMS 6 | MySQL Practice List - Rank Related Queries
DBMS 6 | MySQL Practice List - Rank Related Queries
 
Simran kaur,BCA Final Year 2015
Simran kaur,BCA Final Year 2015Simran kaur,BCA Final Year 2015
Simran kaur,BCA Final Year 2015
 
Mr20 enus 10-Report Design in Management Reporter 2.0 for Microsoft Dynamics®...
Mr20 enus 10-Report Design in Management Reporter 2.0 for Microsoft Dynamics®...Mr20 enus 10-Report Design in Management Reporter 2.0 for Microsoft Dynamics®...
Mr20 enus 10-Report Design in Management Reporter 2.0 for Microsoft Dynamics®...
 
DATABASE PROJECT
DATABASE PROJECTDATABASE PROJECT
DATABASE PROJECT
 
Closing Work Orders
Closing Work OrdersClosing Work Orders
Closing Work Orders
 
Bi0 112
Bi0 112Bi0 112
Bi0 112
 
OpenCastLabs Excel chapter-2
OpenCastLabs Excel chapter-2OpenCastLabs Excel chapter-2
OpenCastLabs Excel chapter-2
 
Da 100-questions
Da 100-questionsDa 100-questions
Da 100-questions
 
Ms excel excersices
Ms excel excersicesMs excel excersices
Ms excel excersices
 

Similar to SQL Practice Question set

Part 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docxPart 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docxhoney690131
 
sample practical file 2022-23 aniket choudhary.docx
sample practical file 2022-23 aniket choudhary.docxsample practical file 2022-23 aniket choudhary.docx
sample practical file 2022-23 aniket choudhary.docxomkumar654197
 
I.Multiple Choice 20 Questions worth 1 point each..docx
I.Multiple Choice 20 Questions worth 1 point each..docxI.Multiple Choice 20 Questions worth 1 point each..docx
I.Multiple Choice 20 Questions worth 1 point each..docxjewisonantone
 
MQSL JOINING OF TABLES.pptx
MQSL JOINING OF TABLES.pptxMQSL JOINING OF TABLES.pptx
MQSL JOINING OF TABLES.pptxlemonchoos
 
284566820 1 z0-061(1)
284566820 1 z0-061(1)284566820 1 z0-061(1)
284566820 1 z0-061(1)panagara
 
Day 7 Worksheet.docx
Day 7 Worksheet.docxDay 7 Worksheet.docx
Day 7 Worksheet.docxatreesgalaxy
 
Sql task answers
Sql task answersSql task answers
Sql task answersNawaz Sk
 
Part 1 - Microsoft Access 2019Use Access to create a database to.docx
Part 1 - Microsoft Access 2019Use Access to create a database to.docxPart 1 - Microsoft Access 2019Use Access to create a database to.docx
Part 1 - Microsoft Access 2019Use Access to create a database to.docxhoney690131
 
Part 1 - Microsoft ExcelUse Excel to create a workbook containin.docx
Part 1 - Microsoft ExcelUse Excel to create a workbook containin.docxPart 1 - Microsoft ExcelUse Excel to create a workbook containin.docx
Part 1 - Microsoft ExcelUse Excel to create a workbook containin.docxPOLY33
 
AimTo give you practical experience in database modelling, no.docx
AimTo give you practical experience in database modelling, no.docxAimTo give you practical experience in database modelling, no.docx
AimTo give you practical experience in database modelling, no.docxsimonlbentley59018
 
Plsql task
Plsql taskPlsql task
Plsql taskNawaz Sk
 
Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)Achmad Solichin
 
BBA 2 Semester DBMS All assignment
BBA 2 Semester DBMS All assignmentBBA 2 Semester DBMS All assignment
BBA 2 Semester DBMS All assignmentRoshan Kumar
 

Similar to SQL Practice Question set (20)

DATABASE MANAGEMENT SYSTEM LAB.pdf
DATABASE MANAGEMENT SYSTEM LAB.pdfDATABASE MANAGEMENT SYSTEM LAB.pdf
DATABASE MANAGEMENT SYSTEM LAB.pdf
 
Sql lab experiments
Sql lab experimentsSql lab experiments
Sql lab experiments
 
All questions
All questionsAll questions
All questions
 
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docxPart 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docx
 
sample practical file 2022-23 aniket choudhary.docx
sample practical file 2022-23 aniket choudhary.docxsample practical file 2022-23 aniket choudhary.docx
sample practical file 2022-23 aniket choudhary.docx
 
Fahri tugas cloud1
Fahri tugas cloud1Fahri tugas cloud1
Fahri tugas cloud1
 
I.Multiple Choice 20 Questions worth 1 point each..docx
I.Multiple Choice 20 Questions worth 1 point each..docxI.Multiple Choice 20 Questions worth 1 point each..docx
I.Multiple Choice 20 Questions worth 1 point each..docx
 
MQSL JOINING OF TABLES.pptx
MQSL JOINING OF TABLES.pptxMQSL JOINING OF TABLES.pptx
MQSL JOINING OF TABLES.pptx
 
284566820 1 z0-061(1)
284566820 1 z0-061(1)284566820 1 z0-061(1)
284566820 1 z0-061(1)
 
Sql wksht-5
Sql wksht-5Sql wksht-5
Sql wksht-5
 
Day 7 Worksheet.docx
Day 7 Worksheet.docxDay 7 Worksheet.docx
Day 7 Worksheet.docx
 
Sql task answers
Sql task answersSql task answers
Sql task answers
 
Part 1 - Microsoft Access 2019Use Access to create a database to.docx
Part 1 - Microsoft Access 2019Use Access to create a database to.docxPart 1 - Microsoft Access 2019Use Access to create a database to.docx
Part 1 - Microsoft Access 2019Use Access to create a database to.docx
 
Part 1 - Microsoft ExcelUse Excel to create a workbook containin.docx
Part 1 - Microsoft ExcelUse Excel to create a workbook containin.docxPart 1 - Microsoft ExcelUse Excel to create a workbook containin.docx
Part 1 - Microsoft ExcelUse Excel to create a workbook containin.docx
 
AimTo give you practical experience in database modelling, no.docx
AimTo give you practical experience in database modelling, no.docxAimTo give you practical experience in database modelling, no.docx
AimTo give you practical experience in database modelling, no.docx
 
Case study
Case studyCase study
Case study
 
Plsql task
Plsql taskPlsql task
Plsql task
 
Cs practical file
Cs practical fileCs practical file
Cs practical file
 
Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)
 
BBA 2 Semester DBMS All assignment
BBA 2 Semester DBMS All assignmentBBA 2 Semester DBMS All assignment
BBA 2 Semester DBMS All assignment
 

More from Mohd Tousif

Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statementsMohd Tousif
 
Introduction to Databases
Introduction to DatabasesIntroduction to Databases
Introduction to DatabasesMohd Tousif
 
Entity Relationship Model - An Example
Entity Relationship Model - An ExampleEntity Relationship Model - An Example
Entity Relationship Model - An ExampleMohd Tousif
 
Entity Relationship (ER) Model Questions
Entity Relationship (ER) Model QuestionsEntity Relationship (ER) Model Questions
Entity Relationship (ER) Model QuestionsMohd Tousif
 
Entity Relationship (ER) Model
Entity Relationship (ER) ModelEntity Relationship (ER) Model
Entity Relationship (ER) ModelMohd Tousif
 
Data Definition Language (DDL)
Data Definition Language (DDL) Data Definition Language (DDL)
Data Definition Language (DDL) Mohd Tousif
 
Data Warehouse Concepts and Architecture
Data Warehouse Concepts and ArchitectureData Warehouse Concepts and Architecture
Data Warehouse Concepts and ArchitectureMohd Tousif
 
SQL practice questions for beginners
SQL practice questions for beginnersSQL practice questions for beginners
SQL practice questions for beginnersMohd Tousif
 
Oracle sql tutorial
Oracle sql tutorialOracle sql tutorial
Oracle sql tutorialMohd Tousif
 
Sql (Introduction to Structured Query language)
Sql (Introduction to Structured Query language)Sql (Introduction to Structured Query language)
Sql (Introduction to Structured Query language)Mohd Tousif
 
System components of windows xp
System components of windows xpSystem components of windows xp
System components of windows xpMohd Tousif
 
Inter process communication
Inter process communicationInter process communication
Inter process communicationMohd Tousif
 
Producer consumer
Producer consumerProducer consumer
Producer consumerMohd Tousif
 

More from Mohd Tousif (19)

Sql commands
Sql commandsSql commands
Sql commands
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
 
Introduction to Databases
Introduction to DatabasesIntroduction to Databases
Introduction to Databases
 
Entity Relationship Model - An Example
Entity Relationship Model - An ExampleEntity Relationship Model - An Example
Entity Relationship Model - An Example
 
Entity Relationship (ER) Model Questions
Entity Relationship (ER) Model QuestionsEntity Relationship (ER) Model Questions
Entity Relationship (ER) Model Questions
 
Entity Relationship (ER) Model
Entity Relationship (ER) ModelEntity Relationship (ER) Model
Entity Relationship (ER) Model
 
Data Definition Language (DDL)
Data Definition Language (DDL) Data Definition Language (DDL)
Data Definition Language (DDL)
 
Data Warehouse Concepts and Architecture
Data Warehouse Concepts and ArchitectureData Warehouse Concepts and Architecture
Data Warehouse Concepts and Architecture
 
SQL practice questions for beginners
SQL practice questions for beginnersSQL practice questions for beginners
SQL practice questions for beginners
 
Oracle sql tutorial
Oracle sql tutorialOracle sql tutorial
Oracle sql tutorial
 
Sql (Introduction to Structured Query language)
Sql (Introduction to Structured Query language)Sql (Introduction to Structured Query language)
Sql (Introduction to Structured Query language)
 
Sql commands
Sql commandsSql commands
Sql commands
 
Virtual box
Virtual boxVirtual box
Virtual box
 
Deadlock
DeadlockDeadlock
Deadlock
 
Algorithm o.s.
Algorithm o.s.Algorithm o.s.
Algorithm o.s.
 
System components of windows xp
System components of windows xpSystem components of windows xp
System components of windows xp
 
Ipc
IpcIpc
Ipc
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
 
Producer consumer
Producer consumerProducer consumer
Producer consumer
 

Recently uploaded

Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfSocial Samosa
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad EscortsCall girls in Ahmedabad High profile
 

Recently uploaded (20)

Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
 

SQL Practice Question set

  • 1. SQLAssignment – 2 Written and Compiled by : Mohd Tousif 1. Display the highest,lowest,sum and average salaries of all employees. Label the columns as Maximum, Minimum, Sum, Average respectively. Round your results to the nearest whole number. 2. Determine the number of managers without listing them. Label the column Number of Managers. 3. Write a query to display the difference between the highest and lowest salaries. Label the column DIFFERENCE. 4. Display the manager number and the salary of the lowest paid employee for that manager. Exclude any one whose manager is not known. Exclude any groups whose where the maximum salary is 6,000 or less. 5. Write a query to extract the year from hire_date column of the EMPLOYEES table for those employees who work in department 80. 6. Display the highest,lowest,sum and average salaries of all employees for each job type. Label the columns as Maximum, Minimum, Sum, Average respectively. Round your results to the nearest whole number. 7. Write a query to display the number of people with the same job. 8. Write a query to display each department name, location number, number of employees and the average salary of all employees in that department. Label the columns Name, Location, Number of People and Salary respectively. Round the average to two decimal places. 9. Create an Emp table with the following criteria: Eno number(6) Ename varchar2(30) Sal number(8,2) deptno number(4) 10. Add a table – level primary key constraint to the EMP table on the ID column. The constraint should be named at creation. Name the constraint my_emp_id_pk. 11. Create a primary key constraint to the DEPT table using the ID column. The constraint should be named at the time of creation. Name the constraint my_dept_id_pk. 12. Add a column dept_id to the EMP table. Add a foreign key reference on the EMP table that ensures that the employee is not assigned to a non-existent department. Name the constraint my_emp_dept_id_fk. 13. Modify the EMP table. Add a commission column of number datatype, precision 2, scale 2. Add a constraint to the commission column that ensures that a commission value is greater than zero. 14. Remove the table Emp from the database 15. Clear the recyclebin 16. Display the highest,lowest,sum and average salaries of all employees for each job type. Label the columns as Maximum, Minimum, Sum, Average respectively. 17. Write a query to display the number of people with the same job. 18. Write a query to display each department name, location number, number of employees and the average salary of all employees in that department. Label the columns Name, Location, Number of People and Salary respectively. Round the average to two decimal places. 19. Create a table student_marks with the following conditions (a) Roll number with the data type number of size 3 and should not have null values (b) Year with the data type number of size 1 and should not have null values
  • 2. (c) Marks with the data type number of size 5,2 and should not have null values (d) Remarks with the data type varchar2 of size 20 The roll number should be between 1 and 250 , year should be between 1 and 3 , marks should be between 0 and 100. Give appropriate constraint names. 20. Create a table student with the following conditions (a) Roll number with the data type number of size 3 (b) City with the data type varchar2 of size 20 (c) Name with the data type varchar2 of size 30 None of the column should have a null value. The roll number should be with the range of 1 to 250. The length of the city should be 3 and all the characters should be in uppercase. First character of the name should be in capital letters. Give appropriate constraint names. 21. Create a table stud with the following conditions (a) Roll number with the data type number of size 3 (b) Name with the data type varchar2 of size 30 (c) Year with the data type date (d) Branch with the data type varchar2 of size 20 (e) EN with the data type number of size 4 Define an unique on the column EN. Define a composite primary key on the columns Roll number,year and branch. Give appropriate constraint names. 22. Create a table supplier with the following conditions (a) Supplier_Id with the data type number of size 10 (b) Supplier_name with the data type varchar2 of size 30 (c) Contact_name with the data type varchar2 of size 30 Define a primary key on Supplier_Id. Supplier_Name should not contain null values. 23. Create a table products with the following conditions: (a) Product_Id with the data type number of size 10 (b) Sup_Id with the data type number of size 10 Refer Supplier_Id of supplier table to Sup_Id of products table. Give appropriate constraint names. 24. Create a table product with the following conditions (a) Product_Id with the data type number of size 5 (b) Product_name with the data type varchar2 of size 20 (c) Supplier_name with the data type varchar2 of size 20 (d) Unit_Price with the data type number of size 10 Define priamry key on Product_Id. Product name and Supplier name should not be null. Unit Price should be more than 5000. 25. Create a table order_items with the following conditions (a) Order_Id with the data type number of size 5 (b) Product_Id with the data type number of size 5 Define priamry key on Order Id and foreign key on Product_Id reference product table product_id. Give appropriate constraint names. 26. Enter 5 records into each of the tables student_marks, student, stud, supplier, products, product, order_items and produce one error if violating the rules. 27. Remove all the constraints created above from the database. 28. Remove the tables student_marks,student,stud,supplier,products,product,order_items from the database. 29. Clear the recycle bin. 30. Create a table with the name stud_marks(sid,sname,city). 31. Insert the values into the above table for sid column, using sequence created in Q23 and rest other column values must be user defined. Enter 10 records. 32. Write a query to display the last name,department number and department name for all
  • 3. employees. 33. Write a query to display the employee last name , department name, location id, and city of all employees who earn a commission. 34. Create a unique listing of all jobs that are in department 80. Include the location of the department in the output. 35. Write a query to display the employee last name , department name, location id, and city of all employees who earn a commission. 36. Write a query that displays the last name, job, department name, salary and grade for all employees. 37. Write a query to display the name and hire date of any employee hired after employee Davies. 38. Display the employee's last name and department name for all employees who have an 'a'. 39. Create a query that displays the employee last names, department numbers, and all the employees who work in the same department as a given employee. 40. Create a query that displays the last name, job, department name, salary and grade for all employees. 41. Write a query to display Employee id , name , salary , department id , department name , manager id though there are employees existing in a department or not. 42. Write a query to display the details of employees whose designation is same as designation of the employee of "Shipping" department.