Want to easily remember the SQL commands for your database? Get my free SQL Cheat Sheets here: www.databasestar.com/get-sql-cheat-sheets/?
@willenaraines4596 Жыл бұрын
You are the only person that has clearly explained why and how a subquery is used. I couldn't figure out what the benefits would be. Thank you!
@DatabaseStar Жыл бұрын
Thanks for the feedback, glad you found it useful!
@adebanjomoyosore5721 Жыл бұрын
Honestly, I have often wondered why we needed subqueries and nobody has explained it to me perfectly like this.
@Pandodora Жыл бұрын
been traumatized by how complicated subquery is until I found your video. Very clear, straightforward and most importantly you explain such complicated query easily, that is indeed helpful, thanks!
@DatabaseStar Жыл бұрын
I’m so glad that this video was helpful for you! Subqueries can be hard to understand
@buraktiras932 жыл бұрын
Your videos are extremely helpful. Clean and clear. Thanks for the content, waiting for more SQL videos!
@DatabaseStar2 жыл бұрын
Thanks Burak, glad you like the videos!
@Nikopup Жыл бұрын
The tips on breaking it down into simple steps and then bringing it all together really helps me a lot! Thank you ❤
@DatabaseStar Жыл бұрын
You’re welcome! Glad this process was helpful.
@normn09 ай бұрын
Excellent video. As someone from a different STEM industry, its amazing how much trash you need to sift through on KZbin to find something like this in programming.
@DatabaseStar9 ай бұрын
Thanks a lot! I'm glad you find my video is one of the good ones!
@marie-sanna4 ай бұрын
Thank you for taking the time to actually explain WHY we need the goddamn subqueries; they seemed useless for me but now I'm starting to understand their importance and relevancy, and your video was super helpful for this.
@DatabaseStar4 ай бұрын
Thanks! I tried to explain the "why": I've seen a lot of tutorials on this and they just explain the "how", but not why to use them.
@zcecmsh999 ай бұрын
You make the best SQL videos on the internet, thank you for making this so clear and concise - keep up the great work!
@DatabaseStar9 ай бұрын
Thanks a lot! I'm glad you like the video, I've been trying to make each video a little better than the last.
@ASharonOkech2 ай бұрын
This helped me understand subquery. I couldn't understand subquery before this video.
@DatabaseStar2 ай бұрын
Glad to hear it helped you understand it!
@nathan.bradley Жыл бұрын
Thank you for helping me finally getting this. The way you broke it down made it so much easier to understand. Thanks again!
@DatabaseStar Жыл бұрын
Glad it helped!
@dhairyapanjwani145611 ай бұрын
finally cleared all the doubts in mind and got to know the mistake i was making!!!! Thank you for this video, amazing!
@DatabaseStar11 ай бұрын
Glad it was helpful!
@adrianmora4481 Жыл бұрын
This is great!! for the longest time, I was looking a logical explanation for subqueries
@DatabaseStar Жыл бұрын
Glad it was helpful!
@GmD.284 ай бұрын
Thank you so much ! I’ve been finding it hard to get my head around this topic
@DatabaseStar4 ай бұрын
Glad it was helpful!
@Heli-b9s2 ай бұрын
Very well explained, thank you!
@DatabaseStar2 ай бұрын
Glad it was helpful!
@Manisha70856 Жыл бұрын
Select product_name from products where price > avg(price). Could you please confirm that can we write like this to find all the products having price greater than avg if products
@DatabaseStar Жыл бұрын
Unfortunately that query won't work, but it makes sense and it would be helpful if it worked that way! The WHERE clause can't compare a value for a row against the result of an aggregate function like this. However, you can use a subquery like in this video to write it, to calculate the AVG in a subquery: Select product_name from products where price > (SELECT avg(price) FROM products);
@MultiGrapewine2 жыл бұрын
I was confused why to use subquery when we can achieve same result set from joins. now it is clear
@DatabaseStar2 жыл бұрын
Glad it was helpful!
@tempMahad2 жыл бұрын
Hello, I got a question. I'm building a system for my organisation and this is what they do. They sell products which have varying prices depending on quantity. For example prestige 1kg is 130 but prestige box 10kg is 1,050. Please help me on how to create a database that can help with variations. Thanks
@DatabaseStar2 жыл бұрын
You might find my video on "eCommerce Database Design" helpful, which caters for products that can have variations like this.
@d_lydian2 жыл бұрын
Hey there, I've got a question: I got a signals table with 2 columns (ParameterID & Time). Everytime a Parameter gets updated, it gets a new timestamp, so there are a lot of database row entries with the same ParameterID and a different timestamp. I want to query the latest timestamp of 3 specific ParameterIDs (33200, 33201, 33202). How can I achieve that in Microsoft SQL? Thanks for your help!
@DatabaseStar2 жыл бұрын
You could what's called a "correlated subquery" for this. You would use the subquery to find the maximum/latest timestamp for each of the parameter IDs, and then select the row that matches. Here's a query that could work: SELECT t1.parameter_id, t1.timestamp FROM your_table t1 WHERE t1.parameter_id IN (33200, 33201, 33202) AND t1.timestamp = ( SELECT MAX(timestamp) FROM your_table t2 WHERE t2.parameter_id = t1.parameter_id ); You could also use window functions to find the max values, which I've written about here: www.databasestar.com/select-rows-with-max-value/
@gggeeh2 жыл бұрын
hi thank you for your video, can i ask why is a subquery need in this practice solution: SELECT emp_no, (SELECT MIN(dept_no) FROM dept_emp de WHERE e.emp_no = de.emp_no) dept_no, FROM employees e; Was wondering why I cannot use join like this instead: SELECT e.emp_no, MIN (de.dept_no) as dept_no, FROM employees e JOIN dept_emp de ON e.emp_no = de.emp_no;
@DatabaseStar2 жыл бұрын
Both queries should show the same results so I don't see how the first one needs to use a subquery. The second query will actually return an error as it does not have a GROUP BY, but once you add GROUP BY e.emp_no, they should be the same. (I haven't tested these queries so I could be wrong)
@gggeeh2 жыл бұрын
@@DatabaseStar hey thanks for your reply, it helps!
@douaz69053 ай бұрын
That was really helpful !
@DatabaseStar3 ай бұрын
Glad it helped!
@utkarshgupta60912 жыл бұрын
hello. could u please cover some topics of sql that are required for data science like window functions. These topics were not present in your udemy course. please it would be of great help
@DatabaseStar2 жыл бұрын
Great idea! I can do some videos on those.
@utkarshgupta60912 жыл бұрын
@@DatabaseStar thank u. Would be of great help
@jwsc9578 Жыл бұрын
So well explained❤
@DatabaseStar Жыл бұрын
Thanks!
@dawitworku8217 ай бұрын
Very helpful. Than you.
@DatabaseStar7 ай бұрын
Glad it helped!
@arunareddy34912 жыл бұрын
Clear explanation
@DatabaseStar2 жыл бұрын
Thanks!
@mostafa21992 жыл бұрын
thanks man it really helped
@DatabaseStar2 жыл бұрын
No problem!
@icecube8496 Жыл бұрын
Hi. Are you left handed? Just curious.
@DatabaseStar Жыл бұрын
No, right handed actually. Is there something in the video that makes it seem like I am left handed?
@olufemiolawale3848 Жыл бұрын
Thank you sir.
@DatabaseStar Жыл бұрын
You're welcome
@user-yh9vd9yz9u Жыл бұрын
Thank you!
@DatabaseStar Жыл бұрын
You're welcome!
@Pankaj-Verma-9 ай бұрын
Thanks.
@DatabaseStar9 ай бұрын
You're welcome
@X1SX2 жыл бұрын
Thank you
@DatabaseStar2 жыл бұрын
You’re welcome!
@patientson13 күн бұрын
Bad teaching... teach the art of applying subquery to a table and two tables. No tip was helphul at at all.
@DatabaseStar13 күн бұрын
Thanks for the feedback! Is there a better way that you would explain it?