Lab_manual computer science class 12th
Lab_manual computer science class 12th
Program statement 18 - Create a relationship between two tables (e.g., Students and Courses) and write
queries that involve both tables.
Source code-
CREATE TABLE Courses (
CourseID INT PRIMARY KEY,
CourseName VARCHAR(50),
Teacher VARCHAR(50)
);
Basic queries
1. Retrieve the names of students along with their course teacher
SELECT Students.Name AS StudentName, Courses.CourseName, Courses.Teacher
FROM Students
JOIN Courses ON Students.CourseID = Courses.CourseID;