A little help to a SQL student.

[expired user #9365]'s profile image [expired user #9365] posted 8 years ago in General Permalink
Hello I am an IT student working on my final project for my database course. I am very new to Mysql so please bear with me.

I have to work with SQL Fiddle for the final project, and i have come across an issue I have no idea what to do about. When I create my tables i get a return of Wrong table name. here is the coding.

CREATE TABLE IF NOT EXISTS donut (
donutid INT NOT NULL auto_increment,
name VARCHAR(45) NOT NULL,
description VARCHAR (255) NULL DEFAULT NULL,
price DECIMAL(4,2) NOT NULL,
PRIMARY KEY (donutid));

CREATE TABLE IF NOT EXISTS customer (
custid INT NOT NULL auto_increment,
fname VARCHAR(45) NOT NULL,
lname VARCHAR(45) NOT NULL,
street VARCHAR(45) NOT NULL,
apt VARCHAR(45) NULL DEFAULT NULL,
state VARCHAR(2) NOT NULL,
zip INTEGER NOT NULL,
homep INTEGER(10) NULL DEFAULT NULL,
workp INTEGER(10) NULL DEFAULT NULL,
mobilep INTEGER(10) NULL DEFAULT NULL,
PRIMARY KEY (custid));

CREATE TABLE IF NOT EXISTS saleorder (
soid INTEGER NOT NULL auto_increment,
specialnotes VARCHAR (50) NULL DEFAULT NULL,
date DATETIME NOT NULL,
customer.custid INTEGER NOT NULL,
PRIMARY KEY (soid),
CONSTRAINT fk.saleorder.customer1
FOREIGN KEY (cust.custid)
ON DELETE no action
ON UPDATE no action);

any assistance or explanation would be helpful.
ansgar's profile image ansgar posted 8 years ago Permalink
I think the constraint clause must not contain dots.
kalvaro's profile image kalvaro posted 8 years ago Permalink
CREATE TABLE IF NOT EXISTS saleorder (
[...]
customer.custid INTEGER NOT NULL


Don't use dots in column names. They're actually allowed, but having access to the correct syntax won't do you any good.

P.S. Don't spam random forums that show up when you google for "SQL" ;-)

Please login to leave a reply, or register at first.