Questions about data design of a crm system

Source: Internet
Author: User
A crm system has data design problems, such as a question, an employee table containing employee ID, name, phone number, address, department, and other information. If the department is not the headquarters, you need to continue reporting. Now we need to design a database: 1. select an employee and write the report chain of the employee. 2. if a department manager is used, all employees in the department are listed. The idea I came up with is recursive, but considering the large amount of data, a crm system data design problem
For example, there is an employee table with employee ID, name, phone number, address, department, and other information. If the department is not the headquarters, you need to continue reporting.

Now we need to design the database:
1. select an employee and write the report chain of the employee.
2. if a department manager is used, all employees in the department are listed.


The idea I came up with is recursive, but it may not work very efficiently considering the large amount of data.

Is there any good optimization method. If recursion is used, provide some examples and solutions. Thank you for sharing the following information about crm database optimization:
------ Solution --------------------
I wonder if you want to ask about database design or implementation.
------ Solution --------------------
What bureaucracy? How many recursion attempts are you going to perform?
------ Solution --------------------
Recursively write all your departments to the array storage file.
------ Solution --------------------
Depid in employee table,
Department table:
Id pid title
------ Solution --------------------
Add a department manager to the department table
------ Solution --------------------
Department code
01
0101
010101
------ Solution --------------------
The moderator method is feasible, and the database does not need to be designed. after the department code is properly designed, the report chain can be directly separated.

------ Solution --------------------
A table is differentiated by parentID.

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.