clear markdown compare help donate or buy diddy dollings comments/suggestions/bugs a leap of faith? bible365
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 709940 fiddles created (14162 in the last week).

create table emp(empid INT, name text, dept_id int, salary int); Insert into emp values(1,'Rob', 1, 100); Insert into emp values(2,'Mark', 1, 300); Insert into emp values(3,'John', 2, 100); Insert into emp values(4,'Mary', 2, 300); Insert into emp values(5,'Bill', 3, 700); Insert into emp values(6,'Jose', 6, 400); create table department(deptid INT, name text); Insert into department values(1,'IT'); Insert into department values(2,'Accounts'); Insert into department values(3,'Security'); Insert into department values(4,'HR'); Insert into department values(5,'R&D');
1 rows affected
1 rows affected
1 rows affected
1 rows affected
1 rows affected
1 rows affected
1 rows affected
1 rows affected
1 rows affected
1 rows affected
1 rows affected
 hidden batch(es)


Select * from emp;
empid name dept_id salary
1 Rob 1 100
2 Mark 1 300
3 John 2 100
4 Mary 2 300
5 Bill 3 700
6 Jose 6 400
 hidden batch(es)


Select * from department;
deptid name
1 IT
2 Accounts
3 Security
4 HR
5 R&D
 hidden batch(es)


-- INNER JOIN Select a.empid, a.name, b.name as dept_name FROM emp a JOIN department b ON a.dept_id = b.deptid ;
empid name dept_name
1 Rob IT
2 Mark IT
3 John Accounts
4 Mary Accounts
5 Bill Security
 hidden batch(es)


-- LEFT JOIN Select a.empid, a.name, b.name as dept_name FROM emp a LEFT JOIN department b ON a.dept_id = b.deptid ;
empid name dept_name
1 Rob IT
2 Mark IT
3 John Accounts
4 Mary Accounts
5 Bill Security
6 Jose
 hidden batch(es)