Using Figure P7.1 in the text as a guide, write the SQL/DDL to create the Job and EMPLOYEE tables. Note the cardinality requirements for the relationship indicates a foreign key and values are required. Write the SQL commands to add the first three records to the JOB table and the first three records to the EMPLOYEE table. a. What happens if you create the EMPLOYEE table before the JOB table? Why? b. What happens if you add an employee record with a JOB _CODE not present in the JOB table? Why?

A Guide to SQL
9th Edition
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Philip J. Pratt
Chapter6: Updating Data
Section: Chapter Questions
Problem 12SCG
icon
Related questions
icon
Concept explainers
Question
100%
Using Figure P7.1 in the text as a guide, write the SQL/DDL to create the Job and EMPLOYEE tables.
Note the cardinality requirements for the relationship indicates a foreign key and values are required.
Write the SQL commands to add the first three records to the JOB table and the first three records to
the EMPLOYEE table.
a. What happens if you create the EMPLOYEE table before the JOB table? Why?
b. What happens if you add an employee record with a JOB _CODE not present in the JOB table?
Why?
Transcribed Image Text:Using Figure P7.1 in the text as a guide, write the SQL/DDL to create the Job and EMPLOYEE tables. Note the cardinality requirements for the relationship indicates a foreign key and values are required. Write the SQL commands to add the first three records to the JOB table and the first three records to the EMPLOYEE table. a. What happens if you create the EMPLOYEE table before the JOB table? Why? b. What happens if you add an employee record with a JOB _CODE not present in the JOB table? Why?
Relational diagram
106
Pb Cade
500
501
002
500
504
505
506
508
5001
510
Job Description
ob Che Hou
ob Last Update
Table name: JOB
Joe CODE JOB DESCRIPTION JOB CHO HOUR JOB LAST UPDATE
20.Nov-17
20-Nov-17
24--18
15
10
22
25
Programmer
Svitent Analyst
EMPLOYEE
Ema Num
Emp Name
Emp ame
Ema Initial
Emp, MireDate
FES Code
Emp Years
Date Designer
Dectrical Engineer
Mechanical Engineer
Civil Engineer
Clerical Support
DSS Anwyst
Applications Designer
Bo Technician
General Support
-H---
Evergreen
Amber Wave
Rolling Tide
Starfight
35.75
96.75
Table name: PROJECT
PROJ NUM PROJ NAME PROJ VALLE
1453600.00
350050000
805000.00
265050000
12500
84.50
67 90
55.78
2687
45.96
45.10
34.55
10.30
ASSIGNMENT
PAsien m
Assign Date
FKZP
Nem
FC EmpNam
EMP
Aug
Ai Che --H-PLN
Assign Meurs
Assign, Charge
20-Nov-17
20-May-17
20-Nov-17
20-Nov-17
20-Nov-17
24-Mar-18
20-Nov-17
20-Nov-17
FROU BALANCE EMP NUM
1002350 00 103
2110346.00 100
500345 20 102
2309000.00 107
PROIECT
Prej Name
Pre Value
Prej Balance
FR3 Song Num
Table name: EMPLOYEE
| EMP_NUM | EMP_UNAME | EMP_FNAME
101 News
John
Senior David
Arbough June
102
Ramoras Anne
Johnson Alce
Willian
Smithfield
Abonzo
Marin
Maria
Washington
Ca
Smith
103
104
104
105
106
107
100
109
an
110
***
111
m
112
F
113
114
114
115
116
117
118
Clerko
visbath
Smithson
Terrood
s
Jones
Bawang
Pri
Geoff
Darlen
Darlene
Debert
Annelise
Travis
Gerald
Willianson Angie
Frommer Janes
23-Mar-18 25
24-3-10 25
24-15 15
24-Mar-18 22
24-at-10 22
24-10 22
24--16 15
24-3-10 18
117
163
100
104
113
103
115
117
105
100
115
104
163
105
112
117
104
201
Ralph
Larry
P
Gerald
Tom
105
115
105
183
117
103
509
500
833
501
501
108
503
501
109
502
501
801
501
503
102
509
509
601
Database name: Ch07_ConstructCo
| EMP_INITIAL|EMP_HIREDATE | JOB_CODE | EMP_YEARS
0
08-Nov-00 502
12-4-89 501
H
E
K
01-Dec-96 500
15-Nov-87 501
01-Feb-93 502
K
502
501
601
502
503
509
D
CIMO XEOXSCO
Table name: ASSIGNMENT
ASSIGN UM ASSION DATE PROJNUM EM UM ASSION JOB ASSIGN CHO HASSION HOURS ASSIGN CHARGE
1001
22--10 10
143
35
117.
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
22MM-10 22
22-M-15 18
22-a-10 18
22-MM-15 25
22-Mar-10 22
22-M-10 25
22-16 18
23-Mar-18 15
23-am-10 15
23-3M-15 25
23-10 18
23-ar-18 25
23-16 22
23-M-10 15
23--18 22
234-10 18
1012
1013
1014
1015
1016
1017
1018
1019
1030
1021
1022
1023
1034
1025
B
W
A
M
H
J
045
34.55
34.55
04.5
96.75
9575
93.75
845
95.75
34.65
105
91.75
96.75
96.75
04.5
105
34.55
34.55
9105
125
9105
1105
22-Jun-04 500
10-0d-93 600
125
845
34.55
22-Aug-91 501
16-A4-97 501
11-Jun-OR 40
11-Dec-95 505
MAE91 50
04-Apr-91 506
23-Oct-94 507
15-Nov-95 508
20-Aug-93 500
25-Jan-82 501
05-Mar-97 510
19-Jun-96 509
04-Jan-05 510
2
59
22
42
38
1.9
58
24
4.3
34
2
28
6.1
47
3.0
CEEEEEEEE
3.1
49
35
33
42
296.75
145.11
091
490.56
212.06
405.35
100
76.05
541 8
82.92
4515
3309.95
1935
2709
$15.45
4936
131.29
76.01
541.45
367 5
290.35
541.45
4375
270.05
145.11
17
20
21
310
25
n
13
E
24
26
5
20
m
22
V
27
23
2
21
24
24
25
21
21
13
Transcribed Image Text:Relational diagram 106 Pb Cade 500 501 002 500 504 505 506 508 5001 510 Job Description ob Che Hou ob Last Update Table name: JOB Joe CODE JOB DESCRIPTION JOB CHO HOUR JOB LAST UPDATE 20.Nov-17 20-Nov-17 24--18 15 10 22 25 Programmer Svitent Analyst EMPLOYEE Ema Num Emp Name Emp ame Ema Initial Emp, MireDate FES Code Emp Years Date Designer Dectrical Engineer Mechanical Engineer Civil Engineer Clerical Support DSS Anwyst Applications Designer Bo Technician General Support -H--- Evergreen Amber Wave Rolling Tide Starfight 35.75 96.75 Table name: PROJECT PROJ NUM PROJ NAME PROJ VALLE 1453600.00 350050000 805000.00 265050000 12500 84.50 67 90 55.78 2687 45.96 45.10 34.55 10.30 ASSIGNMENT PAsien m Assign Date FKZP Nem FC EmpNam EMP Aug Ai Che --H-PLN Assign Meurs Assign, Charge 20-Nov-17 20-May-17 20-Nov-17 20-Nov-17 20-Nov-17 24-Mar-18 20-Nov-17 20-Nov-17 FROU BALANCE EMP NUM 1002350 00 103 2110346.00 100 500345 20 102 2309000.00 107 PROIECT Prej Name Pre Value Prej Balance FR3 Song Num Table name: EMPLOYEE | EMP_NUM | EMP_UNAME | EMP_FNAME 101 News John Senior David Arbough June 102 Ramoras Anne Johnson Alce Willian Smithfield Abonzo Marin Maria Washington Ca Smith 103 104 104 105 106 107 100 109 an 110 *** 111 m 112 F 113 114 114 115 116 117 118 Clerko visbath Smithson Terrood s Jones Bawang Pri Geoff Darlen Darlene Debert Annelise Travis Gerald Willianson Angie Frommer Janes 23-Mar-18 25 24-3-10 25 24-15 15 24-Mar-18 22 24-at-10 22 24-10 22 24--16 15 24-3-10 18 117 163 100 104 113 103 115 117 105 100 115 104 163 105 112 117 104 201 Ralph Larry P Gerald Tom 105 115 105 183 117 103 509 500 833 501 501 108 503 501 109 502 501 801 501 503 102 509 509 601 Database name: Ch07_ConstructCo | EMP_INITIAL|EMP_HIREDATE | JOB_CODE | EMP_YEARS 0 08-Nov-00 502 12-4-89 501 H E K 01-Dec-96 500 15-Nov-87 501 01-Feb-93 502 K 502 501 601 502 503 509 D CIMO XEOXSCO Table name: ASSIGNMENT ASSIGN UM ASSION DATE PROJNUM EM UM ASSION JOB ASSIGN CHO HASSION HOURS ASSIGN CHARGE 1001 22--10 10 143 35 117. 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 22MM-10 22 22-M-15 18 22-a-10 18 22-MM-15 25 22-Mar-10 22 22-M-10 25 22-16 18 23-Mar-18 15 23-am-10 15 23-3M-15 25 23-10 18 23-ar-18 25 23-16 22 23-M-10 15 23--18 22 234-10 18 1012 1013 1014 1015 1016 1017 1018 1019 1030 1021 1022 1023 1034 1025 B W A M H J 045 34.55 34.55 04.5 96.75 9575 93.75 845 95.75 34.65 105 91.75 96.75 96.75 04.5 105 34.55 34.55 9105 125 9105 1105 22-Jun-04 500 10-0d-93 600 125 845 34.55 22-Aug-91 501 16-A4-97 501 11-Jun-OR 40 11-Dec-95 505 MAE91 50 04-Apr-91 506 23-Oct-94 507 15-Nov-95 508 20-Aug-93 500 25-Jan-82 501 05-Mar-97 510 19-Jun-96 509 04-Jan-05 510 2 59 22 42 38 1.9 58 24 4.3 34 2 28 6.1 47 3.0 CEEEEEEEE 3.1 49 35 33 42 296.75 145.11 091 490.56 212.06 405.35 100 76.05 541 8 82.92 4515 3309.95 1935 2709 $15.45 4936 131.29 76.01 541.45 367 5 290.35 541.45 4375 270.05 145.11 17 20 21 310 25 n 13 E 24 26 5 20 m 22 V 27 23 2 21 24 24 25 21 21 13
Expert Solution
steps

Step by step

Solved in 6 steps

Blurred answer
Knowledge Booster
Query Syntax
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning