How to design the table structure of the warehouse management system in MySQL to manage warehouse employee information?
In the warehouse management system, employee information is an important part, and its table structure design should be able to store basic employee information and related warehouse management data. When designing the table structure of the warehouse management system in MySQL, it can be divided into multiple tables according to the attributes of employee information, and primary keys and foreign keys can be used to establish relationships between tables.
The following is an example of table structure design for warehouse employee information:
Employee table (Employees)
CREATE TABLE Employees (
emp_id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(50), gender ENUM('男', '女'), birth_date DATE, phone_number VARCHAR(11), email VARCHAR(50)
);
Department table ( Departments)
CREATE TABLE Departments (
dept_id INT PRIMARY KEY AUTO_INCREMENT, dept_name VARCHAR(50)
);
Employee-Department relationship table (Employee_Department)
CREATE TABLE Employee_Department (
rel_id INT PRIMARY KEY AUTO_INCREMENT, emp_id INT, dept_id INT, FOREIGN KEY (emp_id) REFERENCES Employees(emp_id), FOREIGN KEY (dept_id) REFERENCES Departments(dept_id)
);
Work record table (Work_Record)
CREATE TABLE Work_Record (
record_id INT PRIMARY KEY AUTO_INCREMENT, emp_id INT, join_date DATE, leave_date DATE, position VARCHAR(50), FOREIGN KEY (emp_id) REFERENCES Employees(emp_id)
);
salary_id INT PRIMARY KEY AUTO_INCREMENT, emp_id INT, month DATE, salary DECIMAL(10, 2), FOREIGN KEY (emp_id) REFERENCES Employees(emp_id)
The above is the detailed content of How to design the table structure of the warehouse management system in MySQL to manage warehouse employee information?. For more information, please follow other related articles on the PHP Chinese website!