Php myadmin-我的代码赢了';不要创建表格
在尝试使用PhpMyadmin创建表时,我不断遇到语法错误 我做错了什么Php myadmin-我的代码赢了';不要创建表格,php,mysql,phpmyadmin,Php,Mysql,Phpmyadmin,在尝试使用PhpMyadmin创建表时,我不断遇到语法错误 我做错了什么 CREATE TABLE `cust` ( `cust5_id` Integer auto_increment primary key, `prog_id` Integer not null, `cust_no` Integer null, `balance` Integer - accept negative and positive numbers ) INSERT INTO `c
CREATE TABLE `cust`
(
`cust5_id` Integer auto_increment primary key,
`prog_id` Integer not null,
`cust_no` Integer null,
`balance` Integer - accept negative and positive numbers
)
INSERT INTO `cust`
(`cust5_id`,`prog_id`,`cust_no`,`balance`)
VALUES
(1,217770,145094,-178.01),
(2,219885,145113,-390.86),
(3,219888,145164,-206.55),
(4,226227,145279,0),
(5,227700,145340,0),
(6,219911,145344,0),
(7,227795,145410,-44.1),
(8,227796,145472,0),
(9,219919,145481,0),
(10,225616,145604,0),
(11,219942,145668,0),
(12,219943,145682,0),
(13,219966,145694,0),
(14,219973,145731,-210.6),
(15,219977,145782,0)
编辑:更改:
删除了结尾处的逗号,没有区别
错误代码总是#1064,或者如果我稍微编辑它,它与“-####”条目有问题。末尾有一个随机逗号 移除它
另外,如果将此作为一个查询集运行,则需要一个
代码>在每个部分后面。您的评论需要两个尾随连字符:
CREATE TABLE `cust`
(
`cust5_id` Integer auto_increment primary key,
`prog_id` Integer not null,
`cust_no` Integer null,
`balance` Integer -- accept negative and positive numbers
);
插入的末尾需要分号而不是逗号:
INSERT INTO `cust`
(`cust5_id`,`prog_id`,`cust_no`,`balance`)
VALUES
(1,217770,145094,-178.01),
(2,219885,145113,-390.86),
(3,219888,145164,-206.55),
(4,226227,145279,0),
(5,227700,145340,0),
(6,219911,145344,0),
(7,227795,145410,-44.1),
(8,227796,145472,0),
(9,219919,145481,0),
(10,225616,145604,0),
(11,219942,145668,0),
(12,219943,145682,0),
(13,219966,145694,0),
(14,219973,145731,-210.6),
(15,219977,145782,0);
您是否尝试只运行“创建表”查询?您遇到了哪些错误?首先,在插入的末尾有一个额外的,
。#1034错误。@Khan我可以创建表,但我也希望将数据加载到表中。我将每隔2天左右删除并替换数据库的数据。我完成了所有操作并收到:#1064-您的SQL语法有错误;检查与您的MySQL服务器版本对应的手册,了解使用第3行附近“prog\u id
Integer not null,cust\u no
Integer null,balance
Integer--”的正确语法phpmadmin的语法突出显示与我的语法突出显示是否有明显差异(参见上图)你复制了上面的SQL吗?它成功了!!!!非常感谢。我只是复制了部分代码,逗号留下了。我的错。1查询集