Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the following SQL command so that the Rep _ ID column is the PRIMARY KEY for the table and the default value of Y

Modify the following SQL command so that the Rep_ID column is the PRIMARY KEY for the table and the default value of Y is assigned to the Comm column. (The Comm
column indicates whether the sales representative earns commission.)
CREATE TABLE store_reps
(rep_ID NUMBER(5),
last VARCHAR2(15),
first VARCHAR2(10),
comm CHAR(1));
Change the STORE_REPS table so that NULL values can't be entered in the name columns (First and Last).
Change the STORE_REPS table so that only a Y or N can be entered in the Comm column.
Add a column named Base_salary with a datatype of NUMBER (7,2) to the STORE_REPS table. Ensure that the amount entered is above zero.
Create a table named BOOK_STORES to include the columns listed in the following chart.
BOOK_STORES TABLE
Column Name
Store_ID
Name
Contact
Rep_ID
Datatype
NUMBER(8)
VARCHAR2(30)
VARCHAR2(30)
VARCHAR2(5)
Constraint Comments
PRIMARY KEY column
Should be UNIQUE and NOT NULL
Add a constraint to make sure the Rep_ID value entered in the BOOK_STORES table is a valid value contained in the STORE_REPS table. The Rep_ID columns of both tables
were initially created as different datatypes. Does this cause an error when adding the constraint? Make table modifications as needed so that you can add the required
constraint.
Change the constraint created in Assignment #6 so that associated rows of the BOOK_STORES table are deleted automatically if a row in the STORE_REPS table is deleted.
Create a table named REP_CONTRACTS containing the columns listed in the following chart. A composite PRIMARY KEY constraint including the Rep_ID, Store_ID, and
Quarter columns should be assigned. In addition, FOREIGN KEY constraints should be assigned to both the Rep_ID and Store_ID columns.
REP_CONTRACTS TABLE
Column Name
Datatype
Store_ID
Name
Quarter
Rep_ID
NUMBER(8)
VARCHAR2(5)
CHAR(3)
NUMBER(5)
Produce a list of information about all existing constraints on the STORE_REPS table.
Issue the commands to disable and then enable the CHECK constraint on the Base_salary column.
Please make sure you submit the SQL (queries) and the results of the queries. Write the query, run it in Oracle Live, and show the results.
DATABASE PREPARATION
This chapter assumes you have created the initial JustLee Books database as instructed in Chapter 2.
image text in transcribed

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

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago