select distinct residence from person;
select count(distinct residence) from person;
select * from person where name like '%oh%';
select * from flight where date < "2014-10-20";
select * from person where name in ('Philipp', 'Carlos')
select * from person where name = 'Philipp' or name = 'Carlos'
select * from person where name = 'Philipp' and age > 50;
For all contracts use
select count(*) from phone_contract;
- and for the active ones
select count(*) from phone_contract where status = 'active';
We get all combinations of names and phone numbers.
select person.name, person.age from person, phone_contract where person.name=phone_contract.name and status = 'active';
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.