use yelp_db;
/*SQL QUERY 1 */
sELECT count(DISTINCT(STATE)) FROM business;
SELECT count(DISTINCT(CITY)) FROM business;
51*963 all possible combinations
Existing combinations
select distinct state,city from business;
/* SQL QUERY2 */
SELECT distinct(name) ,review_count, is_open as is_active FROM business WHERE STATE ='ON' order by review_count desc limit 10;
10 ROWS
SELECT distinct(name) ,review_count , is_open as is_active FROM business WHERE STATE ='ON' order by review_count desc limit 10;
/*SQL Query 3 */
select id, text, (useful + funny + cool ) as Review_Score from review limit 100;
/*SQL Query 4 */
select id, text, (useful + funny + cool ) as Review_Score from review limit 10000;
/*SQL Query 5 */
select character_length(text) from review;
SELECT POSITION("X" IN "Harry Potter and the Order of the Phoenix") AS MatchPosition;
/*SQL QUERY 1 */
sELECT count(DISTINCT(STATE)) FROM business;
SELECT count(DISTINCT(CITY)) FROM business;
51*963 all possible combinations
Existing combinations
select distinct state,city from business;
/* SQL QUERY2 */
SELECT distinct(name) ,review_count, is_open as is_active FROM business WHERE STATE ='ON' order by review_count desc limit 10;
10 ROWS
SELECT distinct(name) ,review_count , is_open as is_active FROM business WHERE STATE ='ON' order by review_count desc limit 10;
/*SQL Query 3 */
select id, text, (useful + funny + cool ) as Review_Score from review limit 100;
/*SQL Query 4 */
select id, text, (useful + funny + cool ) as Review_Score from review limit 10000;
/*SQL Query 5 */
select character_length(text) from review;
SELECT POSITION("X" IN "Harry Potter and the Order of the Phoenix") AS MatchPosition;
Comments
Post a Comment