MySQL SELECT statement and mysqlselect statement
SELECT statement:
The products table is as follows:
A selects a column FROM a table: mysql> SELECT prod_name FROM products;
B. Retrieve multiple columns FROM the table: mysql> SELECT prod_id, prod_name FROM products;
C. Retrieve all columns: mysql> SELECT * FROM products; // see the first figure.
D. Retrieve different lines: mysql> select distinct prod_id FROM products; // multiple lines of the same product name are used when multiple lines of product IDs are the same, show only one row.
E restrictions: mysql> SELECT prod_name FROM products LIMIT 5; // display the first five rows
F use the full name: mysql> SELECT products. prod_id FROM lab. products;
Select statement in MYsql
Select is a query function in SQL.
For example
Select A from B
A Is What You Query
B is the target of your query
For mysql select statements in php
$ SQL = mysql_query ("select sender from message where author ER = ". $ _ SESSION ["username"]. ""); // execute the database statement while ($ re = mysql_fetch_array ($ SQL) // obtain the result. The result of the first row ends with the pointer pointing to the second row, the end of this loop the next loop gets the result of the next row until no result {echo "<a href = #> ". $ re ["sender"]. "</a> <br/>"; // output the result. $ Re ["sender"] indicates the value you have queried. For more information, see Add a connection and press Enter .}