Basic Select
Revising the Select Query I
select * from CITY
where POPULATION > 100000
and COUNTRYCODE = 'USA';Revising the Select Query II
select NAME from CITY
where POPULATION > 120000
and COUNTRYCODE = 'USA';Select All
select * from CITY;Select By ID
select * from CITY
where ID = 1661;Japanese Cities' Attributes
select * from CITY 
where COUNTRYCODE = 'JPN';Japanese Cities' Names
select NAME from CITY
where COUNTRYCODE = 'JPN';Weather Observation Station 1
select CITY, STATE from STATION;Weather Observation Station 3
select distinct CITY from STATION
where mod(ID, 2) = 0;Weather Observation Station 4
select count(CITY) - count(distinct CITY) from STATION;Weather Observation Station 5
select CITY, length(CITY) from(
    select CITY from STATION 
    order by length(CITY), CITY asc) 
where rownum = 1; 
select CITY, length(CITY) from(
    select CITY from STATION 
    order by length(CITY) desc) 
where rownum = 1;Weather Observation Station 6
select distinct CITY from STATION
where lower(substr(CITY,1,1)) in ('a','e','i','o','u');Weather Observation Station 7
select distinct CITY from STATION
where lower(substr(CITY,-1,1)) in ('a','e','i','o','u');Weather Observation Station 8
select distinct CITY from STATION 
where lower(substr(CITY,1,1)) in ('a','e','i','o','u')
and lower(substr(CITY,-1,1)) in ('a','e','i','o','u');Weather Observation Station 9
select distinct CITY from STATION 
where lower(substr(CITY,1,1)) not in ('a','e','i','o','u');Weather Observation Station 10
select distinct CITY from STATION
where lower(substr(CITY,-1,1)) not in ('a','e','i','o','u');Weather Observation Station 11
select distinct CITY from STATION
where lower(substr(CITY,1,1)) not in ('a','e','i','o','u')
or lower(substr(CITY,-1,1)) not in ('a','e','i','o','u');Weather Observation Station 12
select distinct CITY from STATION
where lower(substr(CITY,1,1)) not in ('a','e','i','o','u')
and lower(substr(CITY,-1,1)) not in ('a','e','i','o','u');Higher Than 75 Marks
select Name from STUDENTS
where Marks > 75
order by substr(Name,-3,3), ID asc;Employee Names
select name from Employee
order by name asc;Employee Salaries
select name from Employee
where salary > 2000
and months < 10
order by employee_id asc;Last updated
Was this helpful?

