SQL Server Tasks-2 (1)
SQL Server Tasks-2 (1)
2. Retrieve the details of students whose StudentName ends with the letter 'e'.
3. Retrieve the details of students whose StudentName contains the substring 'ar'.
4. Retrieve the details of students whose StudentName has exactly 5 characters.
5. Retrieve the details of students whose StudentName has 'b' as the second character.
6. Retrieve the details of students whose StudentCourse starts with either 'B' or 'C'.
7. Retrieve the details of students whose StudentName does not contain the letter 'a'.
8. Retrieve the details of students whose StudentName ends with 's' and is exactly 7 characters
long.
9. Retrieve the details of students whose StudentCourse contains the substring 'math'.
10. Retrieve the details of students whose StudentName starts with 'C' and ends with 'e'.
11. Retrieve the details of students whose StudentName contains any vowel ('a', 'e', 'i', 'o', 'u').
12. Retrieve the details of students whose StudentCourse does not start with the letter 'P'.
13. Retrieve the details of students whose StudentName has a double letter (e.g., 'll', 'ee').
14. Retrieve the details of students whose StudentName ends with 'a' and has at least 4 characters.
15. Retrieve the details of students whose StudentCourse contains the letter 't' as the second
character.
16. Retrieve the details of students whose StudentName starts with a consonant (any letter that is
not a vowel).
17. Retrieve the details of students whose StudentName ends with the letter 'y'.
18. Retrieve the details of students whose StudentCourse name has exactly 8 characters.
19. Retrieve the details of students whose StudentName contains an underscore ('_').
20. Retrieve the details of students whose StudentName starts with 'M', ends with 's', and contains
the letter 'a' somewhere in between.
21. Calculate the total sum of fees collected from students enrolled in the 'Physics' course.
22. Calculate the total sum of fees for students whose names start with 'A'.
23. Calculate the sum of fees for students whose StudentID is less than 4.
24. Count the total number of students enrolled in the Students table.
25. Count the number of students enrolled in the 'Mathematics' course.
26. Count the number of students whose fees are greater than 2500.
27. Count the number of students whose names contain the letter 'e'.
28. Find the maximum fee paid by any student in the Students table.
29. Find the maximum fee for students enrolled in the 'Computer Science' course.
30. Find the maximum fee paid by students whose names start with 'B'.
31. Find the students details (all columns) with the highest fee.
32. Find the minimum fee for students enrolled in the 'Biology' course.
33. Find the minimum fee paid by students whose names end with 'a'.
34. Find the student details (all columns) with the lowest fee.
35. Count the total number of records in the Students table where the StudentFee is greater than
2000.
36. Count the total number of distinct courses in the Students table.
37. Count the number of records where the StudentName contains the letter 'i'.
38. Count the number of students who are not enrolled in the 'Physics' course.
39. Alter the StudentName column to increase its maximum length from 20 to 50 characters.
40. Rename the StudentName column to FullName.
41. Drop the StudentCourse column from the Students table.
42. Change the data type of the StudentCourse column from VARCHAR(20) to VARCHAR(30) to allow
longer course names.
43. Add a new column StudentAge with data type INT and then drop it.
44. Change the data type of StudentCourse to VARCHAR(5) and then rename it to CourseCode
45. Drop the StudentName column, then add it back with a data type of VARCHAR(100).
46. Delete all records of students enrolled in the 'History' course.
47. Delete the record of the student with StudentID equal to 5.
48. Delete records of students whose fees are less than 1500.
49. Delete all records of students whose names start with the letter 'Z'.
50. Delete records of students enrolled in 'Physics' and have fees greater than 3000.
51. Delete all records from the Students table.
52. Delete records of students who do not have a course assigned (null values in StudentCourse).
53. Delete records of students whose names contain the substring 'ali'.
54. Delete records of students who are enrolled in either 'Biology' or 'Chemistry'.
55. Update the StudentFee to 5000 for all students enrolled in the 'Mathematics' course.
56. Update the StudentName to 'Asif for the student with StudentID equal to 3.
57. Increase the StudentFee by 10% for all students.
58. Update the StudentCourse to 'Computer Science' for students whose names start with 'A'.
59. Update the StudentFee to 2000 for students who are enrolled in 'Physics' and have a fee less
than 2000.
60. Set the StudentFee to NULL for students who are not enrolled in any course (null in
StudentCourse).
61. Update the StudentCourse to 'Undeclared' for all students who are not enrolled in any course
(null in StudentCourse).
62. Increase the StudentFee by 500 for students enrolled in 'Biology'
63. Change the StudentName to uppercase for all students in the Students table.