Database design is the process of designing database structure according to user's requirement, specifically, the database design is for a given application environment, under the guidance of the theory of the CuO database, constructs the optimal database pattern, establishes the database and its application system on the database management system, enables it to store the data effectively, The process of meeting the various needs of the user. In the end of the database how to design, through the ages, everyone has the idea of each person, so the database design is not good or bad points, better or worse, the right database design is the best.
Through self-examination-"Database system principle", read Jiang Jianling Teacher's video, the database design has a little understanding, VB version of the computer room charge system, directly with the original script generated database, at that time on the database design this part of the content is not particularly in-depth study, owe debt, sooner or later, I think it is time , these days, VB. NET version of the computer room charge system officially started, only to find that the database design is a learning, next, combined with the computer room charge system, summarize the database design.
First, the database design mainly consists of the following six steps:
1, demand Analysis: Understand the user's data needs, processing requirements, security and integrity requirements;
2, Conceptual design: Through data abstraction, design system conceptual model, generally for E-R model;
3, Logical Structure design: Design system mode and external mode, for the relationship model is mainly basic tables and views;
4, Physical structure design: Design data storage structure and access methods, such as the design of the index;
5, System implementation: organizing data warehousing, compiling applications, commissioning;
6, operation and maintenance: the system put into operation, long-term maintenance work.
This paper discusses the requirements analysis, conceptual design and logical structure design, here is a brief talk about the needs of the computer room charging system, using the system has three role users: for the general user, operator, administrator. Different permissions have different permissions, specifically as follows:
A, the general user can realize the function is
A, check the balance of the student card, check the student's basic information and show the balance through the card number query.
b, check on the machine record, through the card number on the machine record, name, up and down the date and time, consumption amount, export execl form.
c, check the recharge record, through the card number query recharge amount, recharge date, recharge time, recharge the teacher, export Excel form.
D, check the status of students on the computer, and can be forced to manage the students to operate the machine.
E, change the password.
B, the operator refers to the handling of certain business personnel, the level is higher than the average user, in addition to the function of the attendant can be implemented, but also perform additional functions:
A, registration card number, register a new card.
B, top-up, through the card number recharge amount, display the prepaid card number, the last card balance, the card balance, the time of the duty and teachers.
C, withdraw the card, cancel the card and refund the balance of the student card
D, collect (refund) The amount of inquiry, by entering the starting date and termination date, query the recharge amount, charge the time of duty, recharge the teacher, export execl form.
E, student basic information maintenance and operation of staff records, using a combination of queries.
F, students on the computer statistics query, using a combination of query, export execl form.
C, the administrator can manage all information of the system, the highest level, in addition to handling the functions of the attendant and operator, but also to handle other operations:
A. Checkout
b, add delete users, add or delete different levels of accounts
C, basic data settings, including the cost of the machine and other information
D. View teachers on duty
E, the day knot and the weekly knot, relates the report.
According to the above requirements analysis, design ER model (not particularly complete, with different views of the small partners welcome message exchange) such as:
Then create the database and table, to create the database and table, you need to go to the top of the database name, owner, size, and the files and filegroups that store the database. There are two main ways to create a database in SQL Server, one is to use a wizard to create a database in SQL Server Management Studio, and the other is to create a database from a query window execution T-SQL statement. As an example of creating a database and a table in T-SQL, implement the following code:
Create DATABASE Mycharge- -creating mycharge Databases Gouser mycharge--Go to mycharge Database gocreate table Studen-- Create a table in the Student database student ( Sno char) primary key, Sname char (Ten), Ssex, Sage int, sdept char (10) )
The computer room charge system table is as follows:
1, Student table: Card number, school number, name, type, gender, department, grade, class, amount, status, notes.
2, on the Machine table: card number, type, school number, name, department, sex, the date of the machine, the date of the machine, the time of the machine, the time of the machine, the consumption time, the amount of money, the balance.
3, recharge the table: card number, recharge amount, recharge time, top-up teacher.
4, User table: User name, password, identity, operator.
5, Return card form: Card number, refund amount, return the card time, handle the return card teacher, checkout status.
6, operating staff work record table: Serial number, teacher, identity, registration date, registration time, cancellation date, logoff time.
7, Checkout Information table: Sales card number, the total number of cards sold, the number of return cards, the total amount receivable, recharge the amount, the amount of temporary charges.
8, basic data Set Information table: fixed half-hour fee, temporary half-hour fee, increment unit time, at least machine time, preparation time, minimum amount.
9, is on duty teacher Information table: Record number, teacher name, identity, landing date, login time.
10, the Daily checkout information table: The last Recharge card balance, the same day recharge amount, the amount of the same day, the amount of this prepaid card, date.
11, Week Checkout information table: The last Recharge card amount, the amount of the recharge, the amount of this consumption, the balance of the prepaid card, the date.
The first design database, there are many defects, there are different views of the small partners welcome message exchange, computer room fee system personal reconstruction version, not to be continued ...