[Answer] Ms.Saumya is working on a MySQL table named ‘Hotel’ having following structure: She need to perform following task on the table

The Question : Ms.Saumya is working on a MySQL table named ‘Hotel’ having following structure: She need to perform following task on the table: i. To fetch last 2 characters from the user_id column. ii. To display the values of name column in lower case. iii. To display 3 characters from 3rd place from the column city. Suggest suitable SQL function for the same. Also write the query to achieve the desired task.

Solution for the question :
i. right() select right(user_id,2) from hotel; ii. lower() select lower(name) from hotel; iii. mid()/substr()/substring() Select mid(city,3,3) from hotel;

The correct answer to the question is researched by our moderators and shared with you. You can give feedback by commenting for the answers you think are wrong.

Leave a Reply

Your email address will not be published. Required fields are marked *