CREATE TABLE students(
id INT,
name VARCHAR(50),
age INT,
marks INT,
school VARCHAR(50)
);
INSERT INTO students(id, name, age, marks, school)
VALUES
(1, 'Rahul', 15, 85, 'gcs'),
(2, 'Priya', 14, 92, 'gcs'),
(3, 'Aman', 16, 78, 'gcs');
CREATE TABLE teachers(
id INT,
name VARCHAR(50),
experience INT,
subject VARCHAR(50),
school2 VARCHAR(50)
);
INSERT INTO teachers(id, name, experience, subject, school2)
VALUES
(1, 'Prof. Anamika', 7, 'English', 'gcs'),
(2, 'Prof. John', 12, 'Math', 'gcs'),
(3, 'Prof, Green', 5, 'Science', 'gcs');
SELECT * FROM students;
SELECT school
FROM teachers
INNER JOIN students
ON teachers.id = students.id;
/*SELECT students.name, teachers.subject, teachers.experience
FROM students
LEFT JOIN teachers
ON students.id=teachers.id;*/
/*SELECT students.name, teachers.subject, teachers.experience
FROM students
RIGHT JOIN teachers
ON students.id=teachers.id*/
SELECT students.name, teachers.subject, teachers.experience
FROM students
FULL OUTER JOIN teachers
ON students.id=teachers.id;
To embed this project on your website, copy the following code and paste it into your website's HTML: