SELECT d.DNUMBER, d.DNAME, e.SSN, e.FNAME + ' ' +e.LNAME
FROM department d
JOIN employee e ON d.MGRSSN = e.SSN;

SELECT d.DNAME, p.PNAME
FROM department d
JOIN project p ON d.DNUMBER = p.DNUM;

SELECT dependent.*, employee.FNAME + ' '+ employee.LNAME
FROM dependent
JOIN employee ON dependent.ESSN = employee.SSN;

SELECT PNUMBER, PNAME, PLOCATION
FROM project
WHERE PLOCATION in ('Cairo' ,'Alex');

SELECT *
FROM project
WHERE PNAME LIKE 'a%';

SELECT * 
FROM employee 
WHERE DNO = 30 AND SALARY BETWEEN 1000 AND 2000;

SELECT e.FNAME, e.LNAME
FROM employee e
JOIN employee m ON e.SUPERSSN = m.SSN
WHERE m.FNAME = 'Kamel' AND m.LNAME = 'Mohamed';

SELECT employee.FNAME +' ' + employee.LNAME, project.PNAME
FROM employee
JOIN works_on ON employee.SSN = works_on.ESSN
JOIN project ON works_on.PNO = project.PNUMBER
ORDER BY project.PNAME;

SELECT p.PNUMBER, d.DNAME, e.LNAME, e.ADDRESS, e.BDATE
FROM project p
JOIN department d ON p.DNUM = d.DNUMBER
JOIN employee e ON d.MGRSSN = e.SSN
WHERE p.PLOCATION = 'Cairo';

SELECT E.*
FROM Employee E
JOIN Department D ON E.SSN = D.MGRSSN;

SELECT e.*, d.DEPENDENT_NAME, d.RELATIONSHIP
FROM employee e
LEFT JOIN dependent d ON e.SSN = d.ESSN;



INSERT INTO Employee (Fname, Lname, SSN, Address, Sex, Salary, SuperSSN)
VALUES ('Haneen', 'Elladam', '102672',  'Cairo', 'F', 3000, '112233');

INSERT INTO Employee (Fname, Lname, SSN, Address, Sex)
VALUES ('ahmed', 'mohammed', '102660', 'Cairo', 'M');

UPDATE Employee
SET Salary = Salary * 1.2;













