emp_dept_id
Documentation | Employees (MySQL database) |
Name | emp_dept_id |
Returns the department id of a given employee
Input/Output
Mode | Name | Data type | Description | |
---|---|---|---|---|
1 | OUT | Returns | char(4) | Returns the department id of a given employee |
Returns the department id of a given employee | ||||
2 | IN | employee_id | int(10, 0) | Employee identification number |
Employee identification number |
Script
begin declare max_date date; set max_date = ( select max(from_date) from dept_emp where emp_no = employee_id ); set @max_date=max_date; return ( select dept_no from dept_emp where emp_no = employee_id and from_date = max_date limit 1 ); end |
Exported: 2018-11-09 14:32, Last imported: 2018-08-06 09:21