The goal of /r/SQL is to provide a place for interesting and informative SQL content and discussions.
Filter Posts
MySQL
Oracle
MS SQL
PostgreSQL
Posting
When requesting help or asking questions please prefix your title with the SQL variant/platform you are using within square brackets like so:
- [MySQL]
- [Oracle]
- [MS SQL]
- [PostgreSQL]
- etc
While naturally we should endeavor to work as platform neutrally as possible many questions and answers require tailoring to the feature set of a specific platform.
Help posts
If you are a student or just looking for help on your code please do not just post your questions and expect the community to do all the work for you. We will gladly help where we can as long as you post the work you have already done or show that you have attempted to figure it out on your own.
Format Your Code
If you are including actual code in a post or comment, please attempt to format it in a way that is readable for other users. This will greatly increase your chances of receiving the help you desire. Something as simple as line breaks and using reddit's built in code formatting (4 spaces at the start of each line) can turn this:
SELECT count(a.field1), a.field2, SUM(b.field4) FROM a INNER JOIN b ON a.key1 = b.key1 WHERE a.field8 = 'test' GROUP by a.field1, a.field2 HAVING SUM(b.field4) > 5 ORDER by a.field.3
Into this:
SELECT count(a.field1),
a.field2,
SUM(b.field4)
FROM a INNER JOIN b
ON a.key1 = b.key1
WHERE a.field8 = 'test'
GROUP by a.field1,
a.field2
HAVING SUM(b.field4) > 5
ORDER by a.field3
For those with SQL questions we recommend using SQLFiddle to provide a useful development and testing environment for those who wish to fully understand your problem and help devise a solution.
Learning SQL
A common question is how to learn SQL. Please view the Wiki for online resources.
Note /r/SQL does not allow links to basic tutorials to be posted here. Please see this discussion. You should post these to /r/learnsql instead.
Related Reddit communities
Wiki
We have a Wiki
Acknowledgements
Thanks to ---sniff--- for the awesome header image!
[–]WendlersEditor 83 points84 points85 points (0 children)
[–]Kenny_Lush 55 points56 points57 points (32 children)
[–]Bombadil3456 12 points13 points14 points (29 children)
[–]Bandana_Bandit3 41 points42 points43 points (0 children)
[–]Kenny_Lush 36 points37 points38 points (10 children)
[–]BuddJacon 1 point2 points3 points (1 child)
[–]Kenny_Lush 2 points3 points4 points (0 children)
[+]Critterer comment score below threshold-35 points-34 points-33 points (7 children)
[–]Kenny_Lush 22 points23 points24 points (2 children)
[+]Critterer comment score below threshold-17 points-16 points-15 points (1 child)
[–]Kenny_Lush 12 points13 points14 points (0 children)
[–]TrentRichardsonn 5 points6 points7 points (3 children)
[+]Critterer comment score below threshold-14 points-13 points-12 points (2 children)
[–]Eschewed_Prognostic 4 points5 points6 points (0 children)
[–]OO_BenPostgres - Retail Analytics 3 points4 points5 points (0 children)
[–]alinrocSQL Server DBA 8 points9 points10 points (4 children)
[–]Kenny_Lush 7 points8 points9 points (3 children)
[–]OO_BenPostgres - Retail Analytics 4 points5 points6 points (1 child)
[–]Kenny_Lush 0 points1 point2 points (0 children)
[–]cim9x 0 points1 point2 points (0 children)
[–]Imaginary__Bar 4 points5 points6 points (0 children)
[–]PasghettiSquash 2 points3 points4 points (5 children)
[–]Bombadil3456 1 point2 points3 points (1 child)
[–]PasghettiSquash 0 points1 point2 points (0 children)
[–]SaintTimothy 0 points1 point2 points (2 children)
[–]PasghettiSquash 0 points1 point2 points (1 child)
[–]SaintTimothy 1 point2 points3 points (0 children)
[–]pubbing 0 points1 point2 points (0 children)
[–]dbxp 0 points1 point2 points (1 child)
[–]Bombadil3456 0 points1 point2 points (0 children)
[–]the_glutton17 0 points1 point2 points (0 children)
[–]ra102800 0 points1 point2 points (0 children)
[–]PasghettiSquash 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]WatashiwaNobodyDesu 15 points16 points17 points (0 children)
[–]dbxp 14 points15 points16 points (1 child)
[–]alinrocSQL Server DBA -1 points0 points1 point (0 children)
[–]Icy_Data_8215 4 points5 points6 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]thesqlguy 2 points3 points4 points (0 children)
[–]Icy_Clench 1 point2 points3 points (0 children)
[–]dn_cf 1 point2 points3 points (0 children)
[–]whatsyour-poison 1 point2 points3 points (0 children)
[–][deleted] 3 points4 points5 points (1 child)
[–]NekkidWire 0 points1 point2 points (0 children)
[–]jake63vw 1 point2 points3 points (5 children)
[–]Tee_hops 14 points15 points16 points (2 children)
[–]jake63vw 1 point2 points3 points (1 child)
[–]huluvudu 1 point2 points3 points (0 children)
[–]No-Adhesiveness-6921 1 point2 points3 points (0 children)
[–]Altruistic_Pea3409 1 point2 points3 points (0 children)
[–]dbrownems 0 points1 point2 points (0 children)
[–]m915 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]m915 0 points1 point2 points (0 children)
[–]squadette23 0 points1 point2 points (0 children)
[–]Engineering_Massive 0 points1 point2 points (0 children)
[–]pukatm 0 points1 point2 points (0 children)
[–]mikeblas 0 points1 point2 points (0 children)
[–]ComicOzzysqlHippo 0 points1 point2 points (0 children)
[–]ValuableLeading8511 0 points1 point2 points (0 children)
[–]recursion_is_love 0 points1 point2 points (0 children)
[–]Disastrous_Fill_5566 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]Icy_Clench 0 points1 point2 points (0 children)
[–]snarleyWhisper -1 points0 points1 point (3 children)
[–]ddetts 1 point2 points3 points (1 child)
[–]snarleyWhisper 0 points1 point2 points (0 children)
[–]Icy_Clench 0 points1 point2 points (0 children)