I'm trying to insert values in my database This is the statement I try to execute:
insert into leverancier (id,naam,straat,nr,postcode,plaats,telefoon)
values (1,"stef","bosstraat",88,9240,"Zele",null);
I get the following error:
ERROR 42X04: Column 'stef' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'stef' is not a column in the target table.
What is the problem?
To insert a string, like "stef"
, don't use double quotes but single quotes: 'stef'
. Here's how the statement should be:
INSERT INTO leverancier
(id, naam, straat, nr, postcode, plaats, telefoon)
VALUES
(1,'stef', 'bosstraat', 88, 9240, 'Zele', NULL);
The error you get Column 'stef' is either not in any table ...
is because double quotes are used for table and column names. So reading "stef"
, the parser assumes you are referring to a column named stef
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With