Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

MySQL:

Will you write the code in MySQL using the instructions I provided?

 

     Create a table named cityState with the following attributes, data types, and constraints:

a.       city, variable character, 90 characters, not null

b.      state, character, 2 characters, not null

c.       zipCode, character, 5 characters, not null, unique

d.      primary key is the zipCode field

Insert into table cityState data from file cityState.sql

Alter table employee so that column zipCode is a foreign key to table cityState, column zipCode

Alter table customer so that column zipCode is a foreign key to table cityState, column zipCode

Create view customerView with a join query to join tables customer and cityState to do the following:

a.       Select column firstName from table customer

b.      Select column lastname from table customer

c.       Select column address from table customer

d.      Select column city from table cityState

e.       Select column state from table cityState

f.        Select column zipCode from table customer

g.      Select column phone from table customer

h.      Select column email from table customer

Create view employeeView with a join query to join tables employee and cityState to do the following:

a.       Select column firstName from table employee

b.      Select column lastname from table employee

c.       Select column address from table employee

d.      Select column city from table cityState

e.       Select column state from table cityState

f.        Select column zipCode from table employee

g.      Select column phone from table employee

h.      Select column email from table employee

Create a table named sale with the following attributes, data types, and constraints:

a.       employeeId, int, not null

b.      customerId, int, not null

c.       vehicleId, int, not null

d.      salePrice, decimal, 8 characters total, 2 characters to the right of the decimal point, not null

e.       primary key is fields employeeId, customerId, and vehicleId

f.        foreign key on field employeeId, references table employee, column id

g.      foreign key on field customerId, references table customer, column id

h.      foreign key on field vehicleId, references table vehicle, column id

I will rate the work if all my questions are answered. Thanks!

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education