0% found this document useful (0 votes)
5 views2 pages

Student Data Analysis and Queries

The document contains a table of students with details such as StudentID, Name, Class, Section, Marks, Age, and City. It also includes a list of SQL queries to extract various information from the student data, such as displaying details, filtering by marks and age, and aggregating data by city and class. The queries cover a wide range of operations including selection, sorting, and counting.

Uploaded by

amitkumar2k08
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Student Data Analysis and Queries

The document contains a table of students with details such as StudentID, Name, Class, Section, Marks, Age, and City. It also includes a list of SQL queries to extract various information from the student data, such as displaying details, filtering by marks and age, and aggregating data by city and class. The queries cover a wide range of operations including selection, sorting, and counting.

Uploaded by

amitkumar2k08
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Table: Students

StudentID Name Class Section Marks Age City


1 Riya 6 A 92 11 Delhi
2 Aarav 6 A 78 12 Jaipur
3 Kabir 6 B 85 11 Mumbai
4 Siya 7 A 67 13 Delhi
5 Mehul 7 B 55 12 Kolkata
6 Zara 6 B 89 11 Chennai
7 Tanvi 7 A 43 13 Mumbai
8 Om 6 A 96 12 Jaipur
9 Neil 7 B 71 14 Kolkata
10 Parth 6 B 58 11 Delhi

1. Write a query to display details of the Students.


2. Display the name and marks of every student.
3. Show the names of students who live in Delhi.
4. Display the names and cities of students whose marks are greater than 80.
5. List the names and ages of students whose age is less than 12.
6. Display names of students whose city is either Delhi Jaipur or Mumbai.
7. Show the details of students who are not from Kolkata
8. Display the names of students whose names start with the letter A.
9. Show the names of students whose names end with the letter a.
10. Display the names of students whose names contain the letters ar anywhere.
11. Show the names and marks of students whose marks lie between 60 and 90.
12. Display all details of students whose age falls between 11 and 13.
13. Show the names of students who scored more than 90 or less than 50.
14. Display all students sorted by marks in ascending order.
15. Display all students sorted by age in descending order.
16. Show the three students with the highest marks.
17. Count the number of students in the table.
18. Find the minimum marks scored by any student.
19. Find the highest marks scored.
20. Find the average marks of all students.
21. Display the total of all marks.
22. Show the number of students living in each city.
23. Show the average marks obtained in each class.
24. Show classes where the number of students is greater than two.
25. Display cities where the average marks are above seventy.
1. SELECT * FROM Students;
2. SELECT Name, Marks FROM Students;
3. SELECT Name FROM Students WHERE City = 'Delhi';
4. SELECT Name, City FROM Students WHERE Marks > 80;
5. SELECT Name, Age FROM Students WHERE Age < 12;
6. SELECT Name FROM Students WHERE City IN ('Jaipur', 'Mumbai');
7. SELECT * FROM Students WHERE City NOT IN ('Kolkata');
8. SELECT Name FROM Students WHERE Name LIKE 'A%';
9. SELECT Name FROM Students WHERE Name LIKE '%a';
10. SELECT Name FROM Students WHERE Name LIKE '%ar%';
11. SELECT Name, Marks FROM Students WHERE Marks BETWEEN 60 AND 90;
12. SELECT * FROM Students WHERE Age BETWEEN 11 AND 13;
13. SELECT Name FROM Students WHERE Marks > 90 OR Marks < 50;
14. SELECT * FROM Students ORDER BY Marks ASC;
15. SELECT * FROM Students ORDER BY Age DESC;
16. SELECT * FROM Students ORDER BY Marks DESC LIMIT 3;
17. SELECT COUNT(*) FROM Students;
18. SELECT MIN(Marks) FROM Students;
19. SELECT MAX(Marks) FROM Students;
20. SELECT AVG(Marks) FROM Students;
21. SELECT SUM(Marks) FROM Students;
22. SELECT City, COUNT(*) FROM Students GROUP BY City;
23. SELECT Class, AVG(Marks) FROM Students GROUP BY Class;
24. SELECT Class, COUNT(*) FROM Students GROUP BY Class HAVING COUNT(*) >
2;
25. SELECT City, AVG(Marks) FROM Students GROUP BY City HAVING AVG(Marks) >
70;

You might also like