The usage of SELECT statement is described in detail. Data tables have been created. if we have inserted a lot of data, we can search and display the information in the data table in our favorite way, for example, if a data table has been created and we have inserted a lot of data, we can search and display the information in the data table in our favorite way. for example: the content in the entire data table can be displayed as follows:
Select * from president;
You can also select only one data column in a data row.
Select birth from president where last_name = 'Eisenhower ';
The general form of the select statement is as follows:
Select the information you want
From data table (one or more)
Where conditions
The select statement has several clauses. Their combinations can help you find the most interesting information. these clauses can be very simple or complex, and you can see how the author explains them in detail.
1. use various operators to set search conditions
To allow the select statement to retrieve records that meet specific conditions, you must add the where clause to set the search conditions for data rows. Only in this way can we select the data rows whose values of the data column meet the specific requirements. You can search for any type of value. for example, you can search for a value.
Select * from score where score> 95; // displays information of all scores above 95.
You can also search for string values.
Select last_name, first_name from president where last_name = 'Tom '; // find all the presidents named Tom.
You can also search for different types of values in combination.
Select last_name, first_name, birth, state from president
Where birth <'2014-1-1 'and (state = 'Va' or state = 'ba ');
// Identify the president born in VA or BA state before January 1, 1950
It can be seen that the where clause can use arithmetic operators (+-*/%), comparison operators (<> =), and logical operators, we should be familiar with the meaning of these operators (both very simple)
...