"Welcome to Day 1 of our 15 Days of SQL Masterclass! 🎉 In today’s video, we dive into the core SQL commands: SELECT, ORDER BY, DISTINCT, LIMIT, and COUNT. Learn how to retrieve, sort, and count data efficiently to build a strong foundation in SQL.
📚 What You'll Learn:
Using the SELECT statement to query data.
Sorting results with the ORDER BY clause.
Filtering unique records with the DISTINCT keyword.
Limiting the number of rows with the LIMIT clause.
Counting rows with the COUNT function.
Stay tuned for the rest of the series and don’t forget to hit the like button, subscribe, and click the notification bell to catch every new episode! 💻💡"
This structure will give your viewers a clear, organized introduction to essential SQL commands and set the stage for the rest of the series.
CREATE TABLE actor (
actor_id INT PRIMARY KEY,
first_name NVARCHAR(50),
last_name NVARCHAR(50),
last_update DATETIMEOFFSET
);
INSERT INTO actor (actor_id, first_name, last_name, last_update)
VALUES
(1, 'Penelope', 'Guiness', '2020-02-15 10:34:33+01:00'),
(2, 'Nick', 'Wahlberg', '2020-02-16 11:15:45+01:00'),
(3, 'Ed', 'Chase', '2020-02-17 14:25:20+01:00'),
(4, 'Jennifer', 'Davis', '2020-02-18 09:45:10+01:00'),
(5, 'Johnny', 'Lollobrigida', '2020-02-19 13:30:33+01:00'),
(6, 'Bette', 'Nicholson', '2020-02-20 15:05:12+01:00'),
(7, 'Grace', 'Mostel', '2020-02-21 16:45:22+01:00'),
(8, 'Matthew', 'Johansson', '2020-02-22 12:14:45+01:00'),
(9, 'Joe', 'Swank', '2020-02-23 08:20:33+01:00'),
(10, 'Christian', 'Gable', '2020-02-24 14:55:00+01:00'),
(11, 'Zero', 'Cage', '2020-02-25 13:40:55+01:00'),
(12, 'Karl', 'Berry', '2020-02-26 11:30:22+01:00'),
(13, 'Uma', 'Wood', '2020-02-27 17:45:18+01:00'),
(14, 'Vivien', 'Leigh', '2020-02-28 10:22:55+01:00'),
(15, 'Cuba', 'Birch', '2020-02-29 14:34:12+01:00'),
(16, 'Fred', 'Costner', '2020-03-01 12:50:45+01:00'),
(17, 'Meryl', 'Allen', '2020-03-02 15:33:21+01:00'),
(18, 'Gary', 'Streep', '2020-03-03 11:14:37+01:00'),
(19, 'Jodie', 'Garland', '2020-03-04 09:24:05+01:00'),
(20, 'John', 'Wayne', '2020-03-05 13:12:44+01:00'),
(21, 'Fay', 'Wood', '2020-03-06 15:45:55+01:00'),
(22, 'Greta', 'Nolte', '2020-03-07 17:35:20+01:00'),
(23, 'Spencer', 'Hepburn', '2020-03-08 16:23:18+01:00'),
(24, 'Cate', 'McQueen', '2020-03-09 11:43:22+01:00'),
(25, 'Audrey', 'Hope', '2020-03-10 09:35:55+01:00'),
(26, 'Judy', 'Garland', '2020-03-11 12:25:44+01:00'),
(27, 'Marlon', 'Brando', '2020-03-12 14:18:12+01:00'),
(28, 'James', 'Dean', '2020-03-13 16:45:55+01:00'),
(29, 'Robert', 'Redford', '2020-03-14 13:55:33+01:00'),
(30, 'Natalie', 'Portman', '2020-03-15 11:23:10+01:00');
select * from actor
--select
select first_name
from actor
select first_name,last_name
from actor
--order by
select first_name
from actor
order by first_name
select first_name,last_name
from actor
order by first_name ASC
select first_name,last_name
from actor
order by first_name DESC
select first_name,last_name
from actor
order by first_name desc, last_name
--Distinct
select DISTINCT first_name
from actor
select DISTINCT first_name
from actor
order by first_name
select DISTINCT first_name, last_name
from actor
order by first_name
--Count
select count(first_name)
from actor
select count(*)
from actor
select count(DISTINCT first_name)
from actor
--Limit (TOP)
select Top 5 first_name from actor
select Top 5 first_name from actor
order by first_name
select Top 10 percent first_name from actor
order by first_name
Day 2: Advanced SQL Queries – Filtering, Logical Operators, and Aggregates
• Day 2: Advanced SQL Queries – Filtering, L...
#SQLBasics
#SQLTutorial
#SQLMasterclass
#SQLSELECT
#SQLORDER BY
#SQLDISTINCT
#SQLLIMIT
#SQLCOUNT
#SQLforBeginners
#SQLSeries