Here, there are a great answer about this question but i don't found clear examples about what's next, for example, queries (select).
I'm going to describe an example and I want to know if i do correctly so:
We have a base class about payments:
Payments( code_payment (PK), description )
And then, we have 3 sub-class (3 differents types of payments on inheritance ):
Cash( code_payment (FK) )
CreditCard( creditcard_account , code_payment(FK) )
PromissoryNote( pay_date , code_payment(FK) )
For example: for insert statements, first, insert on Payments table and second, depending of type of payments ( I think in code you use if/else clause to separate the types of payments and do the correct "insert statement"), insert where belongs. And what happens with select statements?
Imagine that i want to know what type of payment had a specific document assuming that I have a table called Document that it is connected with Payments table ( so Document table have a foreign key to Payments (code_payment) ).
First i should do is to get the "description" of the payments by making a query on Document and Payments table (basically an inner join) and then, depending of the result (cash, credic card or promissory note) make a query on the table that belongs.
Is this what I suppose to do? am I on the correct way? Maybe it can works but it looks like a little bit... you know.. no elegant solution. I am a little confuse about that.
Thanks in advance.