重构机房收费系统数据库设计
曾记得,第一次编写机房收费系统的文档模板,整整有12个文档需要编写,仅仅花了两三天的时间就让师傅验收,完结项目,就这样囫囵吞枣的文档编写完成了。 要知道:欠下的账,终究是要还的。现在到了机房收费系统个人版重构阶段, (1)进行数据抽象,设计局部
曾记得,第一次编写机房收费系统的文档模板,整整有12个文档需要编写,仅仅花了两三天的时间就让师傅验收,完结项目,就这样囫囵吞枣的文档编写完成了。 要知道:欠下的账,终究是要还的。现在到了机房收费系统个人版重构阶段,
(1)进行数据抽象,设计局部概念模型;
(2)将局部概念模型综合成全局概念模型
(3)就可以按要求绘制机房收费系统数据库概念设计模型——ER关系图。
可以说,之前的数据库的概念设计给我奠定了一丢丢的设计基础,外加《数据库系统原理》中的三范式定理,本着求知好学、虚心请教的理念,于是乎发表这篇博客,希望大家多多指正。
在数据库设计中,理清ER关系图是尤为重要的。但往往是,我们根本理不清,有一种剪不断,理还乱的感觉有木有……有木有。
先睹为快:
1、第一范式1NF
定义:数据库表中的字段都是单一属性的,不可再分。
通俗简单的说,每一个属性都是原子项,不可分割。
如:地址这个属性就必须拆分为 省、区、街、乡、道这几个单值属性。
2、第二范式2NF
定义:如果关系模式R是1NF,且每个非主属性完全函数依赖于候选键。
通俗简单的说,在满足第一范式的前提下,当某张表中的非主键信息不是由整个主键函数来决定时,即存在依赖于该表中不是主键的部分或者依赖于主键一部分的部分时,这就不满足2NF的关系模式
如:原版的机房收费系统学生表,可以拆成 学生信息表 和 卡表。这样就满足了第二范式。
3、第三范式3NF
定义:如果关系模式R是1NF,且每个非主属性都不传递依赖于R的候选键。
通俗简单的说,消除没有直接依赖于第一范式和第二范式形成的表的主键的属性,为没有与表的主键关联的所有信息建立了一张新表。每张新表保存了来自原表的信息和它们所依赖的主键。
如:管理员的级别【Level】由用户名称【UserID】决定,而【UserID 】由上网的学生的【StudentNo】和【CardNo】来判断,由此产生了传递依赖,第三范式往往就是消除传递的依赖的作用。
实践是检验真理的唯一标准。这话说的真没错,自己冥思苦想半天,不如动手一画来得快,画着着画着,之间的关系就越来越明确了。
再次看一下张机房收费系统——ER 图吧(申明:本人的图必有瑕疵……小的望大爷大神们多多海涵,小的真在努力学习ing)
从我的ER图中可以清晰的观察到各个实体间的关系和实体的属性,以及实体间的联系。从而可以转换成关系模型。如何转换自己百度一下吧。
个人机房重构才刚刚开始……这开头路似乎有点太是艰难了,归宗与自己造的孽,打碎牙也只能往肚子里咽,一步一步走下去,一定能行的。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

According to news on July 12, the Honor Magic V3 series was officially released today, equipped with the new Honor Vision Soothing Oasis eye protection screen. While the screen itself has high specifications and high quality, it also pioneered the introduction of AI active eye protection technology. It is reported that the traditional way to alleviate myopia is "myopia glasses". The power of myopia glasses is evenly distributed to ensure that the central area of sight is imaged on the retina, but the peripheral area is imaged behind the retina. The retina senses that the image is behind, promoting the eye axis direction. grow later, thereby deepening the degree. At present, one of the main ways to alleviate the development of myopia is the "defocus lens". The central area has a normal power, and the peripheral area is adjusted through optical design partitions, so that the image in the peripheral area falls in front of the retina.

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

According to news on May 13, vivoX100s was officially released tonight. In addition to excellent images, the new phone also performs very well in terms of signal. According to vivo’s official introduction, vivoX100s uses an innovative universal signal amplification system, which is equipped with up to 21 antennas. This design has been re-optimized based on the direct screen to balance many signal requirements such as 5G, 4G, Wi-Fi, GPS, and NFC. This makes vivoX100s the mobile phone with the strongest signal reception capability in vivo’s history. The new phone also uses a unique 360° surround design, with antennas distributed around the body. This design not only enhances the signal strength, but also optimizes various daily holding postures to avoid problems caused by improper holding methods.

According to news on July 29, the Honor X60i mobile phone is officially on sale today, starting at 1,399 yuan. In terms of design, the Honor X60i mobile phone adopts a straight screen design with a hole in the center and almost unbounded ultra-narrow borders on all four sides, which greatly broadens the field of view. Honor X60i parameters Display: 6.7-inch high-definition display Battery: 5000mAh large-capacity battery Processor: Dimensity 6080 processor (TSMC 6nm, 2x2.4G A76+6×2G A55) System: MagicOS8.0 system Other features: 5G signal enhancement, smart capsule, under-screen fingerprint, dual MIC, noise reduction, knowledge Q&A, photography capabilities: rear dual camera system: 50 million pixels main camera, 2 million pixels auxiliary lens, front selfie lens: 8 million pixels, price: 8GB

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

According to news on July 19, Xiaomi MIX Fold 4, the first flagship folding new phone, was officially released tonight and is equipped with a "three-dimensional special-shaped battery" for the first time. According to reports, Xiaomi MIX Fold4 has achieved a major breakthrough in battery technology and designed an innovative "three-dimensional special-shaped battery" specifically for folding screens. Traditional folding screen devices mostly use conventional square batteries, which have low space utilization efficiency. In order to solve this problem, Xiaomi did not use the common winding battery cells, but developed a new lamination process to create a new form of battery, which greatly improved the space utilization. Battery Technology Innovation In order to accurately alternately stack positive and negative electrode sheets and ensure the safe embedding of lithium ions, Xiaomi has developed a new ultrasonic welding machine and lamination machine to improve welding and cutting accuracy.

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

Xiaomi's Redmi brand is gearing up to add another budget phone to its portfolio - the Redmi 14C. The device is confirmed to be released in Vietnam on August 31st. However, ahead of the launch, the phone's specifications have been revealed via a Vietnamese retailer. Redmi14CR Redmi often brings new designs in new series, and Redmi14C is no exception. The phone has a large circular camera module on the back, which is completely different from the design of its predecessor. The blue color version even uses a gradient design to make it look more high-end. However, Redmi14C is actually an economical mobile phone. The camera module consists of four rings; one houses the main 50-megapixel sensor, and another may house the camera for depth information.
