Currently trying to put a local website online.
Specification:
* PHP 7.1
* My SQL 5.5
When trying to import my DB I receive the following error message:
Requête SQL:
Base de données : vs
Structure de la table vsc_aps_social_icons
CREATE TABLE IF NOT EXISTS `vsc_aps_social_icons` (
`si_id` int(11) NOT NULL AUTO_INCREMENT,
`icon_set_name` varchar(255) DEFAULT NULL,
`icon_display` varchar(255) DEFAULT NULL,
`num_rows` varchar(255) DEFAULT NULL,
`icon_margin` varchar(255) DEFAULT NULL,
`icon_tooltip` int(11) NOT NULL,
`tooltip_background` varchar(255) DEFAULT NULL,
`tooltip_text_color` varchar(255) DEFAULT NULL,
`icon_animation` varchar(255) DEFAULT NULL,
`opacity_hover` varchar(20) DEFAULT NULL,
`icon_details` text,
`icon_extra` text,
PRIMARY KEY (`si_id`)
) TYPE=InnoDB AUTO_INCREMENT=3 ;
MySQL a répondu: Documentation
#1064 - 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 'TYPE=InnoDB AUTO_INCREMENT=3' at line 25
It's the 1st time I put a website online so may your explanations be as complete as possible.
Thanks,
E
Use ENGINE = InnoDB instead of TYPE = InnoDB. TYPE was removed in 5.1.
Related
I'm new to MySQL and I'm trying to create tables inside a Database,
I used the 'Create a new table' function that appears on my SQL Workbench, instead of manually trying to add them. It writes this :
CREATE TABLE `Bory`.`Produits` (
`idProduits` NOT NULL,
`Marque` VARCHAR(45) NULL,
`NomProduit` VARCHAR(45) NULL,
PRIMARY KEY (`idProduits`));
So I go and click on "Apply" but I receive this message :
Operation failed: There was an error while applying the SQL script to the database.
Executing:
CREATE TABLE `Bory`.`Produits` (
`idProduits` NOT NULL,
`Marque` VARCHAR(45) NULL,
`NomProduit` VARCHAR(45) NULL,
PRIMARY KEY (`idProduits`));
ERROR 1064: 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 'NOT NULL,
Marque VARCHAR(45) NULL,
NomProduit VARCHAR(45) NULL,
PRIMAR' at line 2
So now I am lost, because why is does function that is native to the Workbench itself keep making mistakes and doesn't let me add tables?
as mentioned in comments, You did't specified the data type for idProduits. for instance use int like below:
CREATE TABLE `Bory`.`Produits` (
`idProduits` int NOT NULL,
`Marque` VARCHAR(45) NULL,
`NomProduit` VARCHAR(45) NULL,
PRIMARY KEY (`idProduits`));
I'm new to MySQL and I'm running version 5.7.19-log (At least thats what I'm getting from command line client) with Workbench 6.3.9 Community edition. My problem is I'm trying to create a simple table with auto-generated id using the UI, however when I execute the generated script it throws me the following error:
Operation failed: There was an error while applying the SQL script to the database.
Executing:
CREATE TABLE `travelportaldb`.`user` (
`user_id` INT GENERATED ALWAYS AS () VIRTUAL,
`name` VARCHAR(45) NOT NULL,
`account_id` VARCHAR(15) NULL,
`account_currency` CHAR(3) NULL,
`account_balance` DECIMAL NULL,
PRIMARY KEY (`user_id`));
ERROR 1064: 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 ') VIRTUAL,
`name` VARCHAR(45) NOT NULL,
`account_id` VARCHAR(15) NULL,
`ac' at line 2
SQL Statement:
CREATE TABLE `travelportaldb`.`user` (
`user_id` INT GENERATED ALWAYS AS () VIRTUAL,
`name` VARCHAR(45) NOT NULL,
`account_id` VARCHAR(15) NULL,
`account_currency` CHAR(3) NULL,
`account_balance` DECIMAL NULL,
PRIMARY KEY (`user_id`))
This is the script that it generated:
CREATE TABLE `travelportaldb`.`user` (
`user_id` INT GENERATED ALWAYS AS () VIRTUAL,
`name` VARCHAR(45) NOT NULL,
`account_id` VARCHAR(15) NULL,
`account_currency` CHAR(3) NULL,
`account_balance` DECIMAL NULL,
PRIMARY KEY (`user_id`));
I have no idea what's wrong. I'm from the oracle background and the query seems to be fine except the auto generated apart which I have no idea about.
Please help.
Thanks.
When you switch on the generated flag in MySQL Workbench the column details fields will change a bit to allow setting the required options for a generated column:
Most important here is the Expression field. For a generated column you have to specify an expression which is used for generation. Obviously you didn't do that and hence in your generated SQL the column definitions are wrong (empty parentheses, where an expression should be).
PS: You can also see the used server version in the Session tab page:
I have this schema:
CREATE TABLE `devolucion_medicamento` (
`id_devolucion_medicamento` int(11) NOT NULL,
`id_devolucion` int(11) NOT NULL,
`id_medicamento` int(11) NOT NULL,
`cantidad` int(11) DEFAULT NULL,
`fec_mov` timestamp NULL DEFAULT NULL,
`activo` tinyint(1) DEFAULT NULL,
`lote` varchar(45) DEFAULT NULL,
`fec_venc` date DEFAULT NULL,
`tamano` varchar(45) NOT NULL,
`inventario` varchar(45) NOT NULL
)
and i have to update the value of "inventario" where id_medicamento,fec_venc,tamano and inventario are equals to some concatenated string value that i get from an app.
I thought on something like this
UPDATE devolucion_medicamento
SET
inventario="AAAAAA",
WHERE concat(id_medicamento,lote,fec_venc,tamano,inventario)="54062018-09-308"
but i don't know if it is possible in mysql.
I'm having this error:
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 'WHERE concat(id_medicamento,lote,fec_venc,tamano,inventario)="54062018-09-308"' at line 4
I'm too new to comment... but it appears there is a comma after inventario="AAAAAA". If so, MySQL is expecting another set expression.
I have the following SQL to create a table on a MySQL 5.6.13 instance:
CREATE TABLE 'exchange' (
'id' int NOT NULL AUTO_INCREMENT,
'abbrev' varchar(32) NOT NULL,
'name' varchar(255) NOT NULL,
'city' varchar(255) NULL,
'country' varchar(255) NULL,
'currency' varchar(128) NULL,
'time_zone_offset' time NULL,
'created_date' datetime NOT NULL,
'last_updated_date' datetime NOT NULL,
PRIMARY KEY ('id')
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
However, I keep getting the following unhelpful error:
ERROR 1064 (42000): 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
''exchange' ( 'id' int NOT NULL AUTO_INCREMENT,
'abbrev' varchar(32) NOT NULL, 'n' at line 1
I must be missing something glaringly obvious...
Any ideas where I'm going wrong?
Try :
CREATE TABLE exchange (
Ref:
http://dev.mysql.com/doc/refman/5.1/en/create-table.html
Remove all quotes, this helped me on a windows machine command line
I'm attempting to import an SQL file generated by 5.5.25-MariaDB-mariadb1 into 5.1.55-rel12.6 - (Percona Server (GPL), 12.6 , Revision 200) after importing the first 11 tables the import process breaks with the following error:-
ERROR 1064 (42000) at line 35252: 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 'PAGE_CHECKSUM=1' at line 10
Line 35252 contains the following:-
CREATE TABLE `kygvj_bwps_lockouts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` int(1) NOT NULL,
`active` int(1) NOT NULL,
`starttime` int(10) NOT NULL,
`exptime` int(10) NOT NULL,
`host` varchar(20) DEFAULT NULL,
`user` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=Aria AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
Can anyone suggest what the right syntax might be? I have been unable to locate the documentation referred to in the error message.