Last active
April 15, 2021 01:41
-
-
Save AhmedHelalAhmed/597e72013eae212f533fd40940de1b0b to your computer and use it in GitHub Desktop.
mysql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/japanese-cities-attributes/submissions | |
select * from city where countrycode="jpn"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/japanese-cities-name/problem | |
select name from city where countrycode = "jpn"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/revising-the-select-query/problem | |
select * from CITY where countrycode = "usa" and population >100000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/revising-the-select-query-2/problem | |
select name from city where population > 120000 and countrycode = "usa"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/select-all-sql/problem | |
select * from city |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/select-by-id/problem | |
select * from city where id =1661 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/weather-observation-station-1/problem | |
select city,state from station; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/weather-observation-station-10/submissions/code/203114632 | |
select distinct (city) from station where | |
city not like "%e" and | |
city not like "%a" and | |
city not like "%i" and | |
city not like "%o" and | |
city not like "%u" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/weather-observation-station-11/problem | |
select distinct(city) | |
from station | |
where | |
( | |
city not like "e%" and | |
city not like "a%" and | |
city not like "i%" and | |
city not like "o%" and | |
city not like "u%" | |
) | |
or | |
( | |
city not like "%e" and | |
city not like "%a" and | |
city not like "%i" and | |
city not like "%o" and | |
city not like "%u" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/weather-observation-station-12/problem | |
select distinct(city) | |
from station | |
where | |
( | |
city not like "e%" and | |
city not like "a%" and | |
city not like "i%" and | |
city not like "o%" and | |
city not like "u%" | |
) | |
and | |
( | |
city not like "%e" and | |
city not like "%a" and | |
city not like "%i" and | |
city not like "%o" and | |
city not like "%u" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/weather-observation-station-3/problem | |
select distinct(city) from station where id MOD 2 =0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/weather-observation-station-4/problem | |
select count(city) - count(distinct(city)) from station; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/weather-observation-station-5/problem | |
select city, LENGTH(city) from station where LENGTH(city) = (SELECT min(count_letters) from (select city, length(city) count_letters from STATION) as data1) order by city limit 1; | |
select city, LENGTH(city) from station where LENGTH(city) = (SELECT max(count_letters) from (select city, length(city) count_letters from STATION ) as data2) order by city limit 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/weather-observation-station-6/problem | |
select distinct(city) from station where city like "a%" or city like "e%" or city like "i%" or city like "o%" or city like "u%" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/weather-observation-station-7/problem | |
select distinct(city) from station where city like "%a" or city like "%e" or city like "%i" or city like "%o" or city like "%u" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/weather-observation-station-8/problem | |
select distinct(city) from station | |
where | |
( | |
city like "e%" or | |
city like "a%" or | |
city like "i%" or | |
city like "o%" or | |
city like "u%" | |
) | |
and | |
( | |
city like "%e" or | |
city like "%a" or | |
city like "%i" or | |
city like "%o" or | |
city like "%u" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/challenges/weather-observation-station-9/problem | |
select distinct (city) from station where | |
city not like "e%" and | |
city not like "a%" and | |
city not like "i%" and | |
city not like "o%" and | |
city not like "u%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment