Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create the two tables for SQL and answer the questions below SQL Queries 1 . Courses ( Courses ) course _ id ( INT PRIMARY

Create the two tables for SQL and answer the questions below SQL Queries
1. Courses (Courses)
course_id (INT PRIMARY KEY): Unique identifier for each course
course_name (VARCHAR(255)): Name of the course
department_id (INT): Foreign key referencing the department_id in the
Departments table (not provided)
credits (INT): Number of credits for the course
2. Enrollments (Enrollments)
enrollment_id (INT PRIMARY KEY): Unique identifier for each enrollment
student_id (INT): Foreign key referencing the student_id in the Students table (not
provided)
course_id (INT): Foreign key referencing the course_id in the Courses table
semester (VARCHAR(10)): Semester the course was enrolled in (e.g., Fall 2024,
Spring 2025)
grade (CHAR(2)): Letter grade earned in the course (e.g., A, B, C, F)
Answer the following questions using SQL queries.
1. List all course names and their corresponding credit values.
2. Find the total number of courses offered by the university.
3. Retrieve the names of all courses with 3 or more credits.
4. List the first 5 course names
5. Find the total number of courses with exactly 3 credits.
6. Retrieve all courses offered in the Fall 2024 semester.
7. List all student IDs enrolled in the university.
8. Retrieve all courses with a course name starting with "Introduction to"(case-
sensitive).[Hint: Use LIKE operator.]
9. List all courses offered by the department number 3.
10. Find the list of course (course_id), number of students (student_id) during the
Fall 2024 semester who got A in the course. [Hint: use count and group by]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions