For example I have a table called product_list
, which holds a list of products.
If I insert 1 row of data into product_list
, part of the data (such as product_id
& product name
) should also be inserted in another table like product_price
which holds the price for all products (new products would have 0 or NULL values for their price).
My question here is the method in approaching this. What is the proper way to do this?
My current ideas:
1 - Using a trigger to insert into the other tables like product_price
,etc whenever I insert a product data into product_list
2 - Using a function (stored procedure) like product_add
to add a new product into each tables.
Which method is better? Or if there a better suggestion, then I'd like to know about it. Thanks in advance.