← All tables and views
Employees (browser edition) view
current_dept_emp
Native view in the Employees (browser edition) sample database.
1,024rows
4 columns
Schema from the provider contract| Column | Type | Nullable | Key | References |
|---|---|---|---|---|
emp_no | | yes | — | — |
dept_no | | yes | — | — |
from_date | | yes | — | — |
to_date | | yes | — | — |
View definition
CREATE VIEW current_dept_emp AS
SELECT l.emp_no, d.dept_no, l.from_date, l.to_date
FROM dept_emp AS d
INNER JOIN dept_emp_latest_date AS l
ON d.emp_no = l.emp_no AND d.from_date = l.from_date AND l.to_date = d.to_dateData preview
Sample records
| emp_no | dept_no | from_date | to_date |
|---|---|---|---|
| 10001 | d005 | 1986-06-26 | 9999-01-01 |
| 10002 | d007 | 1996-08-03 | 9999-01-01 |
| 10003 | d004 | 1995-12-03 | 9999-01-01 |
| 10004 | d004 | 1986-12-01 | 9999-01-01 |
| 10005 | d003 | 1989-09-12 | 9999-01-01 |
| 10006 | d005 | 1990-08-05 | 9999-01-01 |
| 10007 | d008 | 1989-02-10 | 9999-01-01 |
| 10008 | d005 | 1998-03-11 | 2000-07-31 |