SQL ALL Hamza Nabil
SQL ALL Hamza Nabil
--DML
select * from person where name like '%r%' ; --%r ends with r r% starts with r %s%
s have letters before and after
--primaryKey
create table Department
(
Dept_id int,
Dept_name varchar(50),
Dept_location varchar(50),
constraint PK_Dept PRIMARY KEY (Dept_id) --Primary Key important.
);
--join
--inner join
select employee.first_name from employee join department
on employee.Dep_id=department.Dept_id
--left join
select employee.first_name from employee leftjoin department
on employee.Dep_id=department.Dept_id
--right join
select employee.first_name from employee rightjoin department
on employee.Dep_id=department.Dept_id
--full join
select employee.first_name from employee fulljoin department
on employee.Dep_id=department.Dept_id