The select statement is used to select data from the database.
SQL is followed by a unique set of rules and guidelines called Syntax.
SELECT
FROM
WHERE
ORDER BY
The Select Command
- Shows the fields that have to be displayed
- Select * – will display all fields
The From Command
- Used to choose a table to return records from
The Where Command
- Used to set a condition for the search
The Order By Command
- Used to sort the results (Ascending or Descending order)
- asc or desc
Example
SELECT *
FROM Films
WHERE Rating = ‘U’;
SELECT Title, Rating, Running Time
FROM Films
WHERE Running Time <= 120
ORDER BY Running Time asc;