SQL Query to find Manager with at least 2 employees reporting to him

  Рет қаралды 10,123

Coding Glitz

Coding Glitz

Күн бұрын

Пікірлер: 25
@swati8201
@swati8201 7 ай бұрын
Awaz kitta pyara hai apka❤
@soubansukri2594
@soubansukri2594 Жыл бұрын
Was trying to solve similar query and was stucked,,this video helped me solve it easily ❤
@Ramu9119
@Ramu9119 Жыл бұрын
Nice video bhai keep it up
@CodingGlitz
@CodingGlitz Жыл бұрын
Thanks
@vineetjain7518
@vineetjain7518 2 жыл бұрын
sir pehle query se name mai blank aa rha hai .. kya changes krne rehfne create table employees (id int(12) auto_increment primary key, name varchar(25), department varchar(2), managerId int(3) ); select * from employees ; insert into employees values(1,'Arif','AA',101); insert into employees values(2,'Heena','AA',102); insert into employees values(3,'Farukj','AA',102); insert into employees values(4,'Abdul','AA',101); insert into employees values(5,'keshav','AA',103); insert into employees values(6,'ASure','AB',102); select * from employees; select name from employees where id in( select managerId from employees group by(managerId) having count(managerid) >=2 ) ;
@CodingGlitz
@CodingGlitz 2 жыл бұрын
Sorry For replying late, somehow I missed your comment. Data jo apne liya hai wo galat hai ... empid me 1,2,... liya hai aur managerid me 101,102 ... liya hai to wo kavi match nahn karega... empId agar 1,2,3... le rahe ho same manager id me v lena hai ..
@ganeshpawar231
@ganeshpawar231 Жыл бұрын
Sir... Es table mein Name column employee name hai ya manager name?
@CodingGlitz
@CodingGlitz Жыл бұрын
Employee name hai ... Same table se hi manager ka name milega separate table ka zaroorat nahn hai.
@RishiRap
@RishiRap Жыл бұрын
Please always include raw table data that could be downloaded and installed in Sql software for practice.
@CodingGlitz
@CodingGlitz Жыл бұрын
For DDL and DML statements you can refer below doc which I have given in description of many other videos. drive.google.com/file/d/1bXUxWsSu_59mT56tbyDLz_ofvdYCZNq7/view
@RishiRap
@RishiRap Жыл бұрын
@@CodingGlitz Awesome!
@biswabhusanswain7528
@biswabhusanswain7528 2 жыл бұрын
Self join is a non ansi format sir how we use on clause because in non ansi format we can use where caluse. Sir pls explain it.
@CodingGlitz
@CodingGlitz 2 жыл бұрын
Which database are you using?
@biswabhusanswain7528
@biswabhusanswain7528 2 жыл бұрын
@@CodingGlitz oracle 19c cloud database
@biswabhusanswain7528
@biswabhusanswain7528 2 жыл бұрын
On which database we use on clause in self join?
@CodingGlitz
@CodingGlitz 2 жыл бұрын
I think you can use ON when both the column names are different.
@biswabhusanswain7528
@biswabhusanswain7528 2 жыл бұрын
@@CodingGlitz it's ok if both columns are same we can use where clause.
@ghanshyam014
@ghanshyam014 Жыл бұрын
Nice 👍
@RishiRap
@RishiRap Жыл бұрын
why was count(managerid) removed from subquery? You never explained or showed error msg. that would pop up. It would have taken only one more minute to demonstrate and explain. These are the kinda things you need to add to your videos to be truly instructive and add value to your site.
@CodingGlitz
@CodingGlitz Жыл бұрын
I think anyone with a basic understanding of subquery will know why we need to remove count from inner query. For Subquery basics please refer: kzbin.info/www/bejne/e4LFmX6gd9KKbpo
@CodingGlitz
@CodingGlitz Жыл бұрын
Also I would suggest you to go through concepts rather than jumping to solve queries. Basics are the most important thing. If your concept is not clear then you might solve 2-3 queries but will get stuck later with more complex queries.
@RishiRap
@RishiRap Жыл бұрын
I stumbled back again on your video and re-watched it and it seemed like a cake and it makes me laugh about the question I had posted 11 das ago. After reading lots of content and watching several of your videos and that of Techtfq in past 11 days I have figured out answer to my own question Lol. . Your videos are always a delight to watch, Mr. :). Keep these coming, please.Thanks.
@CodingGlitz
@CodingGlitz Жыл бұрын
Thanks 🙂
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 2,1 МЛН
How to whistle ?? 😱😱
00:31
Tibo InShape
Рет қаралды 20 МЛН
Хасанның өзі эфирге шықты! “Қылмыстық топқа қатысым жоқ” дейді. Талғарда не болды? Халық сене ме?
09:25
Демократиялы Қазақстан / Демократический Казахстан
Рет қаралды 354 М.
Walmart SQL Interview Question | SQL Window Functions | Advanced
11:31