SQL is a query language that lets you manipulate data. SELECT will let you select data in a table.
If you want to select everything in a table you start with:
SELECT *
FROM table_name;
If you want to see data from specific columns:
SELECT “column_name1”, “column_name2”
FROM table_name;
SELECT DISTINCT will return different values in the data.
In the example below, our table name is Superstore:
In the example below, our table name is Superstore_Orders:
SQL Syntax varies based on the database we are using. In Snowflakes, we do not need to add a semi-colon at the end of a query. We use the WHERE clause in SQL to give a condition. Let’s talk about three operators in the WHERE clause:
Between: Show values within a given range
LIKE: Search for a pattern
IN: To specify multiple values for column
The IN operator is a condition that lets you specify multiple values in a WHERE clause.
For example, If we want to find different cities in many states, we can use the WHERE clause with the IN operator.
Like anything else, SQL requires a lot of practice to master. In addition to the W3Schools website, SQLZoo is an excellent resource to practice writing queries in SQL.
SQLZoho: https://sqlzoo.net/wiki/SQL_Tutorial