By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
id | name |
---|---|
1 | D1 |
2 | D2 |
3 | D3 |
id | department_id | chief_id | name | salary |
---|---|---|---|---|
1 | 1 | 5 | John | 100 |
2 | 1 | 5 | Misha | 600 |
3 | 2 | 5 | Eugen | 300 |
4 | 2 | 5 | Tolya | 400 |
5 | 1 | null | Stepan Chief | 500 |
department_name | name |
---|---|
D1 | John |
D1 | Misha |
D2 | Eugen |
D2 | Tolya |
id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | PRIMARY | department | null | ALL | null | null | null | null | 3 | 100.00 | null |
1 | PRIMARY | employee | null | ALL | null | null | null | null | 5 | 20.00 | Using where; Using join buffer (Block Nested Loop) |
2 | DEPENDENT SUBQUERY | emp | null | ALL | null | null | null | null | 5 | 20.00 | Using where |
department_name | name |
---|---|
D1 | John |
D1 | Misha |
D2 | Eugen |
D2 | Tolya |
id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | PRIMARY | department | null | ALL | null | null | null | null | 3 | 100.00 | Using where |
1 | PRIMARY | <derived2> | null | ref | <auto_key0> | <auto_key0> | 5 | db_1367354022.department.id | 2 | 33.33 | Using where |
2 | DERIVED | <derived3> | null | system | null | null | null | null | 1 | 100.00 | Using filesort |
2 | DERIVED | employee | null | ALL | null | null | null | null | 5 | 100.00 | null |
3 | DERIVED | null | null | null | null | null | null | null | null | null | No tables used |