Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

SQL Assignment Table: student _ info Table: course _ infoQuestions: Create the student _ course _ enrollment table using SQL . ( 1 . 0

SQL Assignment
Table: student_info
Table: course_infoQuestions:
Create the student_course_enrollment table using
SQL.
(1.0 Marks)
Insert the student_course_enrollment data from the above
picture.
(1.0 Marks)
Retrieve the names and ages of students majoring in "Biology"
(1.0 Marks )
Calculate the average age of students majoring in
"Physics"
(1.0 Marks )
Retrieve the unique names of the courses from the course_info
table
(1.0 Marks )
Instructions:
Go to
https://sqliteonline.com/ and connect MS SQL to start writing
queries.
File Format:
You must have to include the SQL Query and Output of that query
Like this format.
> SQL-ASSIGNMENT-QUERY.SQL File with Question
Number, Query and Query Output
Screenshot of the Query and Output in Word Document
Table: student_course_enrollment
The creation of the student_info and course_info tables, along with the
data insertion queries, can be found in the attached SQL file named
student-and-course-table-create-and-data-insert.sql or in the code
snapshot.
-- Create the student_info table
CREATE TABLE student_info (
StudentID INT PRIMARY KEY,
Name VARCHAR(50),
Age INT,
Major VARCHAR(50)
;
-- Insert data into the student_info table
INSERT INTO student_info (StudentID, Name, Age, Major)
VALUES
(1, 'Alice', 20, 'Biology'),
(2, 'Bob', 21, 'History'),
(3, 'Carol', 19, 'Math'),
(4, 'David', 23, 'Physics'),
(5, 'Emily', 20, 'Biology'),
(6, 'Frank', 21, 'Physics');
-- Create the course_info table
CREATE TABLE course_info
CourseID INT PRIMARY KEY,
CourseName VARCHAR(100),
Instructor VARCHAR(100)
;
-- Insert data into the course_info table
INSERT INTO course_info (CourseID, CourseName, Instructor)
VALUES
(101, 'Biology 101','Dr. Smith'),
(102, 'History 101', 'Prof. White'),
(103, 'Math 101', 'Prof. Green'),
(104, 'Physics 101','Dr. Brown');

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