Search code examples
sqlsqlfiddle

Why is this SQL code not working on SQLFiddle.com?


I want to put this on the SQL fiddle site for another company that I am working for and it seems that it does not like my syntax. The site uses the SQL Server syntax so I am curious as to why this will not work.

The create table code does work correctly. It is the insert data into the table that is cause the so called glitch.

I am in the process of learning SQL and how to use the SQLFiddle Site. This is code that I am using to see if I can make the SQLFiddle site build the database so that I can test it with different SQL query statements.

Question: Why is this code not compiling and running on the SQL Fiddle Site?

Code

CREATE TABLE myTable (ID  integer     null,
                      AAA varchar(20) null,
                      BBB varchar(40) null,
                      CCC varchar(40) null,
                      DDD varchar(40) null);

INSERT INTO myTable (ID, 
                     AAA, 
                     BBB, 
                     CCC,
                     DDD)
       VALUES  (1,
               'Tom B. Erichsen',
               'Skagen 21',
               'Stavanger',
               '4006'),

               (2,
               'Tom B. Erichsen',
               'Skagen 21',
               'Stavanger',
               '4008'); 

Added the missing semi-colon. Even though that this is a simple type-o I think that it shows that even simple things in programming can cause bigger problems than you would think.


Solution

  • You forgot the semi-colon after your CREATE statement (before INSERT).