Lab 02 Company Database - Data

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

715041779.

docx 1

MSSV: 22207591
Họ tên SV: NGUYỄN QUỐC BẢO
Notes: Filename: Lab02_HoTen_MSSV_Data.docx
Lab 02
Company Database – Data

Insert Data
In 2 tables Employee and Department: when entering data into table, the data is
entered first and other is enterd next. After they can update.
 Department
DName DNumber Mgrssn MgrStartdate
Headquarters 1 888665555 06/19/1971
Administration 4 987654321 01/01/1985
Research 5 333445555 05/22/1978

 Employee
FName Minit LName SSN BDate Address Sex Salary Supper_SSN DNo
John B Smith 123456789 01/09/1955 Houston, M 30000 333445555 5
TX
Franklin T Wong 333445555 12/08/1945 Houston, M 40000 888665555 5
TX
Joyce A English 453453453 07/31/1962 Houston, F 25000 333445555 5
TX
Ramesh K Narayan 666884444 09/15/1952 Humble, M 38000 333445555 5
TX
James E Borg 888665555 11/10/1927 Houston, M 55000 NULL 1
TX
Jennifer S Wallace 987654321 06/20/1931 Bellaire, F 43000 888665555 4
TX
Ahmad V Jabbar 987987987 03/29/1959 Houston, M 25000 987654321 4
TX
Alicia J Zelaya 999887777 07/19/1958 Spring, F 25000 987654321 4
TX

 Dept_Location
DNumber DLocation
1 Houston
4 Stafford
5 Bellaire
5 Houston
5 Sugarland

 Project
PName PNumber PLocation DNum
ProductX 1 Bellaire 5
ProductY 2 Sugarland 5
ProductZ 3 Houston 5
Computerization 10 Stafford 4
Reorganization 20 Houston 1
Newbenefits 30 Stafford 4
715041779.docx 2

 Works_On
ESSN PNo Hours
123456789 1 32.5
123456789 2 7.5
333445555 2 10.0
333445555 3 10.0
333445555 10 10.0
333445555 20 10.0
453453453 1 20.0
453453453 2 20.0
666884444 3 40.0
888665555 20 NULL
987654321 20 15.0
987654321 30 20.0
987987987 10 35.0
987987987 30 5.0
999887777 10 10.0
999887777 30 30.0

 Dependent
ESSN Dependent_Name Sex BDate Relationship
123456789 Alice F 12/31/1978 Daughter
123456789 Elizabeth F 05/05/1957 Spouse
123456789 Michael M 01/01/1978 Son
333445555 Alice F 04/05/1976 Daughter
333445555 Joy F 05/03/1948 Spouse
333445555 Theodore M 10/25/1973 Son
987654321 Abner M 02/29/1932 Spouse

Note: Save to file Company_Data.sql


---- Data
-- Department
[Paste SQL statements here]
--Nhap dl
Use QBaone
Go
-- Department Data
Insert into Department values('Headquarters', 1, Null, '06/19/1971');
Go
Insert into Department values('Administration', 4, Null, '01/01/1985');
Go
Insert into Department values('Research', 5, Null, '05/22/1978');
Go
--update
update Department
Set MgrSsn = '888665555'
Where DNumber = 1;
Go
update Department
Set MgrSsn = '987654321'
Where DNumber = 4;
Go
715041779.docx 3

update Department
Set MgrSsn = '333445555'
Where DNumber = 5;
Go
select * from Department
-- Employee
--Employee Data
Insert into Employee values('James', 'E', 'Borg', '888665555', '11/10/1927',
'Houston, TX', 'M', 55000, NULL, 1);
Go
Insert into Employee values('Franklin', 'T', 'Wong', '333445555',
'12/08/1945', 'Houston, TX', 'M', 40000, '888665555', 5);
Go
Insert into Employee values('Jennifer', 'S', 'Wallace', '987654321',
'06/20/1931', 'Bellaire, TX', 'F', 43000, '888665555', 4);
Go
Insert into Employee values('John', 'B', 'Smith', '123456789', '01/09/1955',
'Houston, TX', 'M', 30000, '333445555', 5);
Go
Insert into Employee values('Joyce', 'A', 'English', '453453453', '07/31/1962',
'Houston, TX', 'F', 25000, '333445555', 5);
Go
Insert into Employee values('Ramesh', 'K', 'Narayan', '666884444',
'09/15/1952', 'Humble, TX', 'M', 38000, '333445555', 5);
Go
Insert into Employee values('Ahmad', 'V', 'Jabbar', '987987987', '03/29/1959',
'Houston, TX', 'M', 25000, '987654321', 4);
Go
Insert into Employee values('Alicia', 'J', 'Zelaya', '999887777',
'07/19/1958', 'Spring, TX', 'F', 25000, '987654321', 4);
Go
select * from Employee
-- Dept_Location
--Dept_Location Data
Insert into Dept_Location values('1','Houston');
Go
Insert into Dept_Location values('4','Stafford');
Go
Insert into Dept_Location values('5','Bellaire');
Go
Insert into Dept_Location values('5','Houston');
Go
Insert into Dept_Location values('5','Sugarland');
Go
select * from Dept_Location
-- Project
--Project Data
Insert into Project values('ProductX',1,'Bellaire',5);
Go
Insert into Project values('ProductY',2,'Sugarland',5);
Go
Insert into Project values('ProductZ',3,'Houston',5);
Go
Insert into Project values('Computerization',10,'Stafford',4);
Go
Insert into Project values('Reorganization',20,'Houston',1);
Go
Insert into Project values('Newbenefits',30,'Stafford',4);
Go
select * from Project
-- Works_On
715041779.docx 4

--Works_On data
Insert into Works_On values('123456789',1,'32.5');
Go
Insert into Works_On values('123456789',2,'7.5');
Go
Insert into Works_On values('333445555',2,'10.0');
Go
Insert into Works_On values('333445555',3,'10.0');
Go
Insert into Works_On values('333445555',10,'10.0');
Go
Insert into Works_On values('333445555',20,'10.0');
Go
Insert into Works_On values('453453453',1,'20.0');
Go
Insert into Works_On values('453453453',2,'20.0');
Go
Insert into Works_On values('666884444',3,'40.0');
Go
Insert into Works_On values('888665555',20,NULL);
Go
Insert into Works_On values('987654321',20,'15.0');
Go
Insert into Works_On values('987654321',30,'20.0');
Go
Insert into Works_On values('987987987',10,'35.0');
Go
Insert into Works_On values('987987987',30,'5.0');
Go
Insert into Works_On values('999887777',10,'10.0');
Go
Insert into Works_On values('999887777',30,'30.0');
Go
select * from Works_On
-- Dependent
--Dependent data
Insert into [dbo].[Dependent] values(123456789,'Alice','F','12/31/1978','Daughter');
Go
Insert into [dbo].[Dependent] values(123456789,'Elizabeth','F','05/05/1957','Spouse');
Go
Insert into [dbo].[Dependent] values(123456789,'Michael','M','01/01/1978 ','Son');
Go
Insert into [dbo].[Dependent] values(333445555,'Alice','F','04/05/1976','Daughter');
Go
Insert into [dbo].[Dependent] values(333445555,'Joy','F','05/03/1948','Spouse');
Go
Insert into [dbo].[Dependent] values(333445555,'Theodore','M','10/25/1973','Son');
Go
Insert into [dbo].[Dependent] values(987654321,'Abner','M','02/29/1932','Spouse');
Go
select * from [dbo].[Dependent]

END

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy