duandong2562 2017-06-06 06:06
浏览 27
已采纳

为什么phpMyAdmin不导入我的表? [关闭]

I'm a designer, but as there's no programmer in my company I have to start studing programming. Which I did only somedays ago (and I have only a html and css knowledge background) so pleasepleaseplease don't take any knowledge for granted if you can answer me!

I'm studing PHP and MySQL using "PHP & MySQL in easy steps" by Mike McGranth (if any of you have it I'm at page 90/91). So, the task is simple: write a .sql file and create a table in phpMyAdmin with it.
Since it's an exercise from a book I just have to write as it's written on the page and test it; yes, I have the solution-file too, but the point is I can't see the difference between my code, which can't be processed by phpMyAdmin, and the solution-code, which gives no problem.

The .sql file written by me is this:

CREATE TABLE IF NOT EXISTS products
(
id INT UNIQUE AUTO_INCREMENT ,
code INT NOT_NULL ,
name VARCHAR(25) NOT NULL ,
quantity INT DEFAULT 1 NULL ,
price DECIMAL(6,2) NOT NULL
) ;

And the solution-file code is this:

CREATE TABLE IF NOT EXISTS products
(
  id        INT UNIQUE  AUTO_INCREMENT ,
  code      INT     NOT NULL ,
  name      VARCHAR(25)     NOT NULL ,
  quantity  INT     DEFAULT 1 NULL , 
  price     DECIMAL(6,2)    NOT NULL
) ;

This is also how the look like in a code-editor program: enter image description here

This is the error that phpMyAdmin gives to me (if the japanese part is important I can add the translation): enter image description here

Since I have a solution, why do I ask? Because maybe I've done just a small mistake, but if I don't understand it I'm afraid to do it again when handling bigger files, maybe a client db, real work, not just an exercise. So, if anyone will be so kind to explain it to me he/she will have my ethernal gratitude!

  • 写回答

3条回答 默认 最新

  • dongliantong3229 2017-06-06 06:09
    关注

    update this cause NOT_NULL is not correct

    code INT NOT_NULL ,
    

    to

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

报告相同问题?

悬赏问题

  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动