mysqlsql-serverdatabasesqlfiddle

Unable to Query Table with SQL Fiddle


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));

Solution

  • 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.