SQL Select

One of the most important SQL is SELECT, allowing queries on data stored in the database.

SQL SELECT Syntax

SELECT * FROM tablename

SELECT column1, column2 FROM tablename

For examples, we have the following table of people called "persons"

This is the data stored in the table "people"

namesurnamenickname
HARRYCLARKWHITE
HARRYSMITHBENITO
WILLIAMJONESCLARK

If we see all the data in the table "people"

SELECT * FROM people

This is the result:

namesurnamenickname
HARRYCLARKWHITE
HARRYSMITHBENITO
WILLIAMJONESCLARK

If we want to query all names and surnames of all individuals

SELECT name, surname FROM people

This is the result

namesurname
HARRYCLARK
HARRYSMITH
WILLIAMJONES