-3

I'm using SQL Fiddle, and I'm unable to run a simple query (SELECT * FROM CUSTOMER;) after building my schema with the code below. The only error I get is "Oops! Something went wrong. Try it again and if this keeps happening, email admin@sqlfiddle.com about it." Before I email SQL Fiddle, I figured I'd check if there's something wrong in my schema that's causing the issue.

CREATE TABLE CUSTOMER (
C_CUSTOMER_ID  INTEGER(3)   NOT NULL  UNIQUE,
C_LNAME        VARCHAR(20)  NOT NULL,
C_FNAME        VARCHAR(15)  NOT NULL,
C_ADDRESS      VARCHAR(50)  NOT NULL,
C_CITY         VARCHAR(25)  NOT NULL,
C_STATE        CHAR(2)      NOT NULL,
C_ZIP          CHAR(5)      NOT NULL,
C_HOME_PHONE   CHAR(10)     NOT NULL,
C_MOB_PHONE    CHAR(10),
C_OTH_PHONE    CHAR(10),
PRIMARY KEY (C_CUSTOMER_ID));

CREATE TABLE ORDER_TABLE (
ORDER_ID       INTEGER(5)   NOT NULL  UNIQUE,
ORDER_DATE     DATETIME     NOT NULL,
ORDER_NOTES    VARCHAR(250) NOT NULL,
C_CUSTOMER_ID  INTEGER,
PRIMARY KEY (ORDER_ID),
FOREIGN KEY (C_CUSTOMER_ID) REFERENCES CUSTOMER(C_CUSTOMER_ID));

CREATE TABLE DONUT (
DONUT_ID     INTEGER(3)       NOT NULL  UNIQUE,
DONUT_NAME   VARCHAR(15)  NOT NULL,
DONUT_DESCR  VARCHAR(50)  NOT NULL,
DONUT_PRICE  DECIMAL(2,2) NOT NULL,
PRIMARY KEY (DONUT_ID));

CREATE TABLE LINE_ITEMS (
DONUT_ID   INTEGER    NOT NULL,
ORDER_ID   INTEGER    NOT NULL,
QUANTITY INTEGER(3) NOT NULL,
PRIMARY KEY (DONUT_ID, ORDER_ID),
FOREIGN KEY (DONUT_ID) REFERENCES DONUT(DONUT_ID),
FOREIGN KEY (ORDER_ID) REFERENCES ORDER_TABLE(ORDER_ID));
Ashley Lee
  • 3,810
  • 1
  • 18
  • 26
  • its giving "Column, parameter, or variable #1: Cannot specify a column width on data type int." on fiddle, please put correct sql. – Anil Mar 20 '17 at 08:57
  • I havent used sqlfiddle before. but here trying to help you narrowing your problem, have you tried the simplest select? select '1', 2 will it work? – Boyke Ferdinandes Mar 20 '17 at 03:03

1 Answers1

1

SQL Fiddle has had issues for several years (see link), and hasn't had an update to the source they have on GitHub for over 2 years. Also, looking at all sqlfiddler tags at SO, many people are having similar issues.

I tried your code on RexTester and it works without issues so I would imagine it's another issue with SQL Fiddle and not your code.

Community
  • 1
  • 1
Ashley Lee
  • 3,810
  • 1
  • 18
  • 26
  • Interesting, as I hit that link in both IE and Chrome and get the "Oops! Something went wrong." in both browsers. Dev tools shows as 504 Gateway Timeout. – Ashley Lee Mar 20 '17 at 15:36
  • I also get two three timeouts in chrome, later it worked in IE and chrome. – Anil Mar 20 '17 at 17:34
  • It looks like you're right. I gave it another try today and now it decided to work. I'd give RexTester a try, but it sounds like I'm stuck with SQL Fiddle for completing this assignment. Thanks guys! – MysteriousMuffins Mar 20 '17 at 22:25