0% found this document useful (0 votes)
0 views2 pages

Join Queries

The document outlines the creation of two tables: 'employee' and 'department', including their respective fields and data types. It also includes SQL insert statements to populate these tables with sample data and various SQL queries to join the tables, retrieving employee details along with their department names. The queries demonstrate inner, left, right, and full joins between the employee and department tables.

Uploaded by

Saran Yesunathan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views2 pages

Join Queries

The document outlines the creation of two tables: 'employee' and 'department', including their respective fields and data types. It also includes SQL insert statements to populate these tables with sample data and various SQL queries to join the tables, retrieving employee details along with their department names. The queries demonstrate inner, left, right, and full joins between the employee and department tables.

Uploaded by

Saran Yesunathan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

create table employee

(
EmployeeID integer PRIMARY KEY,
FirstName varchar(200),
LastName varchar(200),
DateOfBirth Date,
Gender char(1),
DepartmentID integer
)

insert into employee


values(1001,'Aishwarya','Jayaram','2005-04-24','F',11),
(1002,'Anand','Venkat','2005-05-22','M',12),
(1003,'Bala','Sundaram','2004-11-02','M',13),
(1004,'Deepa','Mani','2004-12-09','F',11),
(1005,'Deepa','Mahesh','2005-05-29','F',14),
(1006,'Gokul','Ram','2004-11-27','M',13),
(1007,'Shreya','Gopi','2005-06-20','F',17),
(1008,'Abdul','Rahman','2005-07-30','M',18)

select * from employee

create table department


(
DepartmentID integer,
DepartmentName varchar(100)
)

insert into department


values(11,'Engineering'),
(12,'Finance'),
(13,'Sales'),
(14,'Marketing'),
(15,'Human Resources'),
(16,'IT')

select * from department

select * from employee


inner join department
on employee.DepartmentID = department.DepartmentID

select * from employee e


inner join department d
on e.DepartmentID =d.DepartmentID

select e.EmployeeID,e.FirstName,e.LastName,d.DepartmentName from employee e


inner join department d
on e.DepartmentID =d.DepartmentID

select * from employee e


left join department d
on e.DepartmentID =d.DepartmentID

select * from employee e


right join department d
on e.DepartmentID =d.DepartmentID

select * from employee e


full join department d
on e.DepartmentID =d.DepartmentID

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy