Domain | Category |
Problem | Solution in Oracle | Solution in Mysql |
Select | Easy | Select All | select * from city; | select * from city; |
Select by ID | select * from city where id=1661; | select * from city where id=1661; | ||
Japanese Cities’ Detail | select * from city where countrycode=’JPN’; | select * from city where countrycode=’JPN’; | ||
Japanese Cities’ Name | select Name from city where countrycode=’JPN’; | select Name from city where countrycode=’JPN’; | ||
Weather Observation Station 1 | select city, state from station order by city, state asc; | select city, state from station order by city, state asc; | ||
Weather Observation Station 3 | select distinct city from station where mod(id,2)=0 order by city asc; | select distinct city from station where id % 2 = 0 order by city asc; | ||
Weather Observation Station 4 | select count(*) – count(distinct city) from station; | select count(*) – count(distinct city) from station; | ||
Weather Observation Station 6 | select distinct city from station where regexp_like (city,’^[aeiouAEIOU]’) order by city asc; | select distinct city from station where city regexp ‘^[aeiouAEIOU]’ order by city asc; | ||
Weather Observation Station 7 | select distinct city from station where regexp_like (city,'[aeiouAEIOU]$’) order by city asc; | select distinct city from station where city regexp ‘[aeiouAEIOU]$’ order by city asc; | ||
Weather Observation Station 8 | select distinct city from station where regexp_like (city,’^[aeiouAEIOU].*[aeiouAEIOU]$’) order by city asc; | select distinct city from station where city regexp ‘^[aeiouAEIOU].*[aeiouAEIOU]$’ order by city asc; | ||
Weather Observation Station 9 | select distinct city from station where not regexp_like (city, ‘^[aeiouAEIOU]’) order by city asc; | select distinct city from station where city not regexp ‘^[aeiouAEIOU]’ order by city asc; | ||
Weather Observation Station 10 | select distinct city from station where not regexp_like(city, ‘[aeiouAEIOU]$’) order by city asc; | select distinct city from station where city not regexp ‘[aeiouAEIOU]$’ order by city asc; | ||
Weather Observation Station 11 | select distinct city from station where not regexp_like(city, ‘^[aeiouAEIOU].*[aeiouAEIOU]$’) order by city asc; | select distinct city from station where city not regexp ‘^[aeiouAEIOU].*[aeiouAEIOU]$’ order by city asc; | ||
Weather Observation Station 12 | select distinct city from station where not regexp_like(city, ‘^[aeiouAEIOU]’) and not regexp_like(city, ‘[aeiouAEIOU]$’) order by city asc; | select distinct city from station where city not regexp ‘^[aeiouAEIOU]’ and city not regexp ‘[aeiouAEIOU]$’ order by city asc; | ||
Medium | Weather Observation Station 5 | select * from (select city,length(city) FROM STATION order by length(city) asc,city asc) where ROWNUM=1;
select * from (select city,length(city) FROM STATION order by length(city) desc,city asc) where ROWNUM=1; |
select city,length(city) FROM STATION order by length(city) asc,city asc LIMIT 1;
select city,length(city) FROM STATION order by length(city) desc,city asc LIMIT 1; |