|
I'm not a database person myself, so I was probably in the same situation as you when it came to figuring out joins and stuff. I ended up creating a mental image that I found useful. For what it's worth, here it is:
JOIN = add columns of table B to the columns of table A getting a wider table.
columns used in join = imagine column from table A as "red" data and column from table B as "green" data
Arrange rows in table to have first those where both red and green data are equal. Continue with remaining rows in table A (only red data, green data is empty). Finish with remaining rows in table B (only green data).
Now:
- INNER JOIN = take only the first part where red and green are equal
- LEFT JOIN = take first two parts (the equal and other red rows)
- RIGHT JOIN = take first and 3rd parts (the equal and green rows)
- OUTER JOIN = take all.
Just my 0.02$
Mircea
|
|
|
|
|
My resources (which I suspect many, many database developers or software engineers that also develop T-SQL do in some form or fashion) are:
- Brain - by understanding and visualizing what the data design and queries/statements are doing helps eliminate a lot of bad ideas and wasted time.
- SSMS - still the most comprehensive and easiest to use, IMHO, though sometimes I use the DB tools in Visual Studio.
- SQL Server - I've tried others, but the support costs for multiple DB providers in the latter part of the SDLC for the customer are higher (in almost all use cases) that just using SQL Server correctly for the task at hand.
- Consistency - solving the same problem with the same design, unless a newer design is demonstrably better in terms of execution, resources, and supportability.
- CRUD - I limit my use of SQL Server (or any DB server) to CRUD (or in more common SQL terms, SELECT, INSERT, UPDATE, and DELETE) and leave the business logic to the C# code executing on the server or in the cloud app service. Database servers are designed to optimize reading and writing of data, not running business logic because it is easier to "just stick it all in the SQL".
|
|
|
|
|
"
what's your SQL resources
Brent Ozar.
|
|
|
|
|
If you're familiar with how joins work but are having problems figuring out how to use them in a particular query, it might be good to back up and look at the structure of the database you're working with. For instance, do you even have a good key to join on?
A poor DB structure with a lack of normalization can make joins difficult or even impossible. If that's the problem, one way around it is to throw the data into temp tables with the correct structure you need for the joins and query against that.
Speaking of which, in a addition to learning about SQL it's also a very good idea to learn the fundamentals of database design if you haven't already. Knowing about things like normalization, keys, and indexing really helps when writing SQL.
|
|
|
|
|
Wordle 983 3/6
π©β¬β¬β¬β¬
π©β¬π¨π¨π©
π©π©π©π©π©
|
|
|
|
|
Wordle 983 3/6
β¬β¬β¬π¨π©
β¬π¨β¬β¬π©
π©π©π©π©π©
|
|
|
|
|
Wordle 983 3/6*
β¬β¬β¬π©π©
β¬β¬π¨π©π©
π©π©π©π©π©
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Wordle 983 4/6
β¬β¬β¬π¨π¨
π©π¨β¬β¬π©
π©β¬π©β¬π©
π©π©π©π©π©
|
|
|
|
|
Wordle 983 5/6
β¬β¬β¬π¨π¨
π¨π¨π¨β¬β¬
π¨β¬π©π¨π©
π©β¬π©π©π©
π©π©π©π©π©
wordle.at
Rules for the FOSW ![ ^]
MessageBox.Show(!string.IsNullOrWhiteSpace(_signature)
? $"This is my signature:{Environment.NewLine}{_signature}": "404-Signature not found");
|
|
|
|
|
Wordle 983 4/6
β¬β¬β¬π¨β¬
β¬π©π©β¬β¬
β¬π©π©π©π©
π©π©π©π©π©
|
|
|
|
|
β¬β¬β¬π¨π©
β¬β¬β¬β¬π¨
π©π©π©π©π©
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
|
|
|
|
|
Wordle 983 5/6*
β¬β¬π¨β¬β¬
π¨β¬β¬β¬π©
π©β¬β¬π¨π©
π©π©β¬β¬π©
π©π©π©π©π©
Happiness will never come to those who fail to appreciate what they already have. -Anon
And those who were seen dancing were thought to be insane by those who could not hear the music. -Frederick Nietzsche
|
|
|
|
|
Wordle 983 X/6
β¬β¬β¬π¨β¬
π¨π©β¬π¨β¬
β¬π©π©π©π©
β¬π©π©π©π©
β¬π©π©π©π©
β¬π©π©π©π©
What rotten luck!
And it is not even Monday!
Ok, I have had my coffee, so you can all come out now!
|
|
|
|
|
I only know 3 words that end with those letters
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
|
|
|
|
|
Wordle 983 3/6*
β¬β¬β¬π¨π©
π¨β¬β¬β¬π©
π©π©π©π©π©
|
|
|
|
|
The market is a living creature. If you can't read your spouse's mind, you ain't gonna read the market's mind. No matter what pattern you or a robot thought you saw in them there charts.
You're welcome. Now you're a pro.
Note: This does not apply to long term investing. That be different than short term trading.
Note Note: This does not apply to level 2 or 3 data, which most people don't have access to or use anyway. Talking about magical chart patterns and purdy pictures.
Note: This also does not apply to momentum.
Note: This note here just because it makes my post look more filled out.
Jeremy Falcon
|
|
|
|
|
well said jeremy
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Thanks man.
Jeremy Falcon
|
|
|
|
|
The market is a living creature nightmare
|
|
|
|
|
Wow, I think that's a record. One post gathering the remnants of not one, but two removed posts.
Iβve given up trying to be calm. However, I am open to feeling slightly less agitated.
Iβm begging you for the benefit of everyone, donβt be STUPID.
|
|
|
|
|
Wait, what I miss?
Jeremy Falcon
|
|
|
|
|
Oh, I see it now. Sweet.
Jeremy Falcon
|
|
|
|
|
The best short term trading I've done was none.
/ravi
|
|
|
|
|
IMO, it can be done well. Just like some people can win at a casino. That's about 0.01% of the population though (making that number up of course). Those who do well at a casino and those who do well at short term trading, oddly enough do so for the same reasons.
Jeremy Falcon
|
|
|
|
|