Question: 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 RepID 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 storereps
repID NUMBER
last VARCHAR
first VARCHAR
comm CHAR;
Change the STOREREPS table so that NULL values can't be entered in the name columns First and Last
Change the STOREREPS table so that only a or can be entered in the Comm column.
Add a column named Basesalary with a datatype of NUMBER to the STOREREPS table. Ensure that the amount entered is above zero.
Create a table named BOOKSTORES to include the columns listed in the following chart.
BOOKSTORES TABLE
Column Name
StoreID
Name
Contact
RepID
Datatype
NUMBER
VARCHAR
VARCHAR
VARCHAR
Constraint Comments
PRIMARY KEY column
Should be UNIQUE and NOT NULL
Add a constraint to make sure the RepID value entered in the BOOKSTORES table is a valid value contained in the STOREREPS table. The RepID 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 # so that associated rows of the BOOKSTORES table are deleted automatically if a row in the STOREREPS table is deleted.
Create a table named REPCONTRACTS containing the columns listed in the following chart. A composite PRIMARY KEY constraint including the RepID StoreID and
Quarter columns should be assigned. In addition, FOREIGN KEY constraints should be assigned to both the RepID and StoreID columns.
REPCONTRACTS TABLE
Column Name
Datatype
StoreID
Name
Quarter
RepID
NUMBER
VARCHAR
CHAR
NUMBER
Produce a list of information about all existing constraints on the STOREREPS table.
Issue the commands to disable and then enable the CHECK constraint on the Basesalary 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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
