hey!
i need to create a customised table "Employee" in which i have to insert employeeid,employeename and salary...on inserting the salary,the table should automatically calculate Hra(10% of basic salary),DA(9% of basic salary) and hence calculate net salary...so...plz guide me...how to do this?

Recommended Answers

All 6 Replies

so, what you have done so far ?

how to do this

Don't. Do not store calculated values in your database. If Hra and DA are percentages of another database field, create a view which calculates them instead of storing them.

but how can i calculate values in a view???
can u plz show me thru some example...plz...i need to complete this by today otherwise my teacher will screw me...plz guide me

You need to crate a view and add the calculated values as columns.

HRA = salary * 10/100
DA = salary * 9 /100
net = HRA + DA

i still didnt get u...need an example...plz read my above query carefully

commented: you need to read carefully, don't expext to be spoon feed here. -2
create view xyz as 
select *, salary * 10 / 100 as HRA, salary * 9/100 as DA, salary * 19/100 as net from employees
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.