assignment2
assignment2
-- 1. Create a user-defined functions to stuff the Chicken into �Quick Bites�. Eg:
�Quick Chicken Bites�.
Create FUNCTION ChickenStuff (@inputString VARCHAR(MAX))
Returns VARCHAR(MAX)
As
Begin Declare @result VARCHAR(MAX)
Set @result = STUFF(@inputString,7, 7, 'Chicken bites')
Return @result
End
-- 2. Use the function to display the restaurant name and cuisine type which has
the maximum number of rating.
Create function fn_rating ()
Returns Table Return Select RestaurantName,CuisinesType,Rating from
Jomato
where
Rating = (Select MAX(Rating) from Jomato)
/* 4. Find the Ceil, floor and absolute values of the rating column and display
the current date
and separately display the year, month_name and day.*/
select Rating,
Ceiling(Rating) as Ceil_value,
Floor(rating) as floor_value,
ABS(rating) as Absolute_value
from jomato
Select
GETDATE() as CurrentDate,
Datename(year,getdate()) as Year,
Datename(month,getdate ()) as Month_Name,
Datename(day,getdate()) as day
-- 5. Display the restaurant type and total average cost using rollup