数据库设计的三个阶段
数据库的设计一共分多少个阶段呢,严来说,不止三个阶段,今天我们仅讨论其中的三个阶段。概念设计、逻辑设计和物理设计阶段。 首先要搞清楚几个问题,数据库为什么要分阶段设计?三个阶段有什么联系?要说清楚这几个问题,只有理论是说不清的,我们还是来举
数据库的设计一共分多少个阶段呢,严格来说,不止三个阶段,今天我们仅讨论其中的三个阶段。概念设计、逻辑设计和物理设计阶段。
首先要搞清楚几个问题,数据库为什么要分阶段设计?三个阶段有什么联系?要说清楚这几个问题,只有理论是说不清的,我们还是来举个例子吧。
现在有一个图书馆,需要为读者信息、图书信息、借阅信息建立一个数据库,读者信息包括姓名、学号、性别、办卡日期、家庭住址、联系电话、类别等,图书信息包括编号、作者、出版信息、页数、登记日期等,借阅信息包括借书证号、图书编号、书名、借还日期等,这么多的信息,如果在没有进行分析之前就开始设计数据库是不现实的。所以,首先要把这些数据进行分类、整理(概念模型),然后画出图表或者表格,最后画出这些数据信息的关系结构(逻辑模型),甚至制定数据库的存储记录格式、存储记录安排、和存取方法(物理模型)使用户能简单、方便、容易的存取数据。所以,数据库设计必须经过这三个设计阶段,下面我们来详细讨论这三个设计阶段。
一 从上面的例子,我们可以得出以总结出三个阶段(模型)各自的特点:
1 概念模型:首先,概念模型是一个工具,是数据库设计人员和客户进行交流的平台;它独立于硬件和软件;概念模型表达了数据的整体逻辑结构,它是系统用户对整个应用项目设计的数据的全面描述;概念模型是从用户的观点出发,对数据建模。
2 逻辑模型:逻辑模型首先也是一个工具,它是数据库设计人员和应用程序员进行交流的平台;逻辑模型独立于硬件,但是却依赖于软件(数据库系统);逻辑模型表达了数据库的整体逻辑结构,但它是设计人员对整个项目数据库的全面描述;逻辑模型是从数据库实现的观点出发,对数据建模。
3 物理模型:物理模型(内部模型)是数据库最底层的抽象,它描述数据在磁盘或磁带上的存储方式(文件的结构)、存取设备(外存的空间分配)和存取方法(主索引和辅助索引)。
概念模型和逻辑模型各有不同,用一个表格对比一下。
特点 |
功能 |
出发点 |
独立性 |
用户 |
概念模型 |
表达了数据的整体逻辑结构 |
用户需求 |
独立于硬件和软件 |
设计人员和用户 |
逻辑模型 |
表达了数据库的整体逻辑结构 |
数据库实现 |
独立于硬件但是依赖于软件(数据库系统) |
设计人员和应用程序员 |
二 咱们再从数据描述来探讨他们的区别于联系。
1 数据库的概念设计是根据用户的需求设计数据库的概念结构,他以规范的形式,表达了用户需求所涉及事物的理解。这一阶段用到四个术语:
实体:客观存在,可以相互区别的事物就是实体,它可以是具体的对象,一个人,一个房子等等,也可以是一个抽象的对象,马克思主义,毛泽东思想等等;
实体集:简单来说就是同类实体的集合,我们都学过集合,这个概念就不深究了;属性:实体的特性就是属性,这个概念可以对比vb控件来学习,每一个属性都有一个值域,它的类型也是各种各样。
实体标识符:能唯一标识实体的属性或属性集,也称关键码(key)。
2 数据库的逻辑设计是根据概念设计的结果设计数据库的逻辑结构,及表达方式和实现方法。逻辑设计有许多方法,每个方法都有一套术语,下面列举最常用的一套术语:
字段:标记实体属性的命名单位,它是可以命名的最小实体单位,又称为数据元素或初等项,它的命名旺旺和属性名相同。
记录:字段的有序集合成为记录,一般用一个记录来描述一个实体。
文件:同一类记录的集合。
关键码:能唯一标识文件中每个记录的字段或字段集。
用一个表格来对比概念和逻辑设计中数据的联系:
概念设计 |
实体 |
属性 |
实体集 |
实体标识符 |
|
…… |
…… |
…… |
…… |
逻辑设计 |
记录 |
字段 |
文件 |
关键码 |
3 数据库物理设计,它涉及到了硬件知识,咱们这里只做介绍,不做讨论了。高速缓冲存储器(Cache):访问速度最快,最贵的存储器;主存储器:也就是内存;快擦科协存储器:介于内存和硬盘之间的一种存储器;磁盘存储器:俗称硬盘;光存储器:光盘;磁带等。下面用一张图来描述他们的存储层次关系:
三 理论性的东西没有直观性,我们还以上面图书馆的例子为基础,继续讨论三个设计阶段的特点和联系。
首先应该分析数据信息,画出他们的联系,下面是读者和图书之间的简单关系图(ER图)

这个简单的ER图直观的表达除了读者和图书之间的关系,根据这个图,我们可以列出五个相互联系的表格,联系如下:喎?http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+ICAgICA8aW1nIHNyYz0="" alt="\">
这五个表格就是数据库逻辑设计的表格的内容了。具体数据库表格就不画了。

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.

According to news on May 8, Apple’s new iPad Pro/Air tablets have been released. According to Apple’s official website, the new iPad Pro and iPad Air no longer support the second-generation Apple Pencil released in 2018, but only support Apple Pencil Pro and Apple Pencil (USB- C). Apple Pencil (USB-C) will be released in November 2023. This stylus maintains the same pixel-level accuracy, low latency, and tilt-angle sensing features as the first and second-generation Apple Pencil, while eliminating pressure sensitivity. function and does not support wireless charging. Its price is 649 yuan. And the newly released ApplePe
