DMS - Aggregate Functions in SQL

  Рет қаралды 8,347

TutorialsPoint

TutorialsPoint

Күн бұрын

Пікірлер: 5
@TutorialsPoint_
@TutorialsPoint_ Жыл бұрын
To Get Certification, Click Here: bitly.ws/PXXy Use coupon "KZbin12" to get ‘’FLAT 12%’’ OFF at Checkout.
@simpleepic
@simpleepic 4 жыл бұрын
I think here you missed GROUP BY sir! So the complete one will be like this : SELECT d.cname, AVG(a.bal) FROM Customer AS c, Account AS a, Depositor AS d WHERE c.cname = d.cname AND a.ano = d.ano AND c.ccity LIKE "Pune" GROUP BY d.cname HAVING COUNT(DISTINCT d.ano) >= 3; Instead of using Cartesian product we can also use JOINS : SELECT d.cname, AVG(a.bal) FROM Depositor AS d JOIN Customer AS c ON c.cname = d.cname JOIN Account AS a ON a.ano = d.ano WHERE c.ccity LIKE "Pune" GROUP BY d.cname HAVING COUNT(DISTINCT d.ano) >= 3; Hope this will be helpful for someone :3
@adi-hk4hb
@adi-hk4hb 6 жыл бұрын
In the last question i think there must be (GROUP BY d.cname)
@TERKO62
@TERKO62 5 жыл бұрын
do you need for the last question, also the account table? Cant you just simply take customer and depositor to check if the customer has more acount_number then 3? do not need the account then if you want to use just the one information that they have in common.
@josephhakim4212
@josephhakim4212 4 жыл бұрын
There is a mistake in the last question , you must have GROUP BY d.cname , this way you will return the average for each customer name, The current query that you have in the video will not work in case you have over 1 customer name since the avg(bal) will only return 1 tuple.
DBMS - Null Values in SQL
2:17
TutorialsPoint
Рет қаралды 14 М.
路飞做的坏事被拆穿了 #路飞#海贼王
00:41
路飞与唐舞桐
Рет қаралды 25 МЛН
Players push long pins through a cardboard box attempting to pop the balloon!
00:31
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 99 МЛН
DBMS - Set comparison in SQL
7:24
TutorialsPoint
Рет қаралды 10 М.
DBMS - Rename Operation in Relational Algebra
11:38
TutorialsPoint
Рет қаралды 38 М.
SQL Joins: Difference Between Inner/Left/Right/Outer Joins
10:52
Clauses in SQL Server | MSSQL Training Tutorial
25:39
Naresh i Technologies
Рет қаралды 114 М.
Learn 12 Basic SQL Concepts in 15 Minutes (project files included!)
16:48