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

SQL Practical Preparation Questions

The document contains a series of SQL practical preparation questions aimed at creating and manipulating a Student table. It includes tasks such as creating a table, inserting records, updating and deleting data, performing queries with conditions, aggregating data, and managing database constraints. The questions also cover advanced SQL concepts like joins, views, and indexing.

Uploaded by

abhisheksali18
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)
17 views2 pages

SQL Practical Preparation Questions

The document contains a series of SQL practical preparation questions aimed at creating and manipulating a Student table. It includes tasks such as creating a table, inserting records, updating and deleting data, performing queries with conditions, aggregating data, and managing database constraints. The questions also cover advanced SQL concepts like joins, views, and indexing.

Uploaded by

abhisheksali18
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

SQL Practical Preparation Questions

1. Create a table Student with columns: id, name, age, marks.

2. Insert 5 records into the Student table.

3. Write a query to display all students.

4. Add a new column gender to the Student table.

5. Update the marks of a student whose id is 3.

6. Delete the student whose name is 'Rahul'.

7. Select all students with marks greater than 80.

8. Select students whose name starts with 'A'.

9. Display students who are between 18 and 22 years old.

10. Show all students except those who scored less than 40.

11. Display all students ordered by marks descending.

12. Fetch top 3 students with highest marks.

13. Find the average marks of all students.

14. Find total number of students.

15. Group students by age and count how many in each group.

16. Display maximum and minimum marks.

17. Show age groups with more than 2 students using GROUP BY and HAVING.

18. Join Student and Marks tables to show student name with subject and mark.

19. Show only those students who have marks in subject = 'DBMS'.

20. Find students who scored more than the average marks.

21. Find the student(s) with the second highest marks.

22. Display the names of students who are not in the Marks table.
23. Show all student names from table A and B (use UNION).

24. Find students in A but not in B (use LEFT JOIN or NOT IN).

25. Add a PRIMARY KEY to column id in Student.

26. Make marks column NOT NULL.

27. Drop column gender from Student.

28. Create a view showing student name and average marks.

29. Create an index on name column of student table.

30. Write a query to find duplicate student names.

31. List all students whose names are palindromes.

32. Get the name of the student with highest marks per subject.

33. Display total marks of each student.

34. Count students who passed (marks > 40).

You might also like