use yelp_db;
/* SQL Query 1 */
select ID, NAME,STATE ,count(state) from business group by STATE ORDER BY count(state) DESC;
51 Rows
/*SQL Query 2 */
select STATE,count(state),AVG(review_count),AVG(stars) from business group by 1 order by 2 DESC ;
51 Rows
/*SQL Query 3 */
select STATE,count(state),AVG(review_count),AVG(stars) from business group by 1 having count(state)>='1000' order by 2 DESC ;
11 Rows
/*SQL Query 4 */
select state,avg(stars), avg(review_count) from business group by state order by count(state) ;
51 Rows
/*SQL Query 5 */
select state,avg(stars), avg(review_count) from business GROUP BY state having avg(stars) >= 3 order by count(state);
50 Rows ;
order by count(state) ;
select * FROM business where state ='ABE';
select * from business; Group by STARS;
/* SQL Query 1 */
select ID, NAME,STATE ,count(state) from business group by STATE ORDER BY count(state) DESC;
51 Rows
/*SQL Query 2 */
select STATE,count(state),AVG(review_count),AVG(stars) from business group by 1 order by 2 DESC ;
51 Rows
/*SQL Query 3 */
select STATE,count(state),AVG(review_count),AVG(stars) from business group by 1 having count(state)>='1000' order by 2 DESC ;
11 Rows
/*SQL Query 4 */
select state,avg(stars), avg(review_count) from business group by state order by count(state) ;
51 Rows
/*SQL Query 5 */
select state,avg(stars), avg(review_count) from business GROUP BY state having avg(stars) >= 3 order by count(state);
50 Rows ;
order by count(state) ;
select * FROM business where state ='ABE';
select * from business; Group by STARS;
Comments
Post a Comment