我是 sql 数据库的初学者。我正在尝试将数据库导入 phpmyadmin,但我收到一条错误消息:
1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 2 行的“DEFAULT_AUTOINCREMENT, firstName varchar (30) NOT_NULL, lastName var”附近使用正确的语法
我的 sql 代码如下所示:
use myAddressBook
;
create table names (
personID int DEFAULT_AUTOINCREMENT,
firstName varchar (30) NOT_NULL,
lastName varchar (30) NOT_NULL,
constraint pk_name primary_key (personID)
)
;
create table addresses (
addressID int DEFAULT_AUTOINCREMENT,
personID int NOT_NULL,
address1 varchar (50),
address2 varchar (50),
city varchar (30),
state varchar (2),
zipcode varchar (10),
constraint fk_addresses foreign_key (personID)
references names (personID),
constraint pk_addresses primary_key (addressID)
)
;
create table phoneNumbers (
phoneID int DEFAULT_AUTOINCREMENT,
personID int NOT_NULL,
phoneNumber varchar (20),
constraint fk_phoneNumbers foreign_key (personID)
references names (personID),
constraint pk_phoneNumbers primary_key (phoneID)
)
;
create table emailAddresses (
emailID int DEFAULT_AUTOINCREMENT,
personID int NOT_NULL,
emailAddress varchar (50),
constraint fk_emailAddresses foreign_key (personID)
references names (personID),
constraint pk_emailAddresses primary_key (emailID)
)
;
谁能指出我正确的方向,我哪里错了。谢谢。