SQL Foundations I Module 1

Generate statements (ddl) to create all objects

Only editable by group admins

  • Last updated August 24, 2016 at 1:07 PM
  • Evidence visible to public
Generate statements (ddl) to create all objects from the ERD. These must be valid SQL statements. It is recommended you use SQLFiddle to post working examples. Submit an URL where your work is located, with valid code.

All posted evidence

made it work in sql fiddle

kfowler About 8 years ago

Here's the code: http://pastebin.com/f2C6TEs7

Here's the code:

http://pastebin.com/f2C6TEs7

I would have used SQL fiddle but it doesn't seem like it agrees with the constraint syntax even though it's working fine in my local database. I used this exact snippet to populate my database on the school server.
kfowler About 8 years ago
I've chosen to use SQL Fiddle to dabble around with.

Here is the link to my complete ddl escapades:
http://sqlfiddle.com/#!9/d7319

In case the link doesn't work, here's a screenshot of my table creations:
https://gyazo.com/378ded091ad7eec1d919dc22b6876165

This is the ddl I used to create my tables (just a segment of the full ddl):
CREATE TABLE Orders
(   
OrderNumber int(9) NOT NULL,   
ShipByDate datetime,   
TimePrinted datetime,   
ItemsOrdered varchar(255),   
TotalCost decimal(10,2),   
PRIMARY KEY (OrderNumber)

;  

CREATE TABLE Products
(
ItemNumber char(8) NOT NULL,   
ItemDescription varchar(125),   
ItemLocation char(11),   
NumberInStock int(10),   
CaseQuantity int(10),   
PRIMARY KEY (ItemNumber)

;  

CREATE TABLE Customers 
(   
CustomerID varchar(9) NOT NULL,   
 FirstName varchar(10) NOT NULL,   
LastName varchar(10) NOT NULL,   
 PhoneNumber char(12),   
Address varchar(255) NOT NULL,   
PRIMARY KEY (CustomerID) 

;
slewis52 About 8 years ago