In actual projects, requirement analysis and database design are very important. This step will directly affect the development process and quality of the project. In reality, this step requires not only computer experts such as system analysts and software engineers, but also expert participation in related fields.
However, in this article {
Tagshow (Event)
} "> In the series, the demo is just an example, and its business is extremely simple. Therefore, this is not a real requirement analysis and database design, the demo requirements and databases are listed here, so that you can have a general understanding of the demo, so that you can understand the development process in subsequent articles.
Requirement Analysis:
This project is a message book and its business is extremely simple. It is described as follows.
1. Any visitor can leave a message. After the message is completed, the body is not displayed immediately. Instead, the message is sent to the Administrator {
Tagshow (Event)
} "> Displayed only after verification.
2. Any visitor can post comments on the messages. Comments cannot be posted on messages that fail to pass verification.
3. the administrator can reply to the message (This reply is different from the comment, which is directly displayed under the body, and only one reply can be sent to a message) and delete the message and comment, and verify the message.
4. administrators are divided into super administrators and common administrators. Only one super Administrator is responsible for adding and deleting common administrators. Common administrators can manage messages and change their logon passwords.
The example of this project is as follows:
Attachment: f1.jpg
Database Design:
Before designing a data table, identify and determine entities and relationships.
Through requirement analysis, we can observe that the entity of this project includes: Administrator (not including super administrator), comment, and comment. This project has one-to-multiple relationships between messages and comments.
Further, the database tables are designed as follows:
Administrator table (tadmin)
Id int administrator ID notnull primary key, auto-Increment
Name varchar (20) login name notnull
Password varchar (50) logon password notnull uses MD5 Encryption
Message table (tmessage)
Id int Message ID notnull primary key, auto-incrementing
Guestname varchar (20) Message holder username notnull
Guestemail varchar (100) message recipient email null
Content text message content notnull
Time datetime message posting time notnull
Reply text returns NULL
Ispass varchar (10) Whether notnull is verified
Comment table (tcomment)
Id int comment ID notnull primary key, auto-incrementing
Content text comment content notnull
Time datetime comment time notnull
Id foreign key of the message to which messageid int belongs