MP3JOSS

SQL Case Statement: Simple vs Searched vs Nested #datascience #sql #programming #caseclausesql

SQL Case Statement: Simple vs Searched vs Nested #datascience #sql #programming #caseclausesql

Choose Download Format

Download MP3 Download MP4

Details

TitleSQL Case Statement: Simple vs Searched vs Nested #datascience #sql #programming #caseclausesql
AuthorThe Code Samples
Duration9:34
File FormatMP3 / MP4
Original URL https://youtube.com/watch?v=PS1Jn-djgrc

Description

#SQL In this SQL tutorial, we will go over the different types of Case statements: Simple, Searched, and Nested Case statements. We will also cover some examples to demonstrate the use of each.

Queries Used in The Tutorial:
-- Create the Score table
CREATE TABLE Score (
Student_ID INT,
Student_Name VARCHAR(50),
Student_Status VARCHAR(10),
Score int
);

-- Insert sample data into the Score table
INSERT INTO Score (Student_ID, Student_Name, Student_Status ,Score)
VALUES
(1, 'Rebecca Laszlo','Active', 92),
(2, 'Jane Smith','Active', 78),
(3, 'Michael Raheem','Inactive', 85),
(4, 'Alice Brown','Active',55),
(5, 'Eva Wilson','Active',96),
(6, 'Michelle Brown','Active',80),
(7, 'Don Lee','Inactive',80)
(8, 'John Wolf',null,85)

--Simple Case Statement
select
Student_ID,
Student_Name,
Student_Status,
score,
case
student_status
when 'active' then 'A'
when 'inactive' then 'I'
else 'unknown'
end as Grade
from score


#datascience #coding #programming #mssql #databasemanagement

👉SQL Tutorials Playlist:
https://youtube.com/playlist?list=PL2DNwXX2LoZs3caX9HAW42Eor0Xh1vSCB

👉SQL Shorts Playlist:
https://youtube.com/playlist?list=PL2DNwXX2LoZtW2fgoh-5wF-_zfegjJFtC

👉Python Shorts Playlist:
https://youtube.com/playlist?list=PL2DNwXX2LoZtH_PY68Pus9Urqw-IV3h30

👉Python Tutorials Playlist:
https://youtube.com/playlist?list=PL2DNwXX2LoZu81BduwHZWhbqbRxtpqMYD

👉Excel Shorts Playlist:
https://www.youtube.com/playlist?list=PL2DNwXX2LoZtAkmZlshtmp-asnc1WQ9HL

🎧 Just For You

🎵 Poker Face - Lady Gaga 🎵 Not Like Us - Kendrick Lamar 🎵 That's So True - Gracie Abrams 🎵 Messy - Lola Young 🎵 Headphones On - Addison Rae 🎵 The Giver - Chappell Roan 🎵 Love All Night - Amo & Aymen 🎵 4X4 - Travis Scott 🎵 Blessings - Calvin Harris Feat… 🎵 Bad Guy - Billie Eilish 🎵 Be Mine - Kamrad 🎵 Just The Way You Are - Bruno Mars