Question: Using MySQL syntax create and run the following SQL scripts for the problems listed below within the sales_co schema. A script needed to create the

Using MySQL syntax create and run the following SQL scripts for the problems listed below within the sales_co schema. A script needed to create the sales_co schema can be found on D2L named Sales_Company in the SQL Scripts content section. Submit the SQL you used to answer each question via the D2L Drop Box as a text or Word document. On the next page is an ERD of the sales_co schema for your reference. Each problem is worth 2 points.

Create a new table called SALEREP. The table structure should contain the following columns and constraints:

Column Name

Data type

Constraint

salerep_code

Numeric

Primary Key

salerep_first_name

Character

Not null

salerep_last_name

Character

Not null

Insert three new records into the SALEREP table with the following values:

salerep_code

salerep_first_name

salerep_last_name

12345

Don

Klingel

67890

99999

Dummys

Record

FNote: The text within the should be replaced with your actual first and last name.

Modify the existing CUSTOMER table to include a new column called salerep_code and make it a foreign key referencing the appropriate column in the new SALEREP table.

Update the salerep_code column in the CUSTOMER table to a value of 12345 when the cus_areacode is equal to 615 otherwise set the column value to 67890. DO NOT USE A CASE OR IF CLAUSE.

Remove from the SALEREP table any record with a first name equal to Dummys and a last name equal to Record. (Hint: Your SQL statement should use the salerep_first_name and salerep_last_name columns.)

Using MySQL syntax create and run the following SQL scripts for the

customer vendor cus_code INT(11) cus_lna me VARCHAR(15) cus-fname VARCH AR( 1 5) vcode INT(11) vname VARCHAR(35) v_contact VARCHAR (15) -areacode HAR(3) invoice inv number INT(11) cus-code INT(11) omy-date DATE Ind exes cus-initial CHAR(1) cus-areacode CHAR(3) v-phone CHAR(8) v state CHAR(2) rdeCHAR(1) cus_phone CHAR(8) cus-balance DEGMAL(92) Indexes Ind exes line invnumber INT(11) line number INT (11) p code VARCHAR (10) product p code VAROHAR (10) p descript VARCHAR(35) p indate DATE P-goh INT(11) OP-min INT(11) line-units DECIMAL(9,2) p price DECMAL (8,2) p discourt DECMAL(5,2) v-code INT(11) line-price DECIMAL(9,2) Indexes Indexes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!