Question: Write the SQL code that will create only the table structure for a table named EMP_1. This table will be a subset of the EMPLOYEE

  1. Write the SQL code that will create only the table structure for a table named

EMP_1. This table will be a subset of the EMPLOYEE table. The basic EMP_1

table structure is summarized in the following table. Use EMP_NUM as the pri-

mary key. Note that the JOB_CODE is the FK to JOB so be certain to enforce ref-

erential integrity. Your code should also prevent null entries in EMP_LNAME and

EMP_FNAME.

 Write the SQL code that will create only the table structure

  1. Having created the table structure in Problem 1, write the SQL code to enter the

first two rows for the table shown in Figure P8.2. Each row should be inserted indi-

vidually, without using a subquery. Insert the rows in the order that they are listed

in the figure.

for a table named EMP_1. This table will be a subset of

  1. Using the EMPLOYEE table that already exists, use a subquery to insert the remain-

ing rows from the EMPLOYEE table into the EMP_1 table. Remember, your sub-

query should only retrieve the columns needed for the EMP_1 table and only the

employees shown in the figure.

  1. Write the SQL code that will save the changes made to the EMP_1 table (if sup-

ported by your DBMS).

  1. Write the SQL code to change the job code to 501 for the person whose employee

number (EMP_NUM) is 107.

  1. Write the SQL code to delete the row for William Smithfield, who was hired on June

22, 2004, and whose job code is 500. (Hint: Use logical operators to include all of

the information given in this problem. Remember, if you are using MySQL, you will

have to first disable safe mode.)

TABLE P8.1 CONSTRUCTCO DATABASE STRUCTURE ATTRIBUTE (FIELD) NAME DATA DECLARATION EMPNUM CHAR(3) EMP_LNAME VARCHAR(15) EMP_FNAME VARCHAR(15) EMP_INITIAL CHAR(1) EMP_HIREDATE DATE JOB_CODE CHAR(3) FIGURE P8.2 THE CONTENTS OF THE EMP_1 TABLE EMP_NUM EMP_LNAME 101 News 102 Senior 103 Arbough 104 Ramoras 105 Johnson 106 Smithfield 107 Alonzo 108 Washington 109 Smith EMP_FNAME EMP_INITIAL John G David H June E Anne K Alice K William Maria D Ralph B Larry w EMP_HIREDATE JOB_CODE 08-Nov-00 502 12-Jul-89 501 01-Dec-96 500 15-Nov-87 501 01-Feb-93 502 22-Jun-04 500 10-Oct-93 500 22-Aug-91 501 18-Jul-97 501

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!