Escolar Documentos
Profissional Documentos
Cultura Documentos
Use the following sample tables, data, and constraints to answers the questions that follow:
EMP
EMP_FNAME John David June Anne Alice William Annelise default value
JOB
JOB_CLASS Application Designer Database Designer Elec. Engineer General Support Programmer Systems Analyst
PROJECT
PROJ PROJ
PROJ_EMP
PROJ
EMP
_NUM _NUM HOUR 15 15 15 18 18 103 101 105 114 118 23.8 19.4 35.7 24.6 25.3
emp_fname
emp_lname
Job_Class
hiredate
All chg_hour will default to a value of $15/hour if no value is specified during the insert. If a value is specified, then it must be >= $15.
0.
Table: JOB
Column Type Len gth job_code PK FK Required Not Null Unique Validation /Check Default
job_class
chg_hour
1. Create the EMP table from the sample data on the previous page. Also implement the following constraints.
Column Type Len gth Emp_Num int PK PK FK Required Not Null Unique Validation /Check Default
emp_fname
char
20
unknown
emp_lname
char
20
NN
unique
Job_Class
char
job (job_code)
hiredate
date
NN
>=1/1/1990
2. Create the JOB table from the sample data on the previous page. Also implement the following constraints.
Column Type Len gth job_code char 3 PK PK FK Required Not Null Unique Validation /Check Default
job_class
char
30
chg_hour
decimal
5,2
>=15
15
3. Add a new attribute to the JOB table named OvertimeCharge that must always have a value.
4.
Add a constraint to the JOB table that will ensure all CHG_HOUR data is >= 25.
5. Add a constraint that will add the value NA to all JOB_CLASS columns if no value is specified when the record is inserted into the table.
6.
Add a constraint that always requires a value entered into the CHG_HOUR column.
7. Change the CHG_HOUR column to store numbers up to 12 digits in length (including decimal points).
8.
9.
10.
Drop the chg_hour column and all of it's data from the job table.
11.
12.
2.
Update the employee fname to Jim instead of James for employee 118
3.
4.
Remove the row from the job table for job code PRG
5.
6.
Remove the employees from the employee table where the hiredate is before 1-Jan-90
7.
C) Select Commands:
1. Show the employee first and last names and their job class description and hourly charge.
2.
Same question as above, but only show the records where the chg_hour is <100
3.
Select the hours worked and lastname and hiredate for all employees.
4. Create a view called: WORK_INFO which will select the hours worked and lastname and hiredate for all employees hired before 1-jan-02.
5. Select employee fname and lname and all projects that they are working on. Save this select statement as a view called: EMP_PROJECTS
6. 18.
Select employee fname and lname and all projects that they are working on for project
7. Select all project names and job class descriptions that the project requires. Save this select statement as a view called: EMP_JOB_SKILLS
8. Select all project names and job class descriptions that the project requires for only the job code of DBD. Save this statement as a view called: DATABASE_DESIGNERS
9. Select customer first and last name, credit limit, and salesrep first and last name where the credit limit is >= 1500.