mysql - MySQL 中出现未知错误

标签 mysql sql

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/

相关文章:

mysql - 选择具有差异的对象

sql - Mysql - 改进 'group by'中的咨询查询

sql - 将逗号分隔的字符串转换为列表

mysql - 进行搜索时数据库中出现错误 1191

mysql - 保存双向不可空约束

mysql - 是否创建新的数据库连接?

mysql - Joomla 1到Joomla 3.复制DB内容(仅DB中的xxxxx_content表)

.net - SQL 成员资格/角色提供程序的 DDL

sql - 复制的数据列未在Hive的目标表中分区

sql - 检索当前 SQL Server 版本