SQL_조인
Updated:
create table employee (id integer, name text, dept_id integer);
insert into employee values(1, 'dekuma', 1);
insert into employee values(2, 'kimkc', 3);
insert into employee values(3, 'araikuma', 1);
insert into employee values(4, 'happykuma', 2);
insert into employee values(5, 'mykuma', 4);
insert into employee values(6, 'raccoon', 3);
select * from employee;
create table dept (id integer, name text);
insert into dept values (1,' sales');
insert into dept values (2, 'manage');
insert into dept values (3, 'dev');
select * from dept;
select * from employee inner join dept on employee.dept_id = dept.id;
select * from dept inner join employee on dept.id = employee.dept_id;
select employee.id, employee.name, dept.name from employee inner join dept on employee.dept_id = dept.id;
select name from employee inner join dept on employee.dept_id = dept.id;
Leave a comment