duanqiao8925 2013-03-18 17:29
浏览 34
已采纳

Phpmyadmin - 我的代码不会创建表[关闭]

I keep getting syntax errors when trying to create the table with PhpMyadmin.

What I am I doing wrong?

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)

EDIT: Changes:

Removed comma at end and no difference.

Error code is always #1064 or if I edit it slightly has problems with the "-###" entries.

  • 写回答

2条回答 默认 最新

  • doucongqian6644 2013-03-18 17:34
    关注

    your comment needs two trailing hyphen:

    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
    );
    

    create table in phpmyadmin

    and you need a semicolon instead of a comma at the end of the inserts:

    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);
    

    inserts in phpmyadmin

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大