Store_name
Sales
Txn_date
LOS ANGELES
1500
05-jan-1999
SAN DIEGO
250
07-jan-1999
SAN FRANCISCO
300
08-jan-1999
BOSTON
700
08-jan-1999
We enter,SELECT *From Store_informationWHERE store_name like '%an% ';Results:
Store_name
Sales
Txn_date
LOS ANGELES
1500
jan-05-1999
Label: We don't necessarily have to notice that each time the information inside the lattice is completely stuck. In many cases, we need to selectively capture data. For our samples. We can just grab a turnover over $1,000 contour.To do this, we need to use the where command. The syntax for this instruction is as follows: Select "Field name"From "Table name"WHERE "condition"; If we want to capture the information of turnover exceeding $1,000 by the f
How to use SQL in statements tutorial
In theIn in allows you to specify multiple values in the WHERE clause.Syntax for SQL
SELECT column_name (s) from
table_name
WHERE column_name in (value1,value2,...)
Let's look at an example. Here is the data
_id
LastName
FirstName
Address
City
Tags: SQL distinct
The SELECT command allows us to read all the data from one or more fields in a table. This will take all the data out, regardless of whether the data values are duplicated or not. In data processing, we often encounter situations where we need to find out the different data values in the table. In other words, we need to know what
in this command allows us to capture the values in the database within the limits of one or several discontinuous (discrete) values, while the between allows us to use a range (range) to scratch out the values in the database. between The syntax for this clause is as follows:Select "Field name"From "Table name"WHERE "field name" between ' Value one ' and ' value two ';This will select each of the data that contains the value one and the value two for
SQL INNER JOIN keyword usage tutorial
When the keyword of inner join is returned, at least one row in the competition is returned.SQL Syntax of INNER JOIN
SELECT column_name(s)FROM table_name1INNER JOIN table_name2 ON table_name1.column_name=table_name2.column_name
PS:Inner join is the same as JOIN.Let's take a look at an example.
P_Id
LastName
FirstName
Address
City
form:store_information Form
Store_name
Sales
Txn_date
LOS ANGELES
1500
05-jan-1999
SAN DIEGO
250
07-jan-1999
SAN FRANCISCO
300
08-jan-1999
BOSTON
700
08-jan-1999
We enter.SELECT *From Store_informationWHERE store_name like '%an% ';Results:
Store_name
Sales
Txn_date
LOS ANGELES
The purpose of the UNION all directive is to merge the results of the two SQL statements together. the union All and union differ in that union all lists each qualifying material, regardless of whether the data value is repeated or not.The syntax for UNION All is as follows:[SQL Statement 1]UNION All[SQL statement 2];We use the same example as the previous page
Tags: SQL ORDER BYSo far, we have learned how to capture data from a table with the two commands of SELECT and WHERE . However, we have not yet mentioned how this information should be arranged. This is actually a very important question. In fact, we often need to be able to make a systematic display of the captured data. This may be by small toward large (ascending) or by large toward small (descending). I
The language used to manipulate the RDBMS is called SQL and is typically divided into the following 3 categories:DDL: A data definition language used to add, delete, or modify databases and tablesCreatedropalterDML: A data manipulation language used to query or alter records in a tableSelectinsertupdatedeleteDCL: Data Control language used to determine or cancel changes to the database, as well as authorization and cancellation of authorizationCommitr
On the previous page, we see where directives can be used to conditionally select data from a table. This condition may be simple (like the previous page example), or it may be complex. A complex condition is a connection of two or more simple conditions through and OR OR. There can be an infinite number of simple conditions in an SQL statement.The syntax for complex conditions is as follows:Select "Field
Using the SQL INNER JOIN keyword Tutorial
INNER JOIN keyword When returning rows at least one race in the table.SQL syntax for INNER JOIN
SELECT column_name (s) from
table_name1
INNER JOIN table_name2 on
table_name1.column_name=table_ Name2.column_name
PS: The INNER join is the same as JOIN.Okay, let's take a look at an example.
p_id
LastName
FirstName
Addres
Let's go back to the function now. Remember that we use the SUM command to figure out all sales (turnover)! What if our demand turns out to be to figure out the turnover (sales) of each store (store_name)? In this case, we have to do two things: first, we have to select both the Store_name and the Sales columns. Second, we need to make sure that all Sales are separately calculated according to each store_name. This syntax is:Select "Field 1", SUM ("Field 2")From "
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.