Question: Consider a database schema with the following tables: CREATE TABLE Students ( StudentID INT PRIMARY KEY, Name VARCHAR ( 5 0 ) , Age INT,

Consider a database schema with the following tables:
CREATE TABLE Students (
StudentID INT PRIMARY KEY,
Name VARCHAR(50),
Age INT,
GPA FLOAT );
CREATE TABLE Courses (
CourseID INT PRIMARY KEY,
CourseName VARCHAR(50));
CREATE TABLE Enrollments (
EnrollmentID INT PRIMARY KEY,
StudentID INT,
CourseID INT,
Grade FLOAT,
FOREIGN KEY (StudentID) REFERENCES Students(StudentID),
FOREIGN KEY (CourseID) REFERENCES Courses(CourseID));
Solve the following SQL problems by nesting queries.
1. Write an SQL query to find the names of students who are enrolled in the course 'Mathematics' and have a GPA greater than 3.5.
2. Assuming the same database schema, write an SQL query to find the average GPA of students who have enrolled in the course 'Physics'.
3. Extend the previous query to find the average GPA of students who have enrolled in the course 'Physics' and whose age is less than 25.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!