Reputation: 11
please give me recommendation my query does not working
SQL query:
CREATE TABLE `amenities` (
`amenities_id` int(11) NOT NULL auto_increment,
`pic` varchar(100) NOT NULL,
`des` text NOT NULL,
PRIMARY KEY (`amenities_id`)
) TYPE=MariaDB AUTO_INCREMENT=13
MySQL said: Documentation
1064 - 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 'TYPE=MariaDB AUTO_INCREMENT=13' at line 6
Upvotes: 0
Views: 1457
Reputation: 1
DROP TABLE IF EXISTS `amenities`;
CREATE TABLE `amenities` (
`amenities_id` int(11) NOT NULL AUTO_INCREMENT,
`pic` varchar(100) NOT NULL,
`des` text,
PRIMARY KEY (`amenities_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Create new Table amenities
where amenities_id
is a PRIMARY KEY that will be auto increment. another table field pic
is a varchar data type and des
is a text data type that is used for rich text.
Upvotes: 0
Reputation: 142258
TYPE
keyword was replaced by ENGINE
long ago.ENGINEs
are InnoDB
, MyISAM
, MEMORY
, ARIA
and possibly others. Not MySQL
, nor MariaDB
.... near 'TYPE ...
points exactly at or after the offending syntax: TYPE
in this case. (Not AUTO_INCREMENT
, which was later)AUTO_INCREMENT=13
is produced by SHOW CREATE TABLE
for possible reloading. However, it is rarely useful otherwise. It is also mostly harmless.Upvotes: 0
Reputation: 803
Hope this works.
CREATE TABLE amenities (
amenities_id int(11) NOT NULL auto_increment,
pic varchar(100) NOT NULL,
des text NOT NULL,
PRIMARY KEY (amenities_id)
) AUTO_INCREMENT=13
Upvotes: 0
Reputation: 17615
There is no type table option, you possibly want to define the table engine and there is no mariadb engine try
CREATE TABLE amenities ( amenities_id int(11) NOT NULL auto_increment,
pic varchar(100) NOT NULL, des text NOT NULL, PRIMARY KEY (amenities_id) )
AUTO_INCREMENT=13,
engine=innodb
Or leave out the engine option if you want to default the table to the database engine/
Upvotes: 4