gpt4 book ai didi

mysql - MySQL 中出现未知错误

转载 作者:行者123 更新时间:2023-11-29 21:21:36 24 4
gpt4 key购买 nike

create table Member_ID(
Member_ID not null,
Title varchar(4) not null,
Forename varchar(30) not null,
Surname varchar(30) not null,
DOB date not null,
Address 1 varchar (30), not null,
Address 2 varchar (30), not null,
Postcode varchar(8), not null,
MobileNo char (11), not null,
Email varchar (30), not null,
Gender char (1), not null,
Medical varchar (30), not null,
Joining_Date date not null,
Paid varchar (4), not null,
Membership_Type char(1), not null,
Staff_Initials char (2), not null,



Primary key (Member_ID) );

create table class(
Class_Name varchar (30) not null,
ClassDayofWeek date not null,
Class_Time select get date not null,
Class_Duration char(4) not null,
Studio_ID char (4) not null,
Instructor_ID int not null,


create table class_list(
Class_ID varchar (30) not null,
Member_ID not null,
Date_Booked date not null,

create table Instructor(
Instructor_ID not null,
InsFirstName varchar (30) not null,
InsSurname varchar (30) not null,
InsContactNo char (11) not null,

create table Equipment(
Equip_ID not null,
Supplier_ID not null,
Studio_ID not null,
Equip_Name varchar (30),

create table supplier(
Supplier_ID not null,
Supplier_Name varchar (30) not null,
SupplierContactNo char (11) not null,
Supplier_Email varchar (30) not null,

create table Equipment_Maintanence(
Maintenence_ID not null,
EquipID not null,
Main_date date not null
Maint_ID not null,
Eng_Name varchar (30)
Fault_Desc varchar (200)
Maint_Type varchar (7)

嗨,我正在尝试在 MySQL 中创建一个表,并且是初学者,所以请耐心等待。我在第 2、7、26、32 行收到语法错误。其他所有内容似乎都没有错误且不确定。我花了相当长的时间弄清楚。任何建议谢谢。

最佳答案

此sql中有很多错误,例如让我们获取第一个表“create table Member_ID(”及其

  • 第二个字符串:
    • Member_ID 不为空 - 您应该添加类型,例如整数
    • Member_ID int not null - 字段的正常定义
  • 第 7 串
    • Address 1 varchar (30), not null, - 您应该使用另一个列名称,例如 Address 1 并删除 varchar (30) 之后和 not null 之前的多余逗号
    • Address_1 varchar(30) 不为 null - 字段的正常定义

所以我已经修复了整个第一个表并得到了这个代码:

create table Member_ID(
Member_ID int not null,
Title varchar(4) not null,
Forename varchar (30) not null,
Surname varchar (30) not null,
DOB date not null,
Address_1 varchar(30) not null,
Address_2 varchar(30) not null,
Postcode varchar(8) not null,
MobileNo char(11) not null,
Email varchar(30) not null,
Gender char(1) not null,
Medical varchar(30) not null,
Joining_Date date not null,
Paid varchar(4) not null,
Membership_Type char(1) not null,
Staff_Initials char(2) not null,
Primary key (Member_ID)
);

关于mysql - MySQL 中出现未知错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35698655/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com