Skip to content

Instantly share code, notes, and snippets.

@edharkhimich
Created November 20, 2016 01:30
Show Gist options
  • Save edharkhimich/79b71a944c6abd5ce6d34fe57bb58fe4 to your computer and use it in GitHub Desktop.
Save edharkhimich/79b71a944c6abd5ce6d34fe57bb58fe4 to your computer and use it in GitHub Desktop.
select * from people
where age > 25
select * from people
where age > 25 and age < 45
select * from flats
where floor == 1
select * from flats
where rooms > 2
select * from cars
where width > 400
select * from cars
where year_created > 2008
____________________________________
select count (id) from people
select min (age) from people
select count (rooms) from flats
where rooms == 3
select avg (age) from people
select sum (width) from cars
select name from people
where name like 'A%'
select surname from people
where surname like '%T%'
___________________________________
select * from cars
where people_id in
(select id from flats where rooms == 3)
select * from cars
where people_id in
(select people_id
from cars
group by people_id
having count(*)> 1)
select *
from flats
join people
where people.year > 2000
select *
from flats
inner join people on cars.owner_id = people.people_num
left join cars on people.people_num = cars.owner_id
where cars.year_created > 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment