Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

User-Defined Function: Tax Amount

Create a function tax_amount(amount) that returns 5% of the amount when the amount is at most 1000 and 10% otherwise, rounded to two decimals. Then show its result for 800 and 2000.

Table schema

No tables are required.

Sample data

SELECT tax_amount(800), tax_amount(2000);

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.