Database Design---The right one is the best

Source: Internet
Author: User
Tags management studio sql server management sql server management studio

Database design is the process of designing database structure according to user's requirement, in detail. 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 the application system on the database management system, enables it to store the data effectively. The process of meeting the various needs of the user. Exactly how the database design, through the ages, each person has every person's idea, so the database design has no merits and demerits, good or bad, 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, trial implementation;
6, the implementation of maintenance: the system put into execution, long-term maintenance work.

This paper discusses the requirement analysis, conceptual design and logical structure design, and briefly describes the demand of the computer room charge system. Using the system there are three role users: the general user, the operator, the administrator. Different permissions have different permissions, in details such as the following:

A, the general user can realize the function is:
A, check the remaining amount in the Student card, check the student's basic information and show the remaining amount through the card number query.
b, check the machine record, through the card number query on the machine record, name, the date and time of the machine, the amount of consumption. Export the Execl table.
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 be able to force the management of students to operate the machine.
E, change password.

B, the operator refers to a certain business personnel, the level is higher than the average user, in addition to the ability to implement the attendant functions, but also to run additional functions:

A, register card number, register a new card.


B, recharge, through the card number recharge amount, display the top-up card number. The amount remaining in the last card. The remaining amount in the card, the time of duty and the teacher.
C, return the card, cancel the card and refund the remaining amount in the student card.


D, collect (refund) The amount of inquiry, by entering the starting date and the end date, check the recharge amount. Fill the time of duty, top up teachers, export execl form.
E, student basic information maintenance and operation of staff records, the use of combination query.
F, students on the computer statistics query, using a combination of query, export execl form.

C, the administrator can manage all the system information, the highest level, in addition to the ability to handle the functions of the attendant and operator, but also able to handle other operations:
A, checkout.
B, join the delete user. Join or delete different levels of accounts.


C, basic data settings, including information such as the cost of the machine.


D. View the teacher 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) For example:

Then create the database and table, to create the database and the table, need to go to the top of the database name, all of them. Size. and the files and filegroups that store the database. There are two main ways of creating a database in SQL Server. One is to use the wizard to create the database in SQL Server Management Studio. The second is to create the database by running the T-SQL statement through the query form. As an example of creating a database and a table in T-SQL, implement code such as the following:

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 for example:

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 consumption, the remaining amount.


3, recharge the table: card number, recharge amount, recharge time, top-up teacher.
4, User table: Username, 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, cancellation 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 prepaid card remaining amount, the same day recharge amount, the same day consumption amount, the amount of the card, the date.


11, Weekly Checkout information table: The last Recharge card amount, the amount of the recharge, the amount of this consumption, the amount of the remaining card, the date.

First design database. There are very many flaws. There are not allowed to see the small partners Welcome message exchange. Computer room toll system personal reconstruction version, not to be continued ...

Database Design---The right one is the best

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.