March 17, 2019 at 8:09 am
Someone new to SQL asked me to show him a dozen of subqueries samples for Northwind or AdventureWorks databases. Does anyone know where i could find such samples?
I can only come up with a couple of basic examples (like 'show all products that have never been ordered...).
thanks.
Likes to play Chess
March 17, 2019 at 8:40 am
VoldemarG - Sunday, March 17, 2019 8:09 AMSomeone new to SQL asked me to show him a dozen of subqueries samples for Northwind or AdventureWorks databases. Does anyone know where i could find such samples?
I can only come up with a couple of basic examples (like 'show all products that have never been ordered...).
thanks.
On a high level, you got two options here, CTE or SubQuery, the latter has two further options of correlation. Anyone asking you of dozen of examples of what they don't know what is sounds a bit peculiar to say the least.
😎
March 18, 2019 at 7:25 am
This request also sounds odd to me. I'm also a newbie and I don't even know what to ask online until I encounter something new I can't figure out. Odd that I come to visit the site today and see this question as I just downloaded the Adventure Works DB to look at Pivots.
-Mark
MSSQL 2019 Standard, Azure Hosted. Techie/Sysadmin by trade; Three years as a "DBA" now.
March 18, 2019 at 10:09 am
usererror - Monday, March 18, 2019 7:25 AMThis request also sounds odd to me. I'm also a newbie and I don't even know what to ask online until I encounter something new I can't figure out. Odd that I come to visit the site today and see this question as I just downloaded the Adventure Works DB to look at Pivots.
If by "pivots", you mean the PIVOT operator, have a look at the following two articles...
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]
--Jeff Moden
Change is inevitable... Change for the better is not.
March 18, 2019 at 11:47 am
Jeff Moden - Monday, March 18, 2019 10:09 AMusererror - Monday, March 18, 2019 7:25 AMThis request also sounds odd to me. I'm also a newbie and I don't even know what to ask online until I encounter something new I can't figure out. Odd that I come to visit the site today and see this question as I just downloaded the Adventure Works DB to look at Pivots.If by "pivots", you mean the PIVOT operator, have a look at the following two articles...
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]
Jeff, that is exactly what I meant. 🙂 I have been looking at some other articles about PIVOT.
-Mark
MSSQL 2019 Standard, Azure Hosted. Techie/Sysadmin by trade; Three years as a "DBA" now.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply