Need Help with Basic Tables

My friend recommended this program to me and I followed a tutorial and tried the code I created here:, but it didn't work. Could someone please tell me what's wrong with this? :

It would help if you post the error message.

You have

INSERT INTO elementData
(Col1, Col2, ...)
('Hydrogen', 'H', ...)
('Helium', 'He', ...)

and with that style of syntax you need a comma between each set of values, like this:

('Hydrogen', 'H', ...) , <--- Here !!
('Helium', 'He', ...)

but I reckon you also have misalignment between the Column Names in your INSERT INTO statement and the VALUES list

1 Like

Thank you. That solved one issue. But I'm still getting an error stating:

However, when I enter this first:

CREATE TABLE elementData ( name varchar(60), symbol varchar(3), numberOfNeutrons int, groupNumber int, groupNumberMendeleev varchar(4), groupNumberAmerican varchar(5), groupNumberEuropean varchar(4), groupTrivialName varchar(26), groupNameByElement varchar(13), period int, commonCharges varchar(10), shell1 int, shell2 int, shell3 int, shell4 int, shell5 int, shell6 int, shell7 int, funFact varchar(255) )
And then this:

INSERT INTO elementData (name, symbol, numberOfNeutrons, groupNumber, groupNumberMendeleev, groupNumberAmerican, groupNumberEuropean, groupTrivialName, groupNameByElement, period, commonCharges, shell1, shell2, shell3, shell4, shell5, shell6, shell7, funFact) VALUES ('Hydrogen', 'H', 0, 1, 'I', 'Ia', 'Ia', '_', 'Hydrogen', 1, '1+', 1, 0, 0, 0, 0, 0, 0, 'About 75% of the Universe is made up of Hydrogen.'), ('Helium', 'He', 2, 18, 'N/A', 'VIIIa', 0, 'Noble Gases / Noble Solids', 'Helium / Neon', 1, '0', 2, 0, 0, 0, 0, 0, 0, 'Helium is the only known element that will remain at a liquid state at a temperature of absolute zero under normal pressure.')
It does work. Any ideas of how I can get it to work by entering it at the same time here: ?

Individual statements can be terminated with semi-colon ";" and, in MS SQL tools, the command "GO" can be put on a line by itself to force execution of statements up to that point, before statements after that point are processed. Dunno if "GO" will work in the W3Schools test system though.

1 Like