Answered step by step
Verified Expert Solution
Link Copied!

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

P0704 Best Deals Stores
Starting with the relational data model below, create P0704.sql 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 bd_stores table.
Add CHECK constrains as follows:
o Store id in the range 1199 inclusive.
o Department id must be in the range 300399 inclusive.
o The birth date must be 1980 or later.
o The Social Security Number must be in the range 1999999999 inclusive.
o Gender must be 'F' or 'M'.
o Pension Contribution must be defined as a Boolean with a default value of 0 and
contain a value of 1 or 0.
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 300.
o The job class has a default value of 'T'.
o The job class must be 'T','J','C', or 'M'.
o The job level must be in the range 19 inclusive.
o Salary must be less than or equal to 125,000.00.
o Salary must be greater than commission.
o Bonus/Commission Must have a value for bonus or commission, but not both. Both
bonus and commission cannot be zero.
o Commission must be less than 8.5% of salary.Relational Data Model
Foreign Key Relationships
128
STORES.store_mgr_id EMPLOYEES.employee_id
EMPLOYEES.coach_id EMPLOYEES.employee_id
EMPLOYEES.store_id STORES.store_id
EMPLOYEES.department_id DEPARTMENTS.department_id
STORE_DEPARTMENTS.store_id STORES.store_id
STORE_DEPARTMENTS.department_id DEPARTMENTS.department_id

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions