Answered step by step
Verified Expert Solution
Question
1 Approved Answer
P 0 7 0 4 Best Deals Stores Starting with the relational data model below, create P 0 7 0 4 . sql and perform
P Best Deals Stores
Starting with the relational data model below, create Psql and perform the following:
Create the database from the relational model.
Determine the data types and lengths.
Use bd as a prefix to each table name.
Add Database Constraints
NOT NULL column optionality constraints at the column level, except store id and city.
Add DEFAULT constraints at the column level.
Create ALTER TABLE statements for PKs FKs and UKs.
Use the ALTER TABLE statement to add the NOT NULL constraint for the store id and city columns
in the bdstores table.
Add CHECK constrains as follows:
o Store id in the range inclusive.
o Department id must be in the range inclusive.
o The birth date must be or later.
o The Social Security Number must be in the range inclusive.
o Gender must be F or M
o Pension Contribution must be defined as a Boolean with a default value of and
contain a value of or
o The hire date has a default value of the current date.
o The hire date must be later than the birth date.
o The department ID has a default value of
o The job class has a default value of T
o The job class must be TJC or M
o The job level must be in the range inclusive.
o Salary must be less than or equal to
o Salary must be greater than commission.
o BonusCommission Must have a value for bonus or commission, but not both. Both
bonus and commission cannot be zero.
o Commission must be less than of salary.Relational Data Model
Foreign Key Relationships
STORES.storemgrid EMPLOYEES.employeeid
EMPLOYEES.coachid EMPLOYEES.employeeid
EMPLOYEES.storeid STORES.storeid
EMPLOYEES.departmentid DEPARTMENTS.departmentid
STOREDEPARTMENTS.storeid STORES.storeid
STOREDEPARTMENTS.departmentid DEPARTMENTS.departmentid
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started