SQL Daily Practice — Day 11

Hello, Connections, Data Professionals and SQL Enthusiasts.

Here comes #day11 of our SQL daily practice on SQL-practice-dot-com.

Follow Olawale Ahmed Alamu and #sqldailyupdates for #day1 to #day10 and daily updates.

Today, we are looking at SQL COUNT(*) function.

SQL COUNT(*) function is used to get the total number of records on a table in a database.

QUESTION: Show the total number of admissions.

PROBLEM ANALYSIS: We are expected to output total number of admissions on the admissions table.

The admissions table has the following columns:
patient_id (INT),
admission_date (DATE),
discharge_date (DATE),
diagnosis (TEXT),
attending_physician_id (INT),
pk_admissions

SOLUTION: We write a SELECT COUNT(*) statement to get the total number of admissions FROM the admissions table.

SQL SCRIPT:

-- -- -- -- -- -- — 
SELECT COUNT(*) AS total_admissions
FROM admissions;
-- -- -- -- -- -- —

Screenshot image of the SQL Script and output attached below:

#sql #health #databases #dataanalytics

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Olawale Ahmed Alamu
Olawale Ahmed Alamu

Written by Olawale Ahmed Alamu

CS Grad | Power BI | Microsoft Excel | Learning and Teaching SQL Daily

No responses yet

Write a response