calebesz / SQL-Practice

Portfolio usando a plataforma www.sql-practice.com/ com a base de dados hospital, variando desafios fáceis, médios e dificeis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQL-Practice

Projeto SQL usando a plataforma www.sql-practice.com/ com a base de dados hospital, variando desafios fáceis, médios e dificeis

Escolhi 5 perguntas de cada nível para demonstrar meu conhecimento de forma uniforme.

Schema do Banco de Dados

image

Questions - Easy

1 - Write a query to find list of patients first_name, last_name, and allergies where allergies are not null and are from the city of 'Hamilton'

image

2 - Write a query to find the first_name, last name and birth date of patients who has height greater than 160 and weight greater than 70

image

3 - Show first name and last name of patients that weight within the range of 100 to 120 (inclusive)

image

4 - Based on the cities that our patients live in, show unique cities that are in province_id 'NS'?

image

5 - Show first name and last name of patients who does not have allergies. (null)

image

Questions - Medium

1 - Show patient_id, first_name, last_name from patients whose does not have any records in the admissions table. (Their patient_id does not exist in any admissions.patient_id rows.)

image

2 - Show patient_id, first_name, last_name from patients whos diagnosis is 'Dementia'.

image

3 - Show all patient's first_name, last_name, and birth_date who were born in the 1970s decade. Sort the list starting from the earliest birth_date.

image

4 - Show first and last name, allergies from patients which have allergies to either 'Penicillin' or 'Morphine'. Show results ordered ascending by allergies then by first_name then by last_name.

image

5 - For every admission, display the patient's full name, their admission diagnosis, and their doctor's full name who diagnosed their problem.

image

Questions - Hard

1 - Show all of the patients grouped into weight groups. Show the total amount of patients in each weight group. Order the list by the weight group decending.

image

2 - All patients who have gone through admissions, can see their medical documents on our site. Those patients are given a temporary password after their first admission. Show the patient_id and temp_password.

The password must be the following, in order:

  1. patient_id
  2. the numerical length of patient's last_name
  3. year of patient's birth_date

image

3 - Sort the province names in ascending order in such a way that the province 'Ontario' is always on top.

image

4 - Show the percent of patients that have 'M' as their gender. Round the answer to the nearest hundreth number and in percent form.

image

5 - Show all of the patients grouped into weight groups. Show the total amount of patients in each weight group. Order the list by the weight group decending.

For example, if they weight 100 to 109 they are placed in the 100 weight group, 110-119 = 110 weight group, etc.

image

About

Portfolio usando a plataforma www.sql-practice.com/ com a base de dados hospital, variando desafios fáceis, médios e dificeis