SQL Tutorial - 30: Using GROUP BY Clause with SQL JOINS

preview_player
Показать описание
In this tutorial we'll see how we can use the Group By clause with Joins in SQL.
Рекомендации по теме
Комментарии
Автор

Hey bro dont lsiten to them, your voice isn;t annoying. your explanation is very clear and now I have a clearer concept of joins.

irshaadmohammed
Автор

pretty cool how you combined them to show u the table like that

cozimbatman
Автор

Can you please share a tutorial how to use joins on tables where tables are present in different data base using joins will be very help full

jaganmohan
Автор

Where can I get the source database for this exercise? Cos I would like to do it myself, thx.

bartdd
Автор

How do you find the number of groups (subjects) you have? For example, in this case, the answer will be three.

leonghchan
Автор

what will happen if we put the exact command but not the last line i.e the group by command...???

Sandy-noup
Автор

This is why every single tutorial tells you to name variables with proper names. Most likely self-taught at the time.

SquareRoot_
Автор

in case you want to avoid creating tables please refert these are the table



USE test ;
CREATE TABLE tutorial
(id int primary key, tittle nvarchar(30), Subject nvarchar(30), duration decimal(4, 2), uploaddate date);

CREATE TABLE tutorial_info
(tutorial_id int primary key, Views int, likes int, dislikes int, shares int);

INSERT INTO tutorial (id, tittle, Subject, duration, uploaddate) VALUES
(1, 'Select query', 'SQL', 4.56, '2013-08-08'),
(2, 'inser query', 'SQL', 5.32, '2013-08-08'),
(3, 'arithmetic operation', 'SQL', 6.37, '2013-08-08'),
(4, 'Logical operation', 'SQL', 5.11, '2013-08-08'),
(5, 'Order by clause', 'SQL', 4.19, '2013-08-08'),
(6, 'Function', 'C', 5.23, '2013-04-04'),
(7, 'Structure', 'C', 4.26, '2013-04-04'),
(8, 'While loop', 'C', 8.13, '2013-04-04'),
(9, 'For loop', 'C', 5.30, '2013-04-04'),
(10, 'Break statement', 'C', 7.62, '2013-04-04'),
(11, 'Continuous statement', 'C', 6.56, '2013-04-04'),
(12, 'Unions', 'C', 3.21, '2013-04-04'),
(13, 'Typedef', 'C', 7.86, '2013-04-04'),
(14, 'Is command', 'Shell script', 3.19, '2013-01-01'),
(15, 'Pwd command', 'Shell script', 2.79, '2013-01-01'),
(16, 'Grep command', 'Shell script', 4.77, '2013-01-01'),
(17, 'Who command', 'Shell script', 6.13, '2013-01-01');


INSERT INTO tutorial_info(tutorial_id, Views, likes, dislikes, shares) VALUES
(1, 15000, 54, 13, 6),
(2, 17500, 43, 21, 2),
(3, 12500, 31, 29, 12),
(4, 16000, 17, 0, 11),
(5, 85000, 117, 10, 19),
(6, 112000, 191, 46, 34),
(7, 85000, 106, 25, 8),
(8, 91000, 166, 24, 17),
(9, 191000, 846, 48, 32),
(10, 235000, 1170, 93, 52),
(11, 454000, 2070, 117, 63),
(12, 515000, 2900, 131, 96),
(13, 644000, 3280, 137, 12),
(14, 644000, 3280, 137, 12),
(15, 329000, 1115, 143, 7),
(16, 147589, 650, 22, 3),

(23, 45000, 650, 131, 11),
(24, 57850, 784, 46, 17),
(25, 313000, 1185, 163, 19);

marijuanastoner
Автор

what do you use to execute your SQL statement ? it looks better than SQL command line

PatienceMTJANE
Автор

We can not perform join on two tables without giving Alias name ?

niteshmishra
Автор

Code returns same results when using ( GROUP BY subject) instead of (GROUP BY t.subject)

ae
Автор

you speak so much of unwanted things with a very irritating voice. The only reason I prefer your series is the good subject content. But please stop talking such a lot in vein.

shubhshubham