Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

MS 5269 INFORMATION TECHNOLOGY LAB

Name- G V S Sree Lavanya


Roll No.- MS21A072

Exercise - 2
1. How would you select the Business Ids and Name for the businesses in the Yelp data set
that has rating greater than 4? How many such business Ids are there?

A: There are 52336 rows returned with business_id having rating greater than 4.
2. How would you query the Business IDs of businesses from Ontario, indicated by "ON" in
the state field of the business table?
3. How would you query all the data from businesses located in the state of Ontario
(abbreviated "ON") or New York (abbreviated "NY")?

A: There are 30226 businesses located in the states of Ontario and New York.
4. How would you select all the reviews posted after September 10, 2017? How many
posts are there in the year 2017? Query to find the reviews posted on weekday or
weekend. Which day has maximum number of reviews posted?

Part:A

There are total 292194 rows returned with date after 10/09/2017.
Part:B

There are total 404385 posts in the year 2017.


There are total 274338 posts on weekdays and 130047 posts on weekends.

Sunday has the highest number of reviews posted with review number=65793.
5. How would you retrieve the Business Ids, review text and star rating, in that order, of the first
10 reviews entered in the Reviews table posted after '2017-07-01' and review text has the
positive word ‘good’?
Exercise 3
1. List all the possible combinations of city and state in business table? How many such
pairs are there?

There are total 1107 pairs of possible combinations of city and state in the business table.
2. How many total different businesses are there in the state Ontario abbreviated as
“ON”? Now sort these businesses with their review count in descending order and
output the top 10 businesses. How many of these are active? Use is_open field in
business table – the value is 1 for active businesses.

There are total 30208 different businesses in the state of Ontario.


All the top 10 are active businesses since the value is 1.
3. In the review table reviews are voted as useful, cool, and funny. Calculate a composite
score for each review as the sum of the three values and name it ‘review score’. Write a
query to output top 100 review Ids with the review score and review text.

You might also like