一、数据库结构
1. 客户表 customer
| 字段 | 数据类型 | 描述 |
| :– | :—– | :– |
| id | int | 主键 |
| name | varchar | 客户名称 |
| gender | int | 性别 |
| age | int | 年龄 |
| phone | varchar | 电话 |
| address | varchar | 地址 |
2. 产品表 product
| 字段 | 数据类型 | 描述 |
| :– | :—– | :– |
| id | int | 主键 |
| name | varchar | 产品名称 |
| price | float | 价格 |
| amount | int | 数量 |
3. 订单表 order
| 字段 | 数据类型 | 描述 |
| :– | :—– | :– |
| id | int | 主键 |
| customer_ID | int | 客户ID |
| product_ID | int | 产品ID |
| amount | int | 数量 |
| date | datetime | 日期 |
二、建库语句
— 创建数据库
create database if not exists 5B00;
— 使用数据库
use 5B00;
— 创建客户表
create table if not exists customer
(
id int primary key auto_increment,
name varchar(100) not null,
gender int not null,
age int not null,
phone varchar(20) not null,
address varchar(200) not null
);
— 创建产品表
create table if not exists product
(
id int primary key auto_increment,
name varchar(100) not null,
price float not null,
amount int not null
);
— 创建订单表
create table if not exists `order`
(
id int primary key auto_increment,
customer_id int not null,
product_id int not null,
amount int not null,
date datetime not null
);
本文由作者笔名:逗号CMS 于 2024-08-21 05:15:01发表在本站,原创文章,禁止转载,文章内容仅供娱乐参考,不能盲信。
本文链接: http://www.lovelp.cn/wen/132123.html