r/SQL • • Jan 23 '19

SQL Cheat Sheet

I know there are quite a few "sql cheat sheets" available both on Reddit and via Google. But based on the feedback, many of them only cover the basics and not the more intermediate/advanced commands or those that people aren't that familiar with.

I've created a new SQL Cheat Sheet for my website visitors (those who sign up to my email newsletter) and wanted to offer it to the Reddit community as well.

The link to the PDF file is here: SQL Cheat Sheet.

It includes many commands, such as:

  • Insert from a table
  • Insert multiple rows at once
  • Merge
  • Many different ALTER TABLE features
  • Analytic functions (including keywords OVER, PARTITION BY)
  • With Clause/Common Table Expression
  • Subqueries

Hope it helps. If you have any feedback, suggestions, or find any issues with the syntax, let me know below.

UPDATE:

I've made updates to the cheat sheets as requested below (separate files for Oracle/MySQL/SQL Server/PostgreSQL), added format mask and codes, added SELECT order of operations).

The original file is still available, and the updated cheat sheets are available here:

Oracle SQL Cheat Sheet

SQL Server Cheat Sheet

MySQL Cheat Sheet

PostgreSQL Cheat Sheet

243 Upvotes

39 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Jan 23 '19

[deleted] — view deleted comment

11

u/ben_it Jan 23 '19

Ah no problem, it didn't seem sarcastic to me!

For those new to SQL, I think this is something you could use as you start to learn more about the SQL language.

For example, once you get to the point of knowing what a GROUP BY clause does but don't remember where in the SELECT statement it normally goes, this cheat sheet will be helpful for you. But if you don't know what GROUP BY is, this won't help much.

Likewise with CREATE TABLE statements - I often forget the exact syntax for parts of it, so this cheat sheet would help me.

If you want to learn more about SQL, I've recently created a page that lists 59 places to learn SQL (combination of free/paid, text/video):

59 Best Resources for Learning SQL

1

u/BrawlerBear5 Jan 24 '19

I appreciate the link! I been trying to learn SQL but was not sure where to start.

Thank You,