mysql 在数据库中创建表时出现语法错误

jq6vz3qz  于 2023-01-01  发布在  Mysql
关注(0)|答案(1)|浏览(131)

尝试为数据库创建表后出现错误
这是我的剧本

CREATE TABLE `users` (
  `id` int PRIMARY KEY NOT NULL AUTO_INCREMENT,
  `user_role_id` int NOT NULL,
  `first_name` varchar(250) NOT NULL,
  `last_name` varchar(250) NOT NULL,
  `name` varchar(250),
  `email` varchar(250) NOT NULL,
  `dni_type` varchar(32) NOT NULL,
  `dni` int NOT NULL,
  `phone` int,
  `address` varchar(250),
  `city` varchar(125),
  `state` varchar(125),
  `country` varchar(32),
  `zip` varchar(32),
  `created_at` datetime,
  `created_by` int,
  `updated_at` datetime,
  `updated_by` int,
  `deleted_at` datetime,
  `deleted_by` int
);

我越来越

#1064 - Something is wrong in your syntax near 'CREATE TABLE `users` (
  `id` int PRIMARY KEY NOT NULL AUTO_INCREMENT,
  `u...' on line 2

为什么会产生该错误,将来如何避免该错误?

yeotifhr

yeotifhr1#

CREATE TABLE `users` (
  `id` int PRIMARY KEY NOT NULL AUTO_INCREMENT

不要使用'

CREATE TABLE `users` (
  id int PRIMARY KEY NOT NULL AUTO_INCREMENT

相关问题