MySQL-18.多表设计-一对多

一.多表设计-概述

二.一对多

sql 复制代码
create table tb_emp (
                        id int unsigned primary key auto_increment comment 'ID',
                        username varchar(20) not null unique comment '用户名',
                        password varchar(32) default '123456' comment '密码',
                        name varchar(10) not null comment '姓名',
                        gender tinyint unsigned not null comment '性别, 说明: 1 男, 2 女',
                        image varchar(300) comment '图像',
                        job tinyint unsigned comment '职位, 说明: 1 班主任,2 讲师, 3 学工主管, 4 教研主管',
                        entrydate date comment '入职时间',
                        create_time datetime not null comment '创建时间',
                        update_time datetime not null comment '修改时间',
                        dept_id int unsigned comment '部门id'
) comment '员工表';

create table tb_dept (
    id int unsigned primary key auto_increment comment 'ID',
    name varchar(10) not null unique comment '部门名称',
    create_time datetime not null comment '创建时间',
    update_time datetime not null comment '修改时间'
) comment '部门表';

相关推荐
伤不起bb2 小时前
MySQL 高可用
linux·运维·数据库·mysql·安全·高可用
Yushan Bai7 小时前
ORACLE RAC环境REDO日志量突然增加的分析
数据库·oracle
躺着听Jay7 小时前
Oracle-相关笔记
数据库·笔记·oracle
瀚高PG实验室8 小时前
连接指定数据库时提示not currently accepting connections
运维·数据库
运维成长记9 小时前
mysql数据库-中间件MyCat
数据库·mysql·中间件
尘客.9 小时前
DataX从Mysql导数据到Hive分区表案例
数据库·hive·mysql
华纳云IDC服务商9 小时前
SQL Server权限设置的几种方法
mysql·sqlserver
TiDB 社区干货传送门10 小时前
从开发者角度看数据库架构进化史:JDBC - 中间件 - TiDB
数据库·oracle·中间件·tidb·数据库架构
虾球xz10 小时前
游戏引擎学习第280天:精简化的流式实体sim
数据库·c++·学习·游戏引擎
uwvwko11 小时前
BUUCTF——web刷题第一页题解
android·前端·数据库·php·web·ctf