m0_57644410 2021-06-11 22:51 采纳率: 92%
浏览 16
已采纳

数据库的题目,用mysql做,怎么做这道题,有大神解答吗?

 

  • 写回答

1条回答 默认 最新

  • weixin_46263982 2021-06-13 12:47
    关注

    -- 1、创建数据库

    create database company_info;

    -- 打开数据库

    use company_info;

     

    -- 创建 Employee

    create table Employee(

    EmployeeID int primary key auto_increment,

    EmployeeName char(8) not null,

    EmployeeSex char(2) not null default '女',

    Emplthday datetime ,

    HiringTime datetime not null,

    Specialty varchar(50),

    Salary double

    )

     

    -- 创建Category

    create table Category(

    TypeID int primary key,

    TypeNmae char(30) not null,

    TypeNote char(50)

    )

     

    -- 创建 Product

    create table Product(

    ProductID int primary key,

    Productname char(10) not null,

    TypeID int,

    foreign key(TypeID) references Category(TypeID),

    UnitPrice double not null,

    Inventory int not null

    )

     

    -- 创建 Customer

    create table Customer(

    CustomerID int primary key,

    CompanyName char(30) not null,

    ContactName char(8) not null,

    Contactipone char(13),

    address char(30),

    Cod char(6)

     

    )

     

     

    -- 创建 P_order

    create table P_order (

    OrderID int primary key,

    ProductID int,

    foreign key(ProductID) references Product(ProductID),

    number int not null,

    EmployeeID int,

    foreign key(EmployeeID) references Employee(EmployeeID),

    CustomerID int,

    foreign key(CustomerID) references Customer(CustomerID),

    OrderTime datetime not null

    )

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?