Write the SQL functions which will perform the following operations:
a) To display the monthname of the current date.
b) To display the substring “earn” from the whole string ‘LearningIsFun’.
c) To round the number 76.384 up to 2 place after decimal point.
d) To find the position of first occurrence of ‘R’ in string 'INFORMATION
FORM'
e) To find out the result of 93 .
OR
Consider a table Orders with the following data:
TABLE:ORDERS
Write SQL queries using SQL functions to perform the following operations:
i) To count the number of orders booked by Salespersons with names starting with
‘R’. ii) Display the position of occurrence of the string “an” in SalesPerson names. iii) Display the four characters from SalesPerson name starting from second character. iv) To find the average of order amount.
v) Display the month name for the Order date.
Answers
Answered by
0
Answer:
Sorry don't know the answer
Answered by
0
Answer:
a) To display the month name of the current date.
SELECT MONTHNAME(CURDATE());
b) To display the substring “earn” from the whole string ‘LearningIsFun’.15
SELECT SUBSTR ('LearningIsFun', 1, 5) FROM table name;
Outputearn
c) To round the number 76.384 up to 2 place after decimal point.
SELECT ROUND(76.384, 2) AS MatchPosition;
d) To find the position of first occurrence of ‘R’ in string 'INFORMATIONFORM'
SELECT CHARINDEX('R', 'INFORMATIONFORM') AS Matchposition;
e) To find out the result of 93
select from result where number=93
Similar questions