Member-only story
SQL Basics for Everyone — Part 2: SQL Select with Examples 🔦
The SELECT statement allows you to retrieve data from one or more tables.
The most basic SELECT Query contains two essential SQL keywords: SELECT followed by FROM.
SELECT column1, column2, ...
FROM table_name;🔸
SELECTtells the database that you want to output data, and is followed by the specific names of the columns you wish the database to print out.🔸
FROMtells the database which specific table contains that data we want to output.🔸When evaluating the
SELECTstatement, the database system evaluates theFROMclause first and then theSELECTclause.🔸The semicolon (
;) is not part of a query. The database server uses the semicolon to separate two SQL statements.👉 For example, if you execute two
SELECTstatements, you need to separate them using a semicolon (;)
If you want to retrieve data from all the columns of the table, you can list all the columns in the SELECT clause like this:
SELECT
column1,
column2,
column3
FROM
table_name;Alternatively, you can use the star (*) operator as the shorthand for all columns:
SELECT * FROM table_name;







