OMG, I was struggling with Nested subqueries, but now I certainly have a better insight about it. Thank you so much and the person who shared your video in a forum.
Mike... You are the M-A-A-AN!!! Thank you, so much! This was so clearly and simply esplained! On top of everything, I was working on understanding the consecutiveness of the steps machine is working in, as it evaluates the query, and I saw, (in my mind), that it worked from inside-out of the parentheses - in other words, from within the innermost parentheses' query, gradually, toward the outermost query - but, I had seen some conflicting, (to a novice, like me), explanations and examples before, and wasn't entirely clear on this. And YOU, Sir, did it so clearly, and eloquently! Thank You!
believe it or not our database design lecturer did not use practical example like this and just read of what syntaxes does from textbook. holy i just understood it in a minute!
Yes, a very good question. I would have used a table join for the first example in this tutorial, but as I'm relatively new to SQL, I assumed there was either a good reason not to, OR he was merely trying to demonstrate a principle.
May I asked why you would not use an IN with the client branch ID in the where clause, I don’t understand why parenthesis would used in this sense. Thank you
So, is it bad I didn't recognize the "re-brand" and my first thought was come on some guy stole "Mike's" video?? And, here I was going to subscribe. After a brief look at the videos, I realized my mistake and pounded that sub button. Because anyone with a hunger for computer knowledge this is a good place to start. The tutorials are simple and easy to follow for beginners and more advanced users.
Assuming you don't know Michael Scott's ID: -- Clients handled by Michael Scott's branch SELECT client_name FROM client WHERE branch_id IN (SELECT branch_id FROM branch WHERE mgr_id IN (SELECT emp_id FROM employee WHERE first_name = "Michael" AND last_name = "Scott")); -- Or you can do SELECT client_name FROM client WHERE branch_id IN (SELECT branch_id FROM branch WHERE mgr_id IN (SELECT emp_id FROM employee WHERE CONCAT(first_name, " ", last_name) = "Michael Scott"));
Hi, thanks for the video! Sorry I don't get it why in the first example you were using 'IN', while in the 2nd example you were using '='? Can you explain a little detail, please? Thanks.
Explanation are helpful but I do have one question.. isn't the first question to find out employees for a single client.. not sure the query address the question
I guess he means all employees who have sold +3k to one client (not a specific client). So if we have an employee who sold 1500 to a client and 1500 to another client should not be counted
In the very first subquery example, how would you display the client id as well along with employee's first and last name? I am happy if it repeats the name.
If in client there was not mng_id, is that a good query for the last exercise? SELECT client_id, client_name FROM client WHERE client_id IN ( SELECT client_id FROM works_with WHERE emp_id IN( SELECT emp_id FROM employee WHERE super_id IN ( SELECT mgr_id FROM branch WHERE mgr_id IN ( SELECT emp_id FROM employee WHERE employee.first_name = 'Michael' AND employee.last_name = 'Scott' ) ) OR (first_name = 'Michael' AND last_name = 'Scott') ) )
Very clearly explained. I'm just getting to grips with SQL, so forgive my ignorance! Would you use a nesting approach if you wanted to retrieve relational data for over 1000 items using Oracle where you can't input more than 1K items in a single search? Or is there a more efficient way of querying large numbers of inputs using Developer? Hope that makes sense :-)
i'm making an ecommerce website already made a db for it, but we are expanding so the nested model sounds like the best solution due to the filters and all that, but after watching this and making those huge queries (not difficult tho, just thinking about the whole mantainance and all the what would happen ifs), i feel like hierarchy model could be better, (can't work with mongodb since our hosting doesn't support it), what do you recommend me?
I liked the vid. You explain very well! However, isn't it a video for subqueries? I'm new to SQL but i'm under the impression you would have to go one step inner to get a nested query, right?
if you dont assume you know michael scott id cant you just do it through employee table? for exp select client.client_name from client where client.branch_id = ( select employee.branch_id from employee where first_name='Michael' and last_name='Scott' //you could use LIKE instead of = limit 1);
I have an exam tomorrow this whole nested queries thing can get pretty complicated if you dont under stand the basics of the dos and don'ts and when to use certain functions with nested queries.
I’m having a difficult time finding any information on using an openquery as a subquery within an openquery. Is this possible and if so, how do I accomplish that?
@@EzeChiappero well now I got it , the different between the equal sign (=) and the 'IN' syntax is in it's implementation. Using 'IN' means we can look for value in a range of value, for example we can use : fruit IN ("apple","pineapple","orange"), it looks better than fruit = "apple" or fruit = "pineapple" or fruit = "orange". Hope that helps!
Writing the queries separately and then combining them made the logic of nested queries much easier to understand. Nice vid!
Indeed .
This guys way of teaching is amazing
OMG, I was struggling with Nested subqueries, but now I certainly have a better insight about it. Thank you so much and the person who shared your video in a forum.
I feel Jim and Dwight sell more than Michael at any given time.
Great video!
Couldn’t figure out my problem.. watched this video.. then solved my problem in less than 2 mins. Thx dude!
This made me understand the concept of nested queries better and quicker. The approach you conveyed within 5 mins is effective. Thank you so much
I come here from the google data analytics professional certificate and this video allowed me to understand this new concept. Thank you very much.
THANK YOU! BEST tutorial out there! Had no idea what was going on it class for the past 40 minutes and you sorted it in 10 😂
Hahaha
Mike... You are the M-A-A-AN!!!
Thank you, so much!
This was so clearly and simply esplained!
On top of everything, I was working on understanding the consecutiveness of the steps machine is working in, as it evaluates the query, and I saw, (in my mind), that it worked from inside-out of the parentheses - in other words, from within the innermost parentheses' query, gradually, toward the outermost query - but, I had seen some conflicting, (to a novice, like me), explanations and examples before, and wasn't entirely clear on this.
And YOU, Sir, did it so clearly, and eloquently!
Thank You!
Thank you! Your explanation is so clear!
hey mike, thanks for explaining the complex topic in SQL nested query!
YES!!!! Thank you. This was really clear. Taking my first database class via Zoom, needing all the help I can get lol!
Great tutorials man. I have an internship coming up in just over a week. These videos are making me feel prepped for it.
How'd that go
Thanks for simplifying the logic behind this!
Awesome explanation for nested or subqueries. Thanks so much!
I feel I should be contributing to your channel of how beneficial it is to me, thank you, Mike!
Please make mor vedios on Database we need it!
you have helped alot .. clear and understandable explaination
Fantastic videos, all of them. Thank you for doing this.
Wow.... what a clarity of explanation
Love how you used people from the Office!!!
nice video i want this types of more scenerio base questions solutions
Lol love The Office examples. Great informative video
Can we also just use an inner join?
Select * from employee inner join works_with where total_sales > 30,000 ?
I'm new to this stuff and wondering the same thing..
Any answers?
yes it gives the same result
Any nested correlated query can be rewritten as a normal query, it says in the book Fundamentals of Database Design.
Taught me something my teacher couldn't, appreciate it
Very good breakdown, thank you!
Awesome job done, how do I get all the dataset tables that was used
Such a great tutorial.
Thanks, man!
believe it or not our database design lecturer did not use practical example like this and just read of what syntaxes does from textbook. holy i just understood it in a minute!
u are so good tbh , very clear
can you give more questions for nested queries?
Amazing tutorial
When is it more appropriate to use a nested query over a join? Or is it preference?
Great question
Anyone?
literally my question and I can't find an answer either :)
Yes, a very good question. I would have used a table join for the first example in this tutorial, but as I'm relatively new to SQL, I assumed there was either a good reason not to, OR he was merely trying to demonstrate a principle.
Great video, just one problem though. You do not have Dwight in the employee table. :)
Great explanation!!!
May I asked why you would not use an IN with the client branch ID in the where clause, I don’t understand why parenthesis would used in this sense. Thank you
Hi, I liked working on the data camp, are there any websites with a lot of tables and questions to solve more problems and practice?
Great video 👍🏽
6:11 why it is called foreign key?
Love ♥ this tutorial
Keep it up!
Awesome video, thanks so much
Subscribed!!! Great videos with C and now SQL.
very nicely explained thank you
Great video! Step by step, clear, organized! good job! Just subscribed!
Great sir❤🎉
Can you do this if your trying to pull from separate dbos? Or do I have to create a view with the info from each dbo I need?
So, is it bad I didn't recognize the "re-brand" and my first thought was come on some guy stole "Mike's" video?? And, here I was going to subscribe. After a brief look at the videos, I realized my mistake and pounded that sub button. Because anyone with a hunger for computer knowledge this is a good place to start. The tutorials are simple and easy to follow for beginners and more advanced users.
Great video!!!👏
8:04
can we write 'in' instead of "="?
Assuming you don't know Michael Scott's ID:
-- Clients handled by Michael Scott's branch
SELECT client_name FROM client WHERE branch_id IN
(SELECT branch_id FROM branch WHERE mgr_id IN
(SELECT emp_id FROM employee WHERE first_name = "Michael" AND last_name = "Scott"));
-- Or you can do
SELECT client_name FROM client WHERE branch_id IN
(SELECT branch_id FROM branch WHERE mgr_id IN
(SELECT emp_id FROM employee WHERE CONCAT(first_name, " ", last_name) = "Michael Scott"));
Can I just say a HUGE thank you as I was stuck on this one coursework question
Great examples, how can one play with that data (online practice
in these cases would be more simple just using the join statement
Great content, thanks.
You are a Star...
Hi, thanks for the video! Sorry I don't get it why in the first example you were using 'IN', while in the 2nd example you were using '='? Can you explain a little detail, please? Thanks.
Being an office fanatic....i understood it better🤣👍👌
Explanation are helpful but I do have one question.. isn't the first question to find out employees for a single client.. not sure the query address the question
I guess he means all employees who have sold +3k to one client (not a specific client). So if we have an employee who sold 1500 to a client and 1500 to another client should not be counted
nice explanation 😇 sir
i need this with calculated columns. any suggestions?
This was so helpful! Thanks
In the very first subquery example, how would you display the client id as well along with employee's first and last name? I am happy if it repeats the name.
Can you do another video on a nested query but with group by? I am trying to use SQL to count adverse events for a clinical trial.
your explanation helps me a lot, thank you so much!
Can you create a video with nested queries and joins at the same time?
thanks, wonderful session.
Very Well Explained Sir ♥️♥️ Thank You
If in client there was not mng_id, is that a good query for the last exercise?
SELECT client_id, client_name
FROM client
WHERE client_id IN (
SELECT client_id
FROM works_with
WHERE emp_id IN(
SELECT emp_id
FROM employee
WHERE super_id IN (
SELECT mgr_id
FROM branch
WHERE mgr_id IN (
SELECT emp_id
FROM employee
WHERE employee.first_name = 'Michael' AND employee.last_name = 'Scott'
)
) OR (first_name = 'Michael' AND last_name = 'Scott')
)
)
Thank you. It really helps!
Great explanation! Thank you.
Would it make a huge difference if the branch manager query was the outer query, and the client withing the nested query?
Very clearly explained. I'm just getting to grips with SQL, so forgive my ignorance! Would you use a nesting approach if you wanted to retrieve relational data for over 1000 items using Oracle where you can't input more than 1K items in a single search? Or is there a more efficient way of querying large numbers of inputs using Developer? Hope that makes sense :-)
omg, this is better than my professor
We can use inner join
Very helpful. Than you.
Just wow ❤🙏🙏🙌
Can you make video of if condition and while loop as well please
i'm making an ecommerce website already made a db for it, but we are expanding so the nested model sounds like the best solution due to the filters and all that, but after watching this and making those huge queries (not difficult tho, just thinking about the whole mantainance and all the what would happen ifs), i feel like hierarchy model could be better, (can't work with mongodb since our hosting doesn't support it), what do you recommend me?
Thanks, good video
I wish I can give a million likes for this video. Thank you.
I liked the vid. You explain very well! However, isn't it a video for subqueries? I'm new to SQL but i'm under the impression you would have to go one step inner to get a nested query, right?
I want to validate data from a table A and insert into another table B if value matches from A, how can we achieve it ?
Pls can I have the data u work on I have your whole video on SQL but I need your pdf
if you dont assume you know michael scott id cant you just do it through employee table?
for exp
select client.client_name from client
where client.branch_id = (
select employee.branch_id from employee
where first_name='Michael' and last_name='Scott'
//you could use LIKE instead of =
limit 1);
Why is Mike in the video?
You are the best man ,👌
Can't watch the video... There is an error when I try to play it.
I have an exam tomorrow this whole nested queries thing can get pretty complicated if you dont under stand the basics of the dos and don'ts and when to use certain functions with nested queries.
To make it simple, why don't use "in" in all cases?
This was lit 🔥 Thank u bruh...
I don't understand fully the direfence between 'IN' statement and '=' command
*difference
Thank you. Help a lot
I’m having a difficult time finding any information on using an openquery as a subquery within an openquery. Is this possible and if so, how do I accomplish that?
I'm still confused about the difference between the 'IN' and the '=' , any explanations? thanks in advance. Great video!
Me too, same doubt
@@EzeChiappero well now I got it , the different between the equal sign (=) and the 'IN' syntax is in it's implementation. Using 'IN' means we can look for value in a range of value, for example we can use : fruit IN ("apple","pineapple","orange"), it looks better than fruit = "apple" or fruit = "pineapple" or fruit = "orange".
Hope that helps!
@@danielhermawan4054 Thanks!! I'm doing exercises right now and I'm sure that this advice will make sense for me later on. Thanks a lot for the reply!
@@danielhermawan4054 In the first exercise after reading your comment I get it. Thanks, Daniel!! Great community!!
Cool! You learned something today haha, I hope you'll do better and better!✨🔥
why not just use join?
Why I can't play this video?
Thank you for the explanation ! :D
thnk u so much sir
Life was good when we were giraffe academy's students
Thank you very much bro....
Just 30 minutes ago, I upload a doubt. With the help of a mate, I got the answer right the way, great community!