Comments - noinstall package for MariaDB(such as XAMPP, formerly known as LAMP)
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
I developed a query create a table on my Server version: 10.0.1-MariaDB-mariadb1precise-log with the following query:"create table if not exists addresslist( 'id' int not null auto_increment, 'firstname' varchar not null , 'lastname' varchar not null, 'city' varchar not null, 'state' char(2) , 'country' text default 'usa', 'zip' text(10) not null primary key (id) )";
I get the following error message:
Query error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''id' int not null auto_increment, 'firstname' varchar not null , 'lastname' ' at line 2
Would please explain my mistake. I've tried debug this in several different ways. Thanks Ralph Kessel kesselr1@mchsi.com
You have 4 different problems in your query.
The one that you are stuck at now is that you surrounded column names with single quote marks. You need to either remove them at all, or to replace them with back ticks:
Then you will start getting another syntax error:
It will be happening because VARCHAR requires a length parameter, so you will need to replace all varchar with something like varchar(64), or whatever length you need:
Then there will be error
which is rather self-explanatory: you need to remove the default value from the text column:
Now you will have a syntax error again:
which is caused by a missing comma before primary key definition. Fix it, and your query will work:
P.S. Please next time try to choose an appropriate category or topic for your question, this one has nothing to do with noinstall packages.