Sometimes you take out all database records may just meet your requirements, but in most cases we usually just get some records. How do I design inquiry? Of course, it will be more brainstorming, let alone this article also surprised you to use the Robs of the Raushzi.
For example, if you only plan to take out the p_name record, and these records must be headed in letter W, then you will use the WHERE clause:
SQL = "SELECT P_NAME FROM Products Where P_name Like 'W%'"
The after the WHERE keyword is followed by the conditions used to filter data. With these conditions, it will only be queried with data that satisfy certain standards. In the above example, the results of the query will only get the name of the name in the W header.
In the above example, the meaning of the percent symbol (%) is that the query returns all W letters and back is the record entry for any data or no data. So, when executing the above query, West and Willow will be selected from the Products table and store it in the query.
Just as you can see, just carefully design the SELECT statement, you can limit the amount of information returned in the Recordset, and ponder how to meet your requirements.
These, but it is just that SQL use is just starting. To help you gradually master the complex SELECT statement usage, let's take a look at the key standard terms: compare operators, these stations are often used when building their SELECT strings to get specific data.
WHERE clause foundation
When you start creating a WHERE clause, the easiest way is to adopt a standard comparison symbol, which is <, <=,>,> =, <> and =. Obviously, you will soon understand the meaning of the following code and the specific operation:
Select * from products where p_price> = 199.95
SELECT * from Products where p_price <> 19.95
SELECT * from products where p_version = '4'
Note: Here you will notice that the numbers in the last example are added with single quotes. The reason is that the '4' in this example is a text type rather than a digital type. Because you will put the SELECT statement in the quotation mark to assign it to the variable as a value, you can also use quotation marks in the statement.
Compare operator
The comparison operator specifies the scope of the data from the table. You can use them to create filters to narrow the range of Recordset, which prompted to save only information you care about when you have given a given task.