Basic Select
Last updated
Was this helpful?
Last updated
Was this helpful?
select * from CITY
where POPULATION > 100000
and COUNTRYCODE = 'USA';
select NAME from CITY
where POPULATION > 120000
and COUNTRYCODE = 'USA';
select * from CITY;
select * from CITY
where ID = 1661;
select * from CITY
where COUNTRYCODE = 'JPN';
select NAME from CITY
where COUNTRYCODE = 'JPN';
select CITY, STATE from STATION;
select distinct CITY from STATION
where mod(ID, 2) = 0;
select count(CITY) - count(distinct CITY) from STATION;
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;
select distinct CITY from STATION
where lower(substr(CITY,1,1)) in ('a','e','i','o','u');
select distinct CITY from STATION
where lower(substr(CITY,-1,1)) in ('a','e','i','o','u');
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');
select distinct CITY from STATION
where lower(substr(CITY,1,1)) not in ('a','e','i','o','u');
select distinct CITY from STATION
where lower(substr(CITY,-1,1)) not in ('a','e','i','o','u');
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');
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');
select Name from STUDENTS
where Marks > 75
order by substr(Name,-3,3), ID asc;
select name from Employee
order by name asc;
select name from Employee
where salary > 2000
and months < 10
order by employee_id asc;