0% found this document useful (0 votes)
20 views

Class XII Computer Science Mysql Queries Question For Practice

Good questions

Uploaded by

codoter03
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)
20 views

Class XII Computer Science Mysql Queries Question For Practice

Good questions

Uploaded by

codoter03
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
You are on page 1/ 2

Class XII Computer Science students to practice:

Table: STUDENT

RollNo Name Age Gender Class Section Marks City

1 Rahul 17 M 12 A 89 Delhi

2 Anjali 18 F 12 B 92 Mumbai

3 Mohit 17 M 12 A 78 Delhi

4 Priya 18 F 12 C 85 Chennai

5 Sunil 17 M 12 B 95 Kolkata

6 Rani 18 F 12 A 88 Delhi

7 Pooja 17 F 12 C 82 Mumbai

8 Arjun 18 M 12 B 91 Delhi

Questions
1. Basic SELECT Queries
o Write a query to display the names of all students who are from "Delhi".
o Write a query to display the Name, Class, and Marks of students who scored
more than 85 marks.
o Write a query to display the details of all students whose age is 18.
2. Conditional Queries
o Write a query to display the names of students who belong to Section "A" and
have marks above 80.
o Write a query to display all students who are either from "Mumbai" or have
marks above 90.
3. Sorting and Limiting
o Write a query to display the names and marks of students in descending order
of their marks.
o Write a query to display the top 3 students with the highest marks.
4. Using Aggregate Functions
o Write a query to find the average marks of all students in Section "B".
o Write a query to count the number of male students in the STUDENT table.
o Write a query to find the maximum marks obtained by any student from
"Chennai".
5. GROUP BY and HAVING Clauses
o Write a query to display the average marks obtained by students in each
section.
o Write a query to display the total number of students in each city, only if the
count of students in the city is more than 1.
o Write a query to find the minimum marks of students in each section where
the section has more than 2 students.
6. Output Prediction Questions Based on the table STUDENT, determine the output of
the following queries:
SELECT Name, Marks FROM STUDENT WHERE City = 'Delhi' AND Marks >= 90;
SELECT AVG(Marks) AS AvgMarks FROM STUDENT WHERE Section = 'A';
SELECT Gender, COUNT(*) AS Count FROM STUDENT GROUP BY Gender HAVING
COUNT(*) > 2;
7. Complex Queries
o Write a query to display the Name, Class, Marks, and City of students who are
in Section "A" or Section "B" and have marks between 80 and 95.
o Write a query to display the names of students along with their marks and
their rank based on marks in descending order.

You might also like