当前位置:网站首页>Database design - Simplified dictionary table [easy to understand]
Database design - Simplified dictionary table [easy to understand]
2022-07-25 11:22:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
In database design , We often encounter various business needs , So as to design a variety of tables . And want to make a database , It not only requires a deep understanding of various business needs in the early stage , We also need to update and modify the database in the process of later project improvement, so as to make the database design more perfect . For those tables that involve business, it may not be easy to start , But the various dictionaries that often appear in the project are a good place to start . The larger the project, the dictionary table is indispensable , Dictionary table is a common type 、 state 、 Some specific values such as units . Some people design a dictionary table for each business or module to identify types or states, etc , In this way, there will be a lot of watches . In fact, we can combine some dictionary tables , Using two tables can realize the functions of multiple tables . Let me demonstrate with three status tables . Here are the contents of the three tables , The table names are Order_Status、Clip_Status、RedPacket_Status
The functions of the above three tables are : The first piece of status information used to process orders , The second one is for processing cards ( Such as membership card ) Status information , The third is the status information used to process red packets . According to the above situation, it is obvious that , The third table is redundant , It's completely possible to remove the third table and use the data of the second table , But because the business needs to add other statuses to the third table , Isn't it necessary to add this table , What if you add it to the second table ? No way , If you need to maintain the dictionary table of each business module , There are two business modules corresponding to the second table , That would be a bit nondescript . Next, the method of merging appears to be more flexible . We can assume that each business module is a large class , The dictionary table data used by the business module is assumed to be a small class . According to this idea, multiple dictionary tables can be merged . The following figure shows the table structure :
Table data :
Linked table query results :
Some people will say that the card status and red envelope status still have the same value ? This is not good enough . It's simple , stay Functional_Describe Add a public area to the same value in the table . See the picture below :
summary : Obviously, this is a one to many relationship , A business or module corresponds to multiple states or types , This design can omit multiple tables , Scalability is also ok , For new businesses , Just go to Functional_Describe Add its description to the table , Going Status Add the corresponding dictionary table data to the table . It only involves data entry without adding tables .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/127084.html Link to the original text :https://javaforall.cn
边栏推荐
- MySQL | GROUP_CONCAT函数,将某一列的值用逗号拼接
- Flame framework - Flame WTF form: file upload, verification code
- SQL语言(五)
- 【云享新鲜】社区周刊·Vol.72- 2022华为开发者大赛中国区首场开幕式启动;华为云KooMessage火热公测中…
- DNS分离解析的实现方法详解
- B2B2C多商户系统功能丰富,极易二开!!!
- HDD杭州站全程体验有感
- Nowcodertop7-11 - continuous updating
- NowCoderTOP7-11——持续更新ing
- What is MySQL transaction
猜你喜欢

Reinforcement Learning 强化学习(四)

The most detailed MySQL index analysis (mind map is attached at the end of the article)

用Unity不会几个插件怎么能行?Unity各类插件及教程推荐

ESP8266 使用 DRV8833驱动板驱动N20电机

爬虫基础一

Motivation of enterprises to practice open source
Learn NLP with Transformer (Chapter 2)

【flask高级】从源码深入理解flask的应用上下文和请求上下文

SQL语言(一)
Learn NLP with Transformer (Chapter 3)
随机推荐
SQL语言(五)
一篇看懂:IDEA 使用scala 编写wordcount程序 并生成jar包 实测
TPS calculation in performance test [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]
Nowcodertop1-6 - continuous updating
MLX90640 红外热成像仪测温模块开发笔记(五)
Learn PHP -- phpstudy tips mysqld Exe: Error While Setting Value ‘NO_ ENGINE_ Solution of substitution error
HCIA experiment (06)
C# Newtonsoft.Json 高级用法
tensorflow入门
Learn NLP with Transformer (Chapter 4)
[递归] 938. 二叉搜索树的范围和
What is MySQL transaction
Signal integrity (SI) power integrity (PI) learning notes (XXXIII) 102 general design rules to minimize signal integrity problems
The University of Gottingen proposed clipseg: a model that can perform three segmentation tasks simultaneously using text and image prompts
Guys, flick CDC table API, Mysql to MySQL, an application that can
SQL语言(三)
[动态规划] 70. 爬楼梯
DICOM medical image viewing and browsing function based on cornerstone.js
MLX90640 红外热成像仪测温模块开发笔记(五)
Learn NLP with Transformer (Chapter 6)