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