MariaDB SELECT
To retrieve records from a table or multiple tables stored in a database, the MariaDB SELECT statement is used.
Syntax: To select all fields from a table.
SELECT * FROM table_name;
Example: Selecting all fields from a table.
SELECT * FROM Players; |
Output:
ID NAME SPORTS 1 Sachin Cricket 2 Dhoni Cricket 3 Sunil Football 4 Srikanth Badminton 5 Mary Boxing
Syntax: To select specific fields from a table.
SELECT expressions
FROM table_name
WHERE conditions; |
Parameters:
expressions: It is used to specify the columns or calculations to be retrieved.
conditions: It is used to specify the conditions to be strictly followed for selection.
Example: Selecting specific fields from a table.
SELECT * FROM Players WHERE id > 2 ORDER BY name; |
Output:
ID NAME SPORTS 5 Mary Boxing 4 Srikanth Badminton 3 Sunil Football