From the course: SQL for Healthcare Professionals
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Using a CASE statement for data classification - SQL Tutorial
From the course: SQL for Healthcare Professionals
Using a CASE statement for data classification
- [Instructor] One of the challenges that you might face as a healthcare analyst is how to classify your data correctly when meeting certain conditions. That's the perfect scenario to apply the CASE statement. If you're familiar with Excel, think about how you do use the If function. They have some similarities. The CASE statement enables the users to use logic to categorize and label data in a meaningful way. Uses the warrants CASE When to specify the condition, Then to specify the output, End to finish the CASE statement and an optional As to give an alias to the new column. For instance, if you want to categorize patients based on their length of stay in the hospital, you can write a query as follows. Select patient ID, days in the hospital, and then we're going to build our CASE statement. I'm going to say CASE, when the days in the hospital are less or equal to three, then those records are going to be considered…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Why use SQL in healthcare?1m 35s
-
(Locked)
How to gather data for analysis using SQL2m 30s
-
(Locked)
Using aggregate functions to manipulate the data4m 50s
-
(Locked)
Using a CASE statement for data classification3m 57s
-
(Locked)
Date manipulation in SQL9m 29s
-
(Locked)
What are relational databases?1m 43s
-
(Locked)
How to gather data from different tables using JOINS4m 52s
-
-
-
-
-
-
-