Use
select distinct residence from person;
Use
select count(distinct residence) from person;
Use
select * from person where name like '%oh%';
Use
select * from flight where date < "2014-10-20";
Use
select * from person where name in ('Philipp', 'Carlos')
and
select * from person where name = 'Philipp' or name = 'Carlos'
Use
select * from person where name = 'Philipp' and age > 50;
For all contracts use
select count(*) from phone_contract;
and for the actives ones
select count(*) from phone_contract where status = 'active';
We get all combinations of names and phone numbers.
Use
select person.name, person.age from person, phone_contract where person.name=phone_contract.name and status = 'active';
Use
select p.name, phone_number from person p, phone_contract c where p.name = c.name and age > 30;
It returns name, age, residence and phone number for all people who have the same age as persons living in Paris.