Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Trying to Write an SQL Table for Class and Keep Running into ERROR 1 0 6 4 ( 4 2 0 0 0 ) :

Trying to Write an SQL Table for Class and Keep Running into "ERROR 1064(42000): You have an error in your SQL syntax" Here are the Details of my Table:
mysql> CREATE TABLE Customers(
-> Customer_ID INT,
-> First_Name VARCHAR(25),
-> Last_Name VARCHAR(25),
-> Street VARCHAR(50),
-> City VARCHAR(50),
-> State VARCHAR(25),
-> Zip_Code VARCHAR(10),
-> Telephone VARCHAR(15),
-> PRIMARY KEY (Customer_ID)
->);
Query OK,0 rows affected (0.47 sec)
mysql> DESCRIBE Customers;
+-------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| Customer_ID | int | NO | PRI | NULL ||
| First_Name | varchar(25)| YES || NULL ||
| Last_Name | varchar(25)| YES || NULL ||
| Street | varchar(50)| YES || NULL ||
| City | varchar(50)| YES || NULL ||
| State | varchar(25)| YES || NULL ||
| Zip_Code | varchar(10)| YES || NULL ||
| Telephone | varchar(15)| YES || NULL ||
+-------------+-------------+------+-----+---------+-------+
8 rows in set (0.01 sec)
mysql> CREATE TABLE Orders(
-> Order_ID INT,
-> Customer_ID INT,
-> SKU VARCHAR(20),
-> Description VARCHAR(50),
-> PRIMARY KEY (Order_ID),
-> FOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)
->);
Query OK,0 rows affected (0.45 sec)
mysql> DESCRIBE Orders;
+-------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| Order_ID | int | NO | PRI | NULL ||
| Customer_ID | int | YES | MUL | NULL ||
| SKU | varchar(20)| YES || NULL ||
| Description | varchar(50)| YES || NULL ||
+-------------+-------------+------+-----+---------+-------+
4 rows in set (0.01 sec)
mysql> CREATE TABLE RMA(
-> RMA_ID INT,
-> Order_ID INT,
-> Step VARCHAR(50),
-> Status VARCHAR(15),
-> Reason VARCHAR(15),
-> PRIMARY KEY (RMA_ID),
-> FOREIGN KEY (Order_ID) REFERENCES Orders (Order_ID)
->);
Query OK,0 rows affected (0.74 sec)
mysql> DESCRIBE RMA;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| RMA_ID | int | NO | PRI | NULL ||
| Order_ID | int | YES | MUL | NULL ||
| Step | varchar(50)| YES || NULL ||
| Status | varchar(15)| YES || NULL ||
| Reason | varchar(15)| YES || NULL ||
+----------+-------------+------+-----+---------+-------+
5 rows in set (0.00 sec)
mysql> INSERT INTO Customers VALUES
->(10001,Thomas,Bonner,My Street,Tampa,FL,33611,555-555-5555),
->(10002,Marla,Singer,Fight Club,Los Angles,CA,101599,555-555-1999),
->(10003,Robert,Bonner,Bro Circle,Tampa,FL,33616,555-555-1975),
->(10004,Sheldon<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions