Problem : https://www.hackerrank.com/challenges/weather-observation-station-8/problem
Solution :
/*
Enter your query here.
*/
SELECT DISTINCT CITY FROM STATION WHERE LEFT(CITY,1) IN ('a','e','i','o','u') AND RIGHT(CITY,1) IN ('a','e','i','o','u');
Problem : https://www.hackerrank.com/challenges/weather-observation-station-8/problem
Solution :
/*
Enter your query here.
*/
SELECT DISTINCT CITY FROM STATION WHERE LEFT(CITY,1) IN ('a','e','i','o','u') AND RIGHT(CITY,1) IN ('a','e','i','o','u');
Problem : https://www.hackerrank.com/challenges/weather-observation-station-7/problem
Solution :
/*
Enter your query here.
*/
SELECT DISTINCT CITY FROM STATION WHERE RIGHT(CITY,1) IN ('a','e','i','u','o');
Problem : https://www.hackerrank.com/challenges/weather-observation-station-6/problem
Solution :
/*
Enter your query here.
*/
SELECT CITY FROM STATION WHERE LEFT(CITY,1) IN ('a','e','i','o','u');
Problem : https://www.hackerrank.com/challenges/weather-observation-station-5/problem
Solution :
/*
Enter your query here.
*/
(
SELECT CITY , LENGTH(CITY) FROM STATION ORDER BY LENGTH(CITY), CITY LIMIT 1
)
UNION
(
SELECT CITY , LENGTH(CITY) FROM STATION ORDER BY LENGTH(CITY) DESC, CITY LIMIT 1
);
Problem : https://www.hackerrank.com/challenges/weather-observation-station-4/problem
Solution :
/*
Enter your query here.
*/
SELECT COUNT(CITY) - COUNT(DISTINCT(CITY)) FROM STATION;
Problem : https://www.hackerrank.com/challenges/weather-observation-station-3/problem
Solution :
/*
Enter your query here.
*/
SELECT DISTINCT(CITY) FROM STATION WHERE ID%2=0;
Solution :
/*
Enter your query here.
*/
SELECT CITY , STATE FROM STATION;
Solution :
SELECT * FROM CITY WHERE COUNTRYCODE="JPN";
Solution :
SELECT * FROM CITY;
Solution :
SELECT NAME FROM CITY WHERE COUNTRYCODE = "JPN";
Solution :
SELECT * FROM CITY WHERE ID = 1661;
Problem : https://www.hackerrank.com/challenges/revising-the-select-query-2/problem
Solution :
SELECT NAME FROM CITY WHERE POPULATION > 120000 AND COUNTRYCODE = "USA";
SOLUTION :
SELECT * FROM CITY WHERE POPULATION > 100000 AND COUNTRYCODE = "USA";