Thread: MySql Error
View Single Post
Old Feb 25th, 2007, 11:30 PM   #3
paulchwd
Hobbyist Programmer
 
paulchwd's Avatar
 
Join Date: Mar 2005
Posts: 139
Rep Power: 4 paulchwd is on a distinguished road
Question 1 problem fixed

Thanks, your right, apparently number isn't a data type (although it is in Oracle). And I changed the varchar2 cols to text

but i still get the following errors:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'NULL,
descriptionID char(4) REFERENCES description (descriptionID) NOT NUL' at line 7


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'NOT NULL,
product TEXT NOT NULL,
price DECIMAL(6,2) ' at line 3


changed code:

--Invoice Database 

drop table description;
drop table invoice;
drop table website;
drop table customer;


CREATE TABLE Customer
(customerID   char(3)  Primary Key,
firstName     char(30),
lastName      char(30), 
company       char(50),
streetNumber  char(10),
streetName    char(30),
city          char(20),
prov          char(20),
postal        char(7),      
phone         char(14),      
phone2        char(14),     
cell          char(14),      
home          char(14),      
fax           char(14),      
customerDate  date     NOT NULL,
domain        char(40) REFERENCES website (domain));


CREATE TABLE website
(domain         char(40) PRIMARY KEY,
customerID      char(3)  REFERENCES Customer (customerID),
dateRegistered  date     NOT NULL,
dateExpires     date     NOT NULL,
amountPaid      DECIMAL(6,2));


CREATE TABLE invoice
(invoiceNumber char(4)     PRIMARY KEY,
customerID     char(3)     REFERENCES customer (customerID),
dateIssued     date        NOT NULL,
dateDue        date        NOT NULL,
datePaid       date,
status         char(10)    CHECK (status IN ('paid','unpaid','part-paid')) NOT NULL,
descriptionID  char(4)     REFERENCES description (descriptionID) NOT NULL,
subTotal       DECIMAL(6,2) NOT NULL,
PSTexempt      char(3),     
totalPST       DECIMAL(6,2)
totalDue       DECIMAL(6,2) NOT NULL,
comments       TEXT);


CREATE TABLE description
(descriptionID char(4)        PRIMARY KEY,
invoiceNumber  char(4)        REFERENCES invoice(invoiceNumber) NOT NULL,
product        TEXT           NOT NULL,
price          DECIMAL(6,2)   NOT NULL,
PSTexempt      char(3)        CHECK (PSTexempt IN ('yes','no')) NOT NULL,
PSTamount      DECIMAL(6,2));

Last edited by paulchwd; Feb 25th, 2007 at 11:46 PM.
paulchwd is offline   Reply With Quote