JustLee Books has become the exclusive distributor for a number of books. The co
ID: 3597666 • Letter: J
Question
JustLee Books has become the exclusive distributor for a number of books. The company now needs to assign sales representatives to retail bookstores to handle the new distribution duties. For these assignments, create new tables to support the following:
1. 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.)---------20 points
CREATE TABLE store_reps
(rep_ID NUMBER(5),
last VARCHAR2(15),
first VARCHAR2(10),
comm CHAR(1));
2. Change the STORE_REPS table so that NULL values can’t be entered in the name columns (First and Last).---------------------------------------------20 points
3. Change the STORE_REPS table so that only a Y or N can be entered in the Comm column. ---20 points
4. 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. ---------20 points
5. Create a table named BOOK_STORES to include the columns listed in the following chart.-----20 points
Explanation / Answer
1. CREATE TABLE store_reps
(rep_ID NUMBER(5),
last VARCHAR2(15),
first VARCHAR2(10),
comm CHAR(1)) DEFAULT 'Y',
PRIMARY KEY (rep_ID);
2. CREATE TABLE store_reps
(rep_ID NUMBER(5),
last VARCHAR2(15) NOT NULL,
first VARCHAR2(10) NOT NULL,
comm CHAR(1));
3.3. CREATE TABLE store_reps
(rep_ID NUMBER(5),
last VARCHAR2(15),
first VARCHAR2(10),
comm CHAR(1)) CHECK (comm = 'Y' OR comm = 'N');
4.CREATE TABLE store_reps
(rep_ID NUMBER(5),
last VARCHAR2(15),
first VARCHAR2(10),
comm CHAR(1))
Base_salary NUMBER(7,2) CHECK (Base_salary > 0);
5. Hey for this you didnot include any chart. How can I create a table.
**Comment for any further queries.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.