Mysql数据库第一次作业

新建数据库mydb6_product,新建3张表如下:employess表,orders表和invoices表

一:创建employess表

mysql> create database mydb6_product;

mysql> use mydb6_product;

mysql> create table employess(id int,name char(50),age int,gender char(10),salary float);

mysql> desc employess;

mysql> alter table employess modify id int not null;

mysql> alter table employess modify name char(50) not null;

mysql> alter table employess modify gender char(10) not null;

二:创建orders表

mysql>create  table orders(id int not null,name varchar(100) not null,price float,category varchar(50));

mysql> alter table employess add primary key(id);

三:创建invoices表

create table invoices(number int not null primary key auto_increment,order_id int,foreign key (order_id) references invoices(number),in_date date,total_amouunt float);

相关推荐

  1. 数据库第一作业

    2024-07-17 20:48:05       32 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-17 20:48:05       66 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-17 20:48:05       70 阅读
  3. 在Django里面运行非项目文件

    2024-07-17 20:48:05       57 阅读
  4. Python语言-面向对象

    2024-07-17 20:48:05       68 阅读

热门阅读

  1. python初学之路

    2024-07-17 20:48:05       19 阅读
  2. 用C语言写的一个扫雷小游戏

    2024-07-17 20:48:05       19 阅读
  3. C#中处理Socket粘包

    2024-07-17 20:48:05       24 阅读