Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

SQL Join Practice Example, Slides of Database Management Systems (DBMS)

A practice example of SQL Join, including Cross Join, Inner Join, and Outer Join (Left, Right, Full). It shows how to create a table, build schema, and edit data. The example involves an employee table with columns such as empid, empname, and mgrid. The document demonstrates how to join the employee table with itself to retrieve information such as employee name and manager name. useful for students who want to practice SQL Join and understand how to retrieve data from multiple tables.

Typology: Slides

2021/2022

Available from 08/19/2022

SamenKhan
SamenKhan 🇵🇰

219 documents

1 / 9

Toggle sidebar

Related documents


Partial preview of the text

Download SQL Join Practice Example and more Slides Database Management Systems (DBMS) in PDF only on Docsity! Self Join Instructor: Lec Ayesha Naseer Recap SQL Join • Cross Join • Inner Join • Outer Join ( Left, Right, Full) Practice Example 1 create table employee 1 2 ( empid int primary key, 2 3 empname char(30), 3 select * from employee as ¢ 4 mgrid int references employee(empid) 4. inner join employee as m 5 )5 5 on e.mgrid = m, empid 6 insert into employee values (1, ‘ammir’, 3), (2, ‘amna’, 3), (3, ‘kashif’, null), (4, ‘a 4 Build Schema & | Edit Fullscreen .” Eo te Run SQL > Edit Fullscreen ¢” i empid empname mgrid empid empname mgrid 1 ammir 3 3 kashif (null) 2 amna 3 3 kashif (null) 4 ammir 2 2 amna 3 5 Adil 2 2 amna 3 1 create table employee 1 2 ( empid int primary key, 2 3 empname char(30), 3 select e.empname as ‘employee name’, m.empname as ‘manager name’ from employee as e 4 mgrid int references employee(empid) 4 inner join employee as m 5 )3 5 on e.mgrid = m. empid 6 insert into employee values (1, ‘ammir', 3), (2, ‘amma’, 3), (3, ‘kashif', null), (4, ‘a 4 i Build Schema & eli dat elo ae Ea te ela eo ee te employee name manager name ammir kashif amna kashif ammir amna Adil amna 1 create table employee 1 2 ( empid int primary key, 2 3 empname char (30), 3 select e.empname as ‘employee name’, m.empname as ' manager name’ from employee as e 4 mgrid int references employee(empid) 4 left outer join employee as m 5 )3 5 on e.mgrid = m. empid 6 insert into employee values (1, ‘ammir', 3), (2, ‘amna', 3), (3, ‘kashif', null), (4, ‘a 4 Goo employee name manager name ammir kashif amna kashif kashif (null) ammir amna Adil amna
Docsity logo



Copyright Š 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved