Doug Fir
Doug Fir

Reputation: 21282

Trouble building schema for sqlfiddle

I'm struggling to build a schema in sqlfiddle

On the left pane I enter this:

create table contacts (
  eid int(10),
  event_time timestamp
);

insert into contacts (
  eid, event_time)
values (
'991772', 2016-04-21 11:34:21,
'989628', 2016-04-17 02:19:57,
'985557', 2016-04-04 09:56:39,
'981920', 2016-03-30 11:03:12,
'981111', 2016-03-30 09:36:48,
'980094', 2016-03-29 12:55:28,
'979140', 2016-03-27 21:52:35,
'978732', 2016-03-24 11:37:14,
'977860', 2016-03-20 11:28:10,
'975730', 2016-03-09 12:46:51,
'972423', 2016-02-22 19:20:54,
'971998', 2016-02-21 10:51:25,
'971625', 2016-02-20 10:46:26,
'963732', 2016-02-02 04:18:31,
'962626', 2016-01-29 14:46:25,
'961310', 2016-01-26 15:13:10,
'958354', 2016-01-19 10:10:52,
'953278', 2016-01-06 00:15:52,
'925676', 2015-09-29 12:34:24,
'924938', 2015-09-26 01:48:35,
'917142', 2015-08-31 15:39:49,
'909758', 2015-08-18 02:30:53,
'906376', 2015-08-07 10:04:41,
'900640', 2015-07-21 04:41:35,
'891292', 2015-07-08 05:05:43,
'890300', 2015-07-05 04:40:30,
'882116', 2015-06-25 05:52:07,
'877398', 2015-06-25 05:15:39,
'867784', 2015-06-15 16:32:20,
'860696', 2015-06-03 16:28:48,
'856926', 2015-05-29 21:23:07,
'852006', 2015-05-20 09:41:51,
'850194', 2015-05-16 13:10:34,
'848416', 2015-05-12 20:14:36,
'835952', 2015-04-23 08:27:14,
'832550', 2015-04-16 10:52:45,
'829634', 2015-04-11 15:01:57,
'818734', 2015-03-19 10:17:37,
'817058', 2015-03-17 21:53:55,
'810288', 2015-03-05 12:07:58,
'796905', 2015-02-11 14:03:43,
'796795', 2015-02-11 12:00:18,
'792563', 2015-02-04 20:14:44,
'784219', 2015-01-22 17:58:27,
'780503', 2015-01-17 17:10:17,
'779761', 2015-01-16 12:39:20,
'776863', 2015-01-13 09:39:46,
'768407', 2014-12-30 17:48:36,
'764393', 2014-12-20 06:14:14,
'761639', 2014-12-16 05:49:39,
'760039', 2014-12-13 15:50:57,
'749431', 2014-11-24 23:59:41,
'731429', 2014-10-31 10:01:15,
'730813', 2014-10-30 12:16:18,
'730099', 2014-10-29 13:15:06,
'730087', 2014-10-29 13:13:36,
'727465', 2014-10-26 15:26:23,
'723055', 2014-10-20 19:06:02,
'722543', 2014-10-20 11:32:35,
'720637', 2014-10-16 09:56:47,
'717573', 2014-10-04 16:20:39,
'708611', 2014-08-30 13:57:58,
'697237', 2014-07-16 11:55:10,
'690235', 2014-06-25 14:32:40,
'473417', 2014-04-25 17:01:54,
'469875', 2014-04-15 12:57:28,
'462433', 2014-03-26 12:42:22,
'457409', 2014-03-18 15:58:36,
'447423', 2014-02-04 22:06:54,
'440453', 2014-01-09 18:16:34,
'432621', 2013-12-03 02:47:46,
'430535', 2013-11-21 17:42:30,
'427727', 2013-11-10 11:40:51,
'426913', 2013-11-07 10:51:07,
'426619', 2013-11-07 07:47:36,
'419563', 2013-10-08 12:37:50,
'414241', 2013-09-12 14:22:26,
'413933', 2013-09-11 11:52:19,
'375765', 2013-08-14 16:04:44,
'375581', 2013-08-13 21:52:22,
'374911', 2013-08-10 20:05:32,
'366801', 2013-07-15 17:06:59,
'365017', 2013-07-07 15:08:55,
'363677', 2013-07-01 09:02:17,
'359695', 2013-06-12 15:11:15,
'358785', 2013-06-08 10:18:42,
'337077', 2013-03-13 09:32:20,
'333823', 2013-02-25 13:44:05,
'329941', 2013-02-06 18:58:11,
'322941', 2013-01-11 21:36:52,
'318841', 2012-12-19 15:52:45,
'316839', 2012-12-07 19:10:44,
'312725', 2012-11-15 01:32:20,
'298613', 2012-10-02 20:16:43,
'291381', 2012-09-12 06:39:17,
'207513', 2012-06-27 12:20:49,
'206073', 2012-06-20 17:08:15,
'202913', 2012-06-04 11:00:30,
'201447', 2012-05-24 16:08:35,
'200503', 2012-05-19 05:25:29,
'199643', 2012-05-14 20:58:55,
'197854', 2012-04-28 08:29:11,
'190369', 2012-03-27 13:32:08,
'183708', 2012-01-21 11:18:05,
'179191', 2011-12-05 17:44:59,
'177536', 2011-11-29 19:47:49,
'175989', 2011-11-10 23:10:56,
'175676', 2011-11-07 08:33:45,
'175260', 2011-11-02 00:10:39,
'173520', 2011-10-19 02:03:41,
'169358', 2011-09-01 06:55:15,
'169230', 2011-08-30 15:18:45,
'165594', 2011-07-14 22:48:31,
'165163', 2011-07-09 15:24:12,
'165044', 2011-07-07 17:14:26,
'164944', 2011-07-06 16:38:20,
'163117', 2011-06-16 13:05:36,
'161112', 2011-06-16 11:28:26,
'160565', 2011-06-16 11:02:05,
'158080', 2011-06-16 09:56:59,
'153493', 2011-06-16 08:02:16,
'153479', 2011-06-16 08:02:14,
'150105', 2011-06-16 06:25:55,
'133281', 2011-05-27 18:30:30,
'132279', 2011-05-25 10:43:22,
'132160', 2011-05-25 09:50:21,
'121644', 2011-02-26 05:14:51,
'119116', 2011-01-10 21:43:16,
'113875', 2010-11-20 22:09:57,
'94921', 2010-07-06 15:51:11,
'91807', 2010-04-29 20:07:32,
'84052', 2009-11-06 04:44:27,
'79916', 2009-09-12 20:01:35,
'77402', 2009-08-07 16:14:04,
'73684', 2009-07-20 02:47:39,
'71592', 2009-06-30 00:51:53,
'71308', 2009-06-25 09:39:00,
'68566', 2009-05-29 09:27:41,
'36116', 2008-12-23 19:38:07,
'33714', 2008-12-04 08:03:17,
'25979', 2008-07-02 06:21:05,
'20722', 2008-03-10 22:08:07,
'16791', 2008-01-09 13:10:38,
'16535', 2008-01-03 12:10:27,
'7961', 2007-02-26 13:30:04,
'6370', 2007-01-22 10:02:35
);

When I hit build I get:

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 '11:34:21, '989628', 2016-04-17 02:19:57, '985557', 2016-04-04 09:56:39, '981920'' at line 4

I tried wrapping the timestamp in quotes but also received errors.

How do I get this table built into sqlfiddle?

Upvotes: 0

Views: 624

Answers (1)

Felix Pamittan
Felix Pamittan

Reputation: 31879

From the doc:

INSERT statements that use VALUES syntax can insert multiple rows. To do this, include multiple lists of column values, each enclosed within parentheses and separated by commas.

SQL Fiddle

insert into contacts (eid, event_time) values
('991772', '2016-04-21 11:34:21'),
('989628', '2016-04-17 02:19:57'),
('985557', '2016-04-04 09:56:39'),
...
('6370',  '2007-01-22 10:02:35');

Additionally, you have to put the event_time values in ''.

Upvotes: 1

Related Questions