Conditional table reference
Creating a table task adding a refer id field for each referred table, in this way:


type : I prefer something as 'tree', 'pen'. Use an enum for this: ENUM('tree', 'pen');
tree_id : int (it can be NULL), that refers to tree table;
pen_id : int (it can be NULL), that refers to pen table;
name : varchar;


Some test data:

+------+---------+--------+-------+
| type | tree_id | pen_id | name  |
+------+---------+--------+-------+
| tree | 1       | NULL   | foo   |
| tree | 2       | NULL   | bar   |
| pen  | NULL    | 1      | fee   |
| pen  | NULL    | 2      | beer  |
+------+---------+--------+-------+