Professional Documents
Culture Documents
Day 1
Day 1
Write a query to retrieve all columns for all students in the "students" table.
Filter students based on a specific condition:
Write a query to select the names of students who have a GPA greater than 3.5.
Sort students based on a column:
Write a query to display the names and ages of students in ascending order of their
ages.
Count the number of students:
Write a query to find the total number of students in the "students" table.
Find the average GPA of students:
Write a query to find the names and GPAs of the top 5 students based on their GPA.
Filter students by a specific major:
Write a query to select the names and majors of students majoring in Computer
Science.
Retrieve students from a specific city:
Write a query to display the names and addresses of students from a particular
city.
Join with another table:
If there's a "courses" table, write a query to retrieve the names of students and
the courses they are enrolled in.
Calculate the total credits taken by each student:
If there's a "courses" table with a "credits" column, write a query to find the
total credits taken by each student.