Home Work-2 Function in MySQL 13 Apr 2020

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Function in MySQL (Home work) 13 Apr 2020

1. Consider the table named "Charity" and write SQL queries for the
tasks that follow:

I. Display all first names in lowercase


II. Display all last names of people of Mumbai city in uppercase
III. Display Person Id along and First 3 characters of his/her first name.
IV. Display length of address column and Person Id
V. Display last 2 characters of City and Last name
VI. Display Last Names and First names of people who have "at" in the
second or third position in their first names.
VII. Display the position of 'a' in Last name in every row.
VIII Display Last Name and First name of people who have "a" as the last
character in their First names.
IX. Display the first name after removing the leading and trailing blanks.
X. Display Person Id, last names and contribution rounded to the nearest
rupee of all the persons.
XI. Display Last name, contribution and a third column which has
contribution divided by 10. Round it to two decimal points.
2. Consider the table "Grocer" and write SQL queries for the tasks that
follow:

I. Display Item name, unit price along with Total amount (i.e. price*qty)
for all the Items.
II. Display Item name along with Month (in number) when it was
purchased for all the items.
III. Display Item name along with year in which it was purchased for all
the items.
IV. Display Item Id, Date of Purchase and day name of week (e.g.
Monday) on which it was purchased for all the items.
V. Display names of all the items that were purchased on Mondays or
Tuesdays.
VI. Display the day name of the week on which Rice was purchased.
VII. Display the Item name and unit price rounded to integer value (no
decimal digits) of all the items.
VIII. Display current date and time.

You might also like