# Database design of computer room charge system

Source: Internet
Author: User

Objective

A period of time to participate in self-examination, to test the principles of the database, in which also more understanding of a lot of database problems. For example, how to create a good database, how to create a database.

                                   图一 数据库创建框架

Now start the Machine room reconstruction, formerly used is Brother Siang design database, now found themselves can also design out, so, according to this step to design a computer room charge system database.

First, planning

Because the computer room charge system is the second time to do, so in the overall planning stage it is easy to see the system in technology, economy, efficiency, law is feasible; The goal is to better match the application of reasonable operation.

Second, demand analysis

This stage is for the computer personnel (System analyst) and the user to jointly collect the information content of the database and the user's needs for processing. And in the form of requirements specification, as a guide to future system development and system verification basis.
In the computer room charge system, three kinds of permissions are assigned to users. The user can achieve different work performance.

                                 图二  机房收费系统功能框架
Third, conceptual design

Objective: A database conceptual structure that reflects the information needs of the user unit.
The conceptual pattern is independent of the computer hardware structure and is independent of the DBMS that supports the database.

E-r diagram of charge system in computer room

                                   图三  机房收费系统ER图

We can find entities that exist through ER diagrams and can be abstracted into tables.

Four, logical design

The main idea is to transform the conceptual model into a logical model that can be processed by DBMS. During the conversion process, the model is evaluated and the performance is tested in order to obtain a better pattern design.

In the computer room charge system, we can transform the ER diagram in the conceptual design into our logical model.

The relation mode of the charge system of computer room:

1) User information (user ID, user name, level, password, creator)

2) basic data (user number, member unit price, normal unit price, increment time, at least machine time, preparation time, minimum amount, edit date, edit time)

3) Student Information (school number, user ID, student name, gender, department, grade, class, remark, registration date, registration time)

4) Card (card number, user number, card status, card type, amount, whether checkout, registration time)

5) Recharge (card number, user number, recharge amount, recharge date)

6) on-Machine condition (card number, date of machine, machine time, machine date, machine time, consumption time, consumption amount, on-machine status)

7) return Card (card number, user number, refund amount, date of return)

8) Daily Checkout order (user number, previous balance, daily recharge amount, daily consumption, daily return, current amount, date)

9) Weekly Checkout order (user number, previous balance, daily recharge amount, daily consumption, daily return, current amount, date)

10) Working record (user number, machine time, machine time, machine number, user status)

Five, physical design

This stage is mainly in the database storage record format, storage record arrangement and access method. This phase relies entirely on a given hardware environment and database product.

No tables are designed as needed:

(1) User information (User_info)

Description Field name Data Type size is empty
User number Userno VarChar 10
User name UserName VarChar 10 Is
Level Level VarChar 10
Password Password VarChar 10
Created by Constuctorno VarChar 10 Is

(2) basic data (Basicdata_info)

Description Field name Data Type size is empty
User number Userno VarChar 10
Member Price Viprate Int
Normal unit Price Commonrate Int
Increment time Increasetime Int
Minimum on-Machine Leasttime Int
Preparation time Readytime Int
Minimum Amount Leastcash Int
Edit Date Time SetDateTime Datatime Is

(3) Student Information (student_info)

Description Field name Data Type size is empty
User number Userno VarChar 10
School Number Studentno VarChar 10
Student Name Studentname VarChar 10
Gender Sex VarChar 10
Department Department VarChar 10
Grade Grade VarChar 10
Class Class VarChar 10
Note Explain VarChar 50 Is
Registration time Registerdatetime Datatime Is
Student Status Studentstate VarChar 10 Is
Card Cardno VarChar 10

(4) Recharge (Recharge_info)

Description Field name Data Type size is empty
Card Cardno VarChar 10
User number Userno VarChar 10
Recharge Time Rechargedatetime Datatime
Recharge Amount Recharge Int

(5) on-Machine condition (online_info)

Description Field name Data Type size is empty
Card Cardno VarChar 10
Between the machines Oncomdatetime Datatime
Off-Machine time Offcomdatetime Datatime
Consumption time Usetime Int
Consumption amount Usedcost Int
On-Machine status Comstate varchar 10
Computer name Comname Int

(6) Return card (Backcard_info)

Description Field name Data Type size is empty
Card Cardno VarChar 10
User number Userno VarChar 10
Card return time Backdatetime Datatime
Return card Amount Backcash Int

(7) Card (Card_info)

Description Field name Data Type size is empty
Card Cardno VarChar 10
User number Userno varchar 10
Balance Cash Int Is
Card type Cardtype varchar 10
Checkout Ischeck varchar 10
Registration time Registerdatetime Datetime
Card status Cardstate varchar 10

(8) Working record (Worklog_info)

Description Field name Data Type size is empty
User number Userno VarChar 10
Between the machines Entercomdatetime Datetime
Off-Machine time Offcomdatetime Datetime Is
Computer name Comname varchar 50
User status UserState varchar 10

(9) Daily closing order (Daycheck_info)

Description Field name Data Type size is empty
User number Userno VarChar 10
Balance of previous Period Remaincash Int Is
Same-day recharge amount Rechargecash Int Is
Daily consumption Consumecash Int Is
Same day refund Backcash Int Is
Today's Amount Allcash Int Is
Date Checkdate Date

(10) weekly closing order (Weekcheck_info)

Description Field name Data Type size is empty
User number Userno VarChar 10
Last week balance Remaincash Int Is
Amount to recharge this week Rechargecash Int Is
Spending this week Consumecash Int Is
return this week Backcash Int Is
Amount this week Allcash Int Is
Date Checkdate Date
VI. implementation of the database

Set up the table after the basic completed, this time the database and the application to communicate, reference the database, the database test run.

Vii. database operation and Maintenance

In the process of writing the program, it is found that some local database data types will have an impact, can be updated changes. Maintain the database.

< extra > Chicken Soup for the Soul

Through the design of the database, I again go through the software creation process, the basic and soft work of the idea is the same, which still needs our constant understanding of continuous innovation, for example, the ER diagram of the drawing, how to find the entity, how to find out the relationship, this is the stage we have to master, this is our foundation!

"Wang Lei Http://blog.csdn.net/kisscatforever"

# Database design of computer room charge system

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.