Member-only story

SQL Cheat Sheet

Starter guide for standard SQL syntax used in PostgreSQL

Jason
Towards Data Science
5 min readApr 19, 2020

--

Photo by panumas nikhomkhai from Pexels

SQL is the most important coding language to learn for data analysis. Some might argue Python and R are equally important, but when it comes to the most common tool an Analyst must have it is SQL.

According to Dataquest.io almost all of the biggest names in tech use SQL. Uber, Netflix, Airbnb — the list goes on. Even within companies like Facebook, Google, and Amazon, which have built their own high-performance database systems, data teams use SQL to query data and perform analysis.

Like every language, you need to keep practicing to understand and grasp keep concepts. In my opinion, SQL is one of the easier languages to use once you understand the basic structure of the code. In this article, I share the necessary steps to getting started with SQL querying.

Standard SQL Structure

This is Part 1 to a series of PostgreSQL cheat sheets and will cover SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY and LIMIT.

The basic structure of a query pulling results from a single table is as follows.

SELECT 
COLUMN_NAME(S)
FROM
TABLE_NAME
WHERE
CONDITION
GROUP BY
COLUMN_NAME(S)
HAVING
AGGREGATE_CONDITION
ORDER BY
COLUMN_NAME
LIMIT
N

--

--

Towards Data Science
Towards Data Science

Published in Towards Data Science

Your home for data science and AI. The world’s leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.

Jason
Jason

Written by Jason

Analytics📍 San Francisco

Responses (14)