My question is the following:

I have a `PostgreSQL` database with several tables, what I want to do is the following, I will give you three tables as an example.

The first table is called `teachers` that has attributes `name`, `id` and `type` where type can only be `"IN"` or `"EX"`

I have a second table called `internal teachers` with the `ID` of all teachers with the attribute `type` = `"IN"` and another table called `external teachers` with the `ID` attribute of all teachers where `type` = `"EX"`

The thing is that at the moment I have to manually add the `ID` to the `internal teachers` and `external teachers` table, I would like to know if there is any way to that when entering the teacher's `ID` and its type to the `teachers` table, the database automatically places its `ID` in one table or another depending on its type.

Without more to say a greeting and thanks!