1.
SELECT first_name,last_name,gender from patients where gender="M";
2. SELECT first_name,last_name from patients where allergies is null;
3. SELECT first_name from patients where first_name like "C%";
4. SELECT first_name,last_name from patients where weight between 100 and 120;
5. select * from patients where patient_id in (1,45,534,879,1000);
6. select * from admissions where admission_date=discharge_date;
7. SELECT distinct city as unique_cities from patients where province_id ='NS';
8. SELECT first_name,last_name,birth_date from patients where height>160 and
weight>70;
9. SELECT first_name,last_name,allergies from patients where allergies is not null and
city ='Hamilton';
10. select first_name,last_name,'Patient' as role from patients union all select
first_name,last_name,'Doctor' as role from doctors;
11. SELECT patient_id,first_name from patients where first_name like 's____%s';
12. select first_name,last_name,birth_date from patients where birth_date between
'1970-01-01' AND '1979-12-31' ORDER BY birth_date ASC;
13. select max(weight) - min(weight) as weight_delta from patients where
last_name='Maroni';
14. select count(*) as total_patients from patients where year(birth_date)=2010;
15. select first_name,last_name,max(height) from patients;
16. select count(patient_id) from admissions;
17. select patient_id, count(patient_id) as total_admissions from admissions where
patient_id=579;
18. select concat(first_name,' ',last_name) as full_name from patients;
19. SELECT (select count(*) from patients where gender='M') as male_count,
(select count(*) from patients where gender='F') as female_count;
20. select concat(upper(last_name),',',lower(first_name)) as new_name_format from
patients order by first_name desc;
21. update patients set allergies ='NKA' where allergies is null;
22. select p.first_name,p.last_name,n.province_name from patients p join
province_names n on p.province_id=n.province_id;
23. SELECT p.patient_id,p.first_name,p.last_name from patients p join admissions a on
p.patient_id=a.patient_id where diagnosis='Dementia';
24. SELECT distinct year(birth_date) as birth_year from patients order by birth_year;
25. SELECT first_name from patients group by first_name having count(first_name)=1;
26. select province_id, sum(height) as sum_height from patients group by province_id
having sum_height >= 7000;
27. SELECT first_name from patients order by length(first_name),first_name asc;
28. SELECT first_name,last_name,allergies from patients where allergies='Penicillin' or
allergies='Morphine' order by allergies,first_name,last_name;
29. SELECT city, count(*) as num_patients from patients group by city order by
num_patients desc,city asc;
30. select allergies,count(*) as total_diagnosis from patients where allergies is not null
group by allergies order by total_diagnosis desc;
31. select distinct sal from emp;
32.