CLASS 12 Important Topic Joins in MySQL
Lets Take an example to perform Join operation on MySql Table. This is very important Topic Class 12 Board Exam point of view
Practice this example to Understand Joins in MySQL
CREATE TABLE department(
CLASS 12 Important Topic Joins in MySQL
Lets Take an example to perform Join operation on MySql Table. This is very important Topic Class 12 Board Exam point of view
Practice this example to Understand Joins in MySQL
CREATE TABLE department(
DepartmentID INT PRIMARY KEY NOT NULL,DepartmentName VARCHAR(20));CREATE TABLE employee (LastName VARCHAR(20),DepartmentID INT REFERENCES department(DepartmentID));INSERT INTO departmentVALUES (31, 'Sales'),(33, 'Engineering'),(34, 'Clerical'),(35, 'Marketing');INSERT INTO employeeVALUES ('Rafferty', 31),('Jones', 33),('Heisenberg', 33),('Robinson', 34),('Smith', 34),('Williams', NULL);
SELECT *FROM employee INNER JOIN department ON 1=1;
SELECT *FROM employee CROSS JOIN department;
SELECT *FROM employee, department;SELECT employee.LastName, employee.DepartmentID, department.DepartmentNameFROM employeeINNER JOIN department ONemployee.DepartmentID = department.DepartmentID;SELECT employee.LastName, employee.DepartmentID, department.DepartmentNameFROM employee, departmentWHERE employee.DepartmentID = department.DepartmentID;SELECT *FROM employee JOIN departmentON employee.DepartmentID = department.DepartmentID;SELECT *FROM employee, departmentWHERE employee.DepartmentID = department.DepartmentID;SELECT *FROM employee INNER JOIN department USING (DepartmentID);
0 Comments
Please do note create link post in comment section