08-16-2017, 09:31 PM
[attachment=6988]
MYSQL
SELECT
The SELECT statement is used to pull information from a table
The general form of the statement is:
SELECT what_to_select
FROM which_table
WHERE conditions_to_satisfy;
what_to_select is what you want to see.
what_to_select can be a list of columns
* to indicate "all columns."
which_table is the table name list.
The WHERE clause is optional.
If where clause is present, conditions_to_satisfy specifies conditions that rows must satisfy.
The basic SELECT statement syntax
SELECT columns FROM table [WHERE (condition)]
The WHERE condition is in square brackets as it is optional.
The statement is 'complete' when a semi-colon is typed at the end.
-> This is a continuation line allowing you to enter a long statement over several lines.
To display all the data from the 'employee' table we would issue the following command (where '*' is the wildcard symbol for all).
select * from Employee;
Conditions can be combined to achieve better filtering of results
SELECT * FROM employee WHERE ((employee.id = 2) AND (employee.city = 'Vancouver'));