Ask the great God for questions about database design

Source: Internet
Author: User
I am a rookie, recently in the development of a repair system based on PHP+MYSQL, developed to half found the structure of the database has a serious error.




The main problem appears on the association of the user table and the Web_order table, the primary key UID of the user table is associated with the foreign key of the Web_order table, and the value of W_workid in the Web_order table is also the value of the UID field of the user table. Reason in the user permissions with my user table is only used in a power field to differentiate, this system has ordinary users, maintenance staff, Secretary, Administrator 4 permissions, the system logically need to mark the repair of the (user), who repair (the maintenance staff), who is assigned (Secretary), which let me not know how to associate, How to change the table structure, please greatly help, thank you.


Reply to discussion (solution)

So who do you think is the subject?
Obviously the Web_order table, so what's the problem?

So who do you think is the subject?
Obviously the Web_order table, so what's the problem?

I know the Web_order table is the main body, the problem is to achieve the system logically marked the repair of the person who repaired the (user), who is the maintenance (maintenance), who is assigned (Secretary), how to adjust the Web_order table, user table has all the user information (including maintenance staff, Secretary, Normal user, administrator), authority to distinguish with power, the user repair a single will have UID to associate, but secretary, what does the repairman use to correlate the Web_order table? If it seems like that add a workid to the association (insert UID), it is necessary to query out a single repair and maintenance personnel will find no.

The Web_order table will have a record when the repair is repaired.
The Web_order table will have a record during maintenance.
The Web_order table will also have a record when assigned
How could it not be connected?



The status of the repair order in the Web_order is determined by the State field, and the repair will add a record on the Web_order, and the secretary assignment and the repairman order will be represented by the Update table in the states field, and no record is added.

Since the secretary assignment and the repairman answer list are indicated by the State field of the Update table, the record is not added
Then there's no place for you to record who's doing it.
So naturally, it's impossible to tell who's doing what.
Can't you find a solution to such an obvious problem?

Since the secretary assignment and the repairman answer list are indicated by the State field of the Update table, the record is not added
Then there's no place for you to record who's doing it.
So naturally, it's impossible to tell who's doing what.
Can't you find a solution to such an obvious problem?

In addition, two tables are established, and the order form is linked, and the operations of secretaries and maintenance staff are recorded separately.

Add an operation log table, record the personnel time what operation and so on information

  • 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.