Assignment-4
Assignment-4
Use the inbuilt functions and find the minimum, maximum and average
-- amount from the orders table
select
min(amount) as min_amount,
max(amount) as max_amount,
avg(amount) as avg_amount
from orders;
-- 2. Create a user-defined function which will multiply the given number with 10
--3. Use the case statement to check if 100 is less than 200, greater than 200
or equal to 200 and print the corresponding value.
select
case
when 100 < 200 then '100 is less than 200'
when 100 > 200 then '100 is greater then 200'
else '100 is equal to 200'
end
4. Using a case statement, find the status of the amount. Set the status of the
amount as high amount, low amount or medium amount based upon the
condition.
select *,
case
when amount > 200 then "high amount
when amount between 150 and 200 then 'medium amount
else
"less amount'
end as amount_status
from oders
5. Create a user-defined function, to fetch the amount greater than then given
input