Table Inheritance is a concept from object-oriented PostgreSQL databases. We can apply parents and child relationship between tables.
Example : We will create Order and Online booking or Agent tables.
#create table order(order_id serial,flight_name varchar , status varchar );
#create table online_booking(price numeric) inherits (order);
#create table agent(commission int) inherits (order);
#insert into online_booking(light_name , status , price) values('Air India','Online',1000);
#insert into agent(light_name , status , commission) values('Air India','Online',300);
#select * from online_booking ; It will show all data base on online_booking
#select * from agent; It will show all data base on agent;
#select * from only order ; It will show empty table due to base table not have any data.
Other example: for Advisory
No comments:
Post a Comment