create table studentid int10 not NULL as学号 PRIMARY KEYname VARCHAR15 NOT NULL 姓名 pwd VARCHAR20 not NULl密码 sex VARCHAR2 not NULL 性别 address VARCHAR100 地址email VARCHAR20 邮箱;Err 1064 - You have an error
The syntax error in your SQL statement is caused by the incorrect use of the AS keyword. The correct syntax for creating a table with a primary key and column comments in MySQL is as follows:
CREATE TABLE `student`(
`id` INT(10) NOT NULL COMMENT '学号' PRIMARY KEY,
`name` VARCHAR(15) NOT NULL COMMENT '姓名',
`pwd` VARCHAR(20) NOT NULL COMMENT '密码',
`sex` VARCHAR(2) NOT NULL COMMENT '性别',
`address` VARCHAR(100) COMMENT '地址',
`email` VARCHAR(20) COMMENT '邮箱'
);
In this corrected syntax, the column comments are specified using the COMMENT keyword after the column data type
原文地址: https://www.cveoy.top/t/topic/hNRM 著作权归作者所有。请勿转载和采集!