10 basic SQL queries
Assume a table named STUDENT
RollNo | Name | Class | Marks | City |
|---|---|---|---|---|
1 | Aisha | 12 | 85 | Delhi |
2 | Rahul | 12 | 72 | Mumbai |
3 | Neha | 12 | 91 | Delhi |
4 | Arjun | 12 | 65 | Kolkata |
5 | Riya | 12 | 88 | Mumbai |
1. Display All Records
SELECT * FROM STUDENT;
2. Display Only Name and Marks
SELECT Name, Marks FROM STUDENT;
3. Display Students Scoring More Than 80 Marks
SELECT * FROM STUDENT
WHERE Marks > 80;
4. Display Students from Delhi
SELECT * FROM STUDENT
WHERE City = 'Delhi';
5. Display Students in Descending Order of Marks
SELECT * FROM STUDENT
ORDER BY Marks DESC;
6. Count Total Number of Students
SELECT COUNT(*) FROM STUDENT;
7. Find Maximum Marks
SELECT MAX(Marks) FROM STUDENT;
8. Find Average Marks
SELECT AVG(Marks) FROM STUDENT;
9. Display Students from Mumbai
SELECT Name FROM STUDENT
WHERE City = 'Mumbai';
10. Display Students Whose Name Starts with "R"
SELECT * FROM STUDENT
WHERE Name LIKE 'R%';
Note: Here are some MySQL queries that may be important for the Board Examination 2026. Students are advised to revise these queries carefully before the exam. Additional question sets are currently being prepared and will be published soon.
Thank You!
No comments:
Post a Comment
Please do not any spam in the comment box.