Nis*_*dru 0 mysql sql phpmyadmin
嗨我想在Mysql中使用SQL创建一个表,但我一直收到错误.这是我的代码:
USE e-commerce
CREATE TABLE `categories` (
`id` SMALLINT NOT NULL AUTO_INCREMENT,
`category` VARCHAR( 30) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `category` (`category`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Run Code Online (Sandbox Code Playgroud)
当我尝试在phpmyadmin SQL控制台中运行它时,我收到此错误:
#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 'CREATE TABLE `categories` ( `id` SMALLINT NOT NULL AUTO_INCREMENT, `category` ' at line 2
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
Sur*_*shi 10
之后添加分号 use
USE e-commerce;
CREATE TABLE `categories` (
`id` SMALLINT NOT NULL AUTO_INCREMENT,
`category` VARCHAR( 30) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `category` (`category`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
123 次 |
| 最近记录: |