How do I write a dynamic script whereby the column name;
GST is a variable and I want it to be dynamically calculated based on the formula whenever there is data insert into the gross_sales column
SET @GST = gross_sales * 0.07, @gross_sales = 'gross_sales';
INSERT INTO sales(invoice_no, GST, gross_sales)
VALUES ('INV-1', @GST, 11.00),
('INV-2', @GST, 1.20),
('INV-3', @GST, 1.20);
I want the values of the GST column to be calculated automatically whenever data is being inputted into the gross_sales column. I have tried declaring the variables but it didn't work out.