SQL Select

SQL Select

The SQL command SELECT is used to query a database table.
You can select all records from table or just certain records that meet the required conditions.
You can select all columns from table or just certain columns.

Select syntax

-- select all records from table
SELECT * FROM table_name

-- select specific columns 
SELECT column_1, column_2 FROM table_name

-- select the records that meet the condition
SELECT * FROM table_name WHERE {condition}

-- select the records that meet both conditions
SELECT * FROM table_name WHERE {condition} AND {condition}

Select example

SELECT * FROM coder_books;

SELECT id, title FROM coder_books;

SELECT * FROM coder_books WHERE id=3;

SELECT * FROM coder_books 
WHERE price > 18 
AND title LIKE '%SQL%';