当前位置:网站首页>MySQL表操作练习
MySQL表操作练习
2022-08-05 05:40:00 【小孙的代码分享】
设计一个考勤系统
考勤系统,包含员工表,考勤记录表
主要考虑记录表中的记录信息,是如何关联到员工表,员工与记录关系为1:m。
create TABLE emp(id int primary key,name varchar(20));
create TABLE info(id int primary key,emp_id int,info_date timestamp,foreign key (emp_id) references emp(id));设计一个学校宿舍管理系统
学校宿舍管理系统,要求包含宿舍信息,学生信息,每日的宿舍查房记录。
主要考虑学生与宿舍的关系:m:1,宿舍的查房记录是根据宿舍来查的,与宿舍有关系,一个宿舍可以多次查房,宿舍与查房记录是1:m的关系
create table dormitory(id int primary key,number varchar(20));
create table student(id int primary,name varchar(20),dormitory_id int,FOREIGN KEY(dormitory_id) REFERENCES dormitory(id));
create table info (id int primary key,dormitory_id int,status bit,info_date TIMESTAMP,FOREIGN KEY(dormitory_id) REFERENCES dormitory(id));
设计一个车辆违章系统
车辆违章系统,包含用户表,车辆表,违章信息表。违章信息表中包含用户和车辆的违章信息
用户可以拥有多辆车,关系为1:m,题目已经说明违章信息包括用户和车辆,说明违章信息表中要记录用户和车辆,一个用户可以有多次违章记录,用户与违章记录关系为1:m,一辆车也可以有多次违章记录,车辆与违章记录关系也为1:m
create table user(id int primary key,name varchar(20));
create table cars(id int primary key,name varchar(20),user_id int,foreign key (user_id) references user(id));
create table info(id int primary key,user_id int,cars_id int,foreign key (user_id) references user(id),foreign key (cars_id) references cars(id));设计一个学校食堂管理系统
学校食堂管理系统,包含食堂表,食堂仓口表,仓口收费记录表
一个食堂有多个仓口卖饭,关系为1:m,每个仓口卖饭可以有很多次,仓口与收费记录也是1:m
create table hall(id int primary key, name varchar(20));
create table hall_opening(id int primary key,name varchar(20),hall_id int,foreign key (hall_id) references hall(id));
create table info(id int primary key,price int,info_date timestamp,hall_opening_id int,foreign key (hall_opening_id) references hall_opening(id));
边栏推荐
猜你喜欢

【FAQ】CCAPI兼容EOS相机列表(2022年8月 更新)

亚马逊美国站:马术头盔CPC认证标准要求

单片机原理与应用复习

更改小程序原生radio的颜色及大小

DevOps - Understanding Learning

Get the network input dimensions of the pretrained model

DisabledDate date picker datePicker

Vim tutorial: vimtutor

Error correction notes for the book Image Processing, Analysis and Machine Vision

numpy.random使用文档
随机推荐
Chengyun Technology was invited to attend the 2022 Alibaba Cloud Partner Conference and won the "Gathering Strength and Going Far" Award
Quick Start to Drools Rule Engine (1)
Late night drinking, 50 classic SQL questions, really fragrant~
Email management Filter emails
Collision, character controller, Cloth components (cloth), joints in the Unity physics engine
Passing parameters in multiple threads
NACOS Configuration Center Settings Profile
Linux中安装Redis教程
单片机期末复习大题
【2022 DSCTF决赛wp】
ES2020新特性
Transformer interprets and predicts instance records in detail
document.querySelector() method
如何将.asd恢复为Word文档
UI刘海屏适配方式
NB-IOT智能云家具项目系列实站
cs231n learning record
文本样式这一篇文章就够了
多行文本省略
DevOps - Understanding Learning