0% found this document useful (0 votes)
15 views

SQL

The document contains a series of SQL statements for inserting, updating, and deleting records in various tables. It also contains several SELECT statements to query data from tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

SQL

The document contains a series of SQL statements for inserting, updating, and deleting records in various tables. It also contains several SELECT statements to query data from tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1-

INSERT INTO Employee(Fname, Lname, SSN, BDATE, Address, Sex, Salary,


Superssn, Dno)

Values('Heba', 'Esmael', 102672, '1965-01-01 00:00:00+02', 'Mansoura',


'F',1500, 112233, 30);

2-

INSERT INTO Employee (Fname, Lname, SSN, BDATE, Address, Sex, Dno)

Values ('khlood', 'Esmael', 102660, '1965-01-01 00:00:00+02', 'Mansoura', 'F',


30);

3-

INSERT INTO Departments (Dname, DNum, MGRSSN, "MGRStart Date")

Values ('DEPT IT', 100, 112233, '1-11-2006');

4-

UPDATE Departments SET MGRSSN= NULL, "MGRStart Date"= NULL WHERE


DNum=20;

UPDATE Employee SET Dno = 100 WHERE SSN=968574;

UPDATE Departments SET MGRSSN= 968574, "MGRStart Date"= '10-11-2021'


WHERE DNUM= 100;

UPDATE Employee SET Dno = 20 WHERE SSN= 102672;


UPDATE Departments SET MGRSSN=102672, "MGRStart Date"= '10-11-2021'
WHERE DNUM= 20;

UPDATE Employee SET Superssn = 102672 WHERE SSN= 102660;

5-

UPDATE Employee SET Dno = 10 WHERE SSN = 102660;

UPDATE Departments SET MGRSSN= 102660, "MGRStart Date"= '10-11-2021'


WHERE DNum=10;

UPDATE Employee SET Superssn =102660 WHERE Superssn = 223344;

UPDATE Works_for SET ESSN =102660 WHERE ESSN=223344;

DELETE FROM Dependent WHERE ESSN=223344;

DELETE FROM Employee WHERE SSN=223344;

6-

UPDATE Employee SET Salary = (Salary*0.2) + Salary WHERE SSN=102672;

--

1-

SELECT * FROM Employee;

2-
SELECT Fname, Lname, Salary, Dno FROM Employee;

3-

SELECT Pname, Plocation, Dnum FROM Project;

4-

SELECT Fname || ' ' || Lname AS "Full Name", (Salary*12*0.1)+Salary AS


"ANNUAL COMM" FROM Employee;

5-

SELECT SSN, Fname || ' ' || Lname AS Name FROM Employee WHERE
Salary>1000;

6-

SELECT SSN, Fname || ' ' || Lname AS Name FROM Employee WHERE
Salary*12>10000;

7-

SELECT Fname || ' ' || Lname AS Name, Salary FROM Employee WHERE
Sex='F';

8-

SELECT DNum, Dname FROM Department WHERE MGRSSN=968574 ;

9-
SELECT Pnumber, Pname, Plocation FROM Project WHERE Dnum=10;

[email protected]

Opensource lab01-DBlab02

You might also like