Here is a collection or a list of 30 SQL Queries with Answers as well as output. You can write your answer at the text box below each query any time you can see the table structure by clicking on
Table Structure. And check your Answer by clicking on
Answer. You can test your Skill in SQL. You can also go for an online Quiz in SQL in one of my previous posts: Click here for Quiz. More queries will be added to this post within few days, visit again!!!
Happy learning!!!
Carry on....
You can also share your queries in this site. Use this Link to share your part with the visitors like you.
SQL Query collection: Set1 Set2 Set3 Set 4
Below is the Table Structure using which you have to form the queries:

1) Display THE NUMBER OF packages developed in EACH language.
Table Structure
Answer
2) Display THE NUMBER OF packages developed by EACH person.
Table Structure
Answer
3) Display THE NUMBER OF male and female programmer.
Table Structure
Answer
4) Display THE COSTLIEST packages and HIGEST selling developed in EACH language.
Table Structure
Answer
5) Display THE NUMBER OF people BORN in EACH YEAR.
SELECT TO_CHAR(DOB,YY) AS YEAR,COUNT(NAME) AS PRNO
FROM PROGRAMMER
GROUP BY TO_CHAR(DOB,YY)
Table Structure
Answer
6) Display THE NUMBER OF people JOINED in EACH YEAR.
Table Structure
Answer
7) Display THE NUMBER OF people BORN in EACH MONTH.
Table Structure
Answer
8) Display THE NUMBER OF people JOINED in EACH MONTH.
Table Structure
Answer
9) Display the language wise COUNTS of prof1.
Table Structure
Answer
10) Display the language wise COUNTS of prof2.
Table Structure
Answer
11) Display THE NUMBER OF people in EACH salary group.
Table Structure
Answer
12) Display THE NUMBER OF people who studied in EACH institute.
Table Structure
Answer
13) Display THE NUMBER OF people who studied in EACH course.
Table Structure
Answer
14) Display the TOTAL development COST of the packages developed in EACH language.
Table Structure
Answer
15) Display the selling cost of the package developed in EACH language.
Table Structure
Answer
16) Display the cost of the package developed by EACH programmer.
Table Structure
Answer
17) Display the sales values of the package developed in EACH programmer.
Table Structure
Answer
18) Display the NUMBER of packages developed by EACH programmer.
Table Structure
Answer
19) Display the sales COST of packages developed by EACH programmer language wise.
Table Structure
Answer
20) Display EACH programmers name, costliest package and cheapest packages developed by Him/Her.
Table Structure
Answer
21) Display EACH language name with AVERAGE development cost, AVERAGE cost, selling cost and AVERAGE price per copy.
Table Structure
Answer
22) Display EACH institute name with NUMBER of courses, AVERAGE cost per course.
Table Structure
Answer
23) Display EACH institute name with NUMBER of students.
Table Structure
Answer
24) Display names of male and female programmers.
Table Structure
Answer
25) Display the programmers name and their packages.
Table Structure
Answer
26) Display the NUMBER of packages in EACH language.
Table Structure
Answer
27) Display the NUMBER of packages in EACH language for which development cost is less than 1000.
Table Structure
Answer
28) Display the AVERAGE difference BETWEEN scost and dcost for EACH language.
Table Structure
Answer
29) Display the TOTAL scost, dcsot and amount TOBE recovered for EACH programmer for whose dcost HAS NOT YET BEEN recovered.
Table Structure
Answer
30) Display highest, lowest and average salaries for THOSE earning MORE than 2000.
Table Structure
Answer
SQL Query collection: Set1 Set2 Set3 Set 4