Vb. NET Edition computer room charge system-Database design

Source: Internet
Author: User

before the first time the computer room charges, the database used is someone else's. Cognition can only be built on the basis of others, such as the "database system principle" after learning the book, then to see the database, found that the database really need further optimization. Here are some insights into my database design. I hope you will make some more comments.

Database Designe-r Model:

In the conceptual model design stage, a system is built on the ER model, it is very important to design the ER model.

I designed the ER diagram:


entities in the system: very easy, that is, the system of the nouns are abstracted out, and then the details are converted to the logical design of the database to be considered. the connection in the system: in the picture can see very clearly, here I want to focus on is:

(1) I separate the t_student table from the T_card table. Is it because the previous design violates the third paradigm, and why is the student and card number a one-off relationship? Because my design idea is: A student can only have a card to be able to use normally. Other, for example, the student lost the card, the previous card can not be used. However, the card table will still keep the information of the card that is not in use. Therefore, card-table and student tables are separated. But a student can only use one card.

(2) This design, will once the Line table and online table and for a table T_online table, figure 1 See; The former onwork and Wordlog tables are combined into a table T_wordlog table. As seen in Figure 2. Delete the Checkweek table (as with the Checkday table, only the query conditions are different.)




The T_line table after design:


Figure 1



The T_wordlog table after design:


Figure 2

ER: In the system ER diagram, you can see the connection between them very clearly. There are 1 to 1. 1 to many. Many to 1. Many to many, this relationship must be clear, even if you and others are not the same. It does not matter. Because of the design of the time, the idea is different, it will produce a variety of effects.

Properties of ER: see later relationship model.

This is the design of ER diagrams, in fact. Er design out of time, very many people have different ideas, for example, some people say my student watch and card table apart will be very messy, when the register. It is very complicated to register separately. I think we can try each other, the benevolent see!

Just when someone asks. Give yourself a say.

Relational Model:

The main components in the ER diagram are entity types and contact types. The conversion algorithm is how to convert entity type and contact type into contact mode.

er entity type conversions: (All rectangles in the ER diagram are entities and can be built into tables):

T_basicdata (Rate,tmprate,unittime,leasttime,preparetime,limitcash,head)

T_card (cardno,registerdatetime,cacnceldatetime,cash,head,type,status) t_student (studentno,cardno,studentname,age,sex,department,grade,class,date,time,explain)

T_user (Userid,sername,level,password. Computer,head)

t_checkday (lastcash,head,recharge,cancelcash,consumecash,nowcash,computer,status) T_wordlog (userid,level,logindate,logintime,logoutdate,logouttime,computer,status)

er Relationship transformation:

For 1:1 relationships, the T_student table can increase the Cardno field (Studentno as the primary key and Cardno as the foreign key).

For 1:n relationships, you can increase the value of the property appropriately.

For n:m relationships. A relationship is a pattern (blue Diamond t_line and T_recharge)

T_line (Cardno,head,onliendatetim,outlinedatetime,consumetime,consume,computer,status)

T_recharge (Cardno,head,recharge,datetime,ischeck)

All right, look, it's good enough to meet the requirements of the three paradigms:

First paradigm: attributes are not divided. In fact, this is very easy to see. The property value can only be multiple single-valued properties.

The second paradigm: eliminate partial dependencies, a very easy one that is disrupted by functionality. Since very many people are based on the ability to arrange attributes, this can be done and done. Check that there is no local dependency. You can remove it.

The third paradigm: elimination of transmission dependence, this has to take a good look. To the previous student table and card table into a table in fact, there is a transitive dependency, separate is right.

Design Database:

The basic thing is to pay attention to the data type. This still needs to look at the code, my first version of the system d all the date and time. are all used for datetime data types. Be sure to see if there is a problem in the vb.net.

In conclusion, we must learn to apply our knowledge, I learn the database is too shallow, very much or based on the original database. But I believe that when we study hard. Bold try, or very quickly will be harvested, the above database is just a few personal ideas, there is better. We share and communicate with each other.




Vb. NET Edition computer room charge system-Database design

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.