4 employees Data Type Length NULL Constraints Capable Attribute Employee ID (PK) Numeric Character 15 5,0 N Unique identifier First name N Middle Initial Character 1 Y Last Name Character 15 N Hire Date Date 10 N • If unknown, use current date

A Guide to SQL
9th Edition
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Philip J. Pratt
Chapter7: Database Administration
Section: Chapter Questions
Problem 4TD: Write, but do not execute, the commands to grant the following privileges: a. User Ashton must be...
icon
Related questions
Question
Based on sql database
4 employees
Data Type Length NULL
|Сарable|
Attribute
Constraints
Employee ID (PK) Numeric
5,0
N
• Unique identifier
First name
Character
15
N
Middle Initial
Character
1
Y
Last Name
Character
15
N
• If unknown, use current date
• Must be greater than birth date
Hire Date
Date
10
N
Store Location
Numeric
2,0
• Must be a valid location
Work Department Numeric
4,0
Y
• If unknown, use '1000'
• Must be a valid department
• If unknown, use 'T'
• Must be "T', 'J', 'C', or 'M'
Job Class
Character
1
Y
Coach ID
Numeric
5,0
Y
• Must be a valid employee
• Must be less than 92000.00
• Must be greater than commission
Salary
Numeric
9,2
N
Bonus
Numeric
7,2
Y
• Must have commission or bonus
Commission
Numeric
7,2
Y
• Must have commission or bonus
1. Create the 4 tables and include the constraints
2. Constraint Testing – Test each constraint by listing each
constraint and providing a test to validate that each
constraint is working:
Include an INSERT statement to "force" a
а.
constraint
For example, modify the
employee_id so that it is the same as the
employee_id in the previous row. This will force a
primary key error when the INSERT statement is
error.
run
b. Run the INSERT statement and verify that the error
occurred
Take a screen shot of the error and insert into the
с.
constraint testing document
d. Move to the next constraint and perform a constraint
test
Transcribed Image Text:4 employees Data Type Length NULL |Сарable| Attribute Constraints Employee ID (PK) Numeric 5,0 N • Unique identifier First name Character 15 N Middle Initial Character 1 Y Last Name Character 15 N • If unknown, use current date • Must be greater than birth date Hire Date Date 10 N Store Location Numeric 2,0 • Must be a valid location Work Department Numeric 4,0 Y • If unknown, use '1000' • Must be a valid department • If unknown, use 'T' • Must be "T', 'J', 'C', or 'M' Job Class Character 1 Y Coach ID Numeric 5,0 Y • Must be a valid employee • Must be less than 92000.00 • Must be greater than commission Salary Numeric 9,2 N Bonus Numeric 7,2 Y • Must have commission or bonus Commission Numeric 7,2 Y • Must have commission or bonus 1. Create the 4 tables and include the constraints 2. Constraint Testing – Test each constraint by listing each constraint and providing a test to validate that each constraint is working: Include an INSERT statement to "force" a а. constraint For example, modify the employee_id so that it is the same as the employee_id in the previous row. This will force a primary key error when the INSERT statement is error. run b. Run the INSERT statement and verify that the error occurred Take a screen shot of the error and insert into the с. constraint testing document d. Move to the next constraint and perform a constraint test
1 locations
Attribute
Data Type Length NULL Capable Constraints
Location ID (PK) Numeric
Character| 20
2,0
N
City
N
Store Manager
Numeric
5,0
Must be a valid employee
Y
locations data:
location_id city
store_manager
11
Sarnia
null
London null
Toronto null
22
33
2 locations_departments
Attribute
Data Type Length NULL Capable Constraints
Numeric 2,0
department_id (PK) | Numeric
department_manager Numeric
location ID (PK)
N
Must be a valid location
4,0
N
Must be a valid department
5,0
Y
Must be a valid employee
3 departments
Attribute
Data Type Length NULL Capable
Department ID (PK) Numeric
Department name
4,0
N
Character 50
N
departments data:
department_id department_name
1001
IT
1002
Administration
Men's Clothing
Women's Clothing
1003
1004
1005
Kids
1006
Тoys
Transcribed Image Text:1 locations Attribute Data Type Length NULL Capable Constraints Location ID (PK) Numeric Character| 20 2,0 N City N Store Manager Numeric 5,0 Must be a valid employee Y locations data: location_id city store_manager 11 Sarnia null London null Toronto null 22 33 2 locations_departments Attribute Data Type Length NULL Capable Constraints Numeric 2,0 department_id (PK) | Numeric department_manager Numeric location ID (PK) N Must be a valid location 4,0 N Must be a valid department 5,0 Y Must be a valid employee 3 departments Attribute Data Type Length NULL Capable Department ID (PK) Numeric Department name 4,0 N Character 50 N departments data: department_id department_name 1001 IT 1002 Administration Men's Clothing Women's Clothing 1003 1004 1005 Kids 1006 Тoys
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Database Environment
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning