Home > Backend Development > PHP Tutorial > Detailed explanation of the use of SELECT_PHP tutorial

Detailed explanation of the use of SELECT_PHP tutorial

WBOY
Release: 2016-07-13 17:02:38
Original
926 people have browsed it


The data table has been created. Assuming that we have inserted a lot of data, we can retrieve and display the information in the data table in the way we like. For example: we can put the entire data as follows The contents in the table are displayed
                                                                              select * from president; The general form of the statement is as follows:
SELECT you want the information
from data table (one or more)
The conditions satisfied with
Select statement have several clauses, their various mixes can help Find the information you are most interested in. These clauses can be very simple or very complex. See how the author explains in detail
1. Use various operators to set search conditions
If you want to The select statement only retrieves records that meet specific conditions, so you must add a where clause to it to set the retrieval conditions for data rows. Only in this way can we selectively select those data rows whose data column values ​​meet specific requirements. You can search for any type of value, for example, search for numerical values
select * from score where score>95; //Display all information with scores above 95 points
You can also search for string values
select last_name,first_name from president where last_name='Tom'; //Find all presidents with the last name tom
You can also perform a combined search on different types of values
select last_name,first_name,birth,state from president
where birth<'1950-1-1' and (state='VA' or state='BA');
//Find the president who was born in VA or BA before 1950
It can be seen that the arithmetic operators (+-*/%), comparison operators (<>=) and logical operators can be used in the where clause. We should be proficient in understanding the meaning of these operators (all simple)



http://www.bkjia.com/PHPjc/631021.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631021.htmlTechArticleThe data tables have been created. Assuming that we have inserted a lot of data, we can use whatever data we like. The information in the data table is retrieved and displayed, for example...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template