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!
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’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?
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 :-)
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.
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!
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.
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, 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.
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);
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') ) )
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"));
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.
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.
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