What does SQL do for you? One of the most commonly used methods is to select data from a table in the database. From this answer, we can immediately see two keywords: select from a table in the (from) database. (a table is a structure within a database that is designed to store data.) In this section of table handling , we'll mention how to use SQL to set tables. We can see the most basic SQL schema here:
Select "Field name" from "Table name";
Let's use the following example to see how it's actually used. Suppose we have the following table:
store_information Form
Store_name |
Sales |
Txn_date |
Los Angeles |
1500 |
05-jan-1999 |
San Diego |
250 |
07-jan-1999 |
Los Angeles |
300 |
08-jan-1999 |
Boston |
700 |
08-jan-1999 |
To select all the store names (store_name), we enter:
SELECT store_name from Store_information;
Results:
Store_name |
Los Angeles |
San Diego |
Los Angeles |
Boston |
We can read several fields at a time, or we can select data from several tables at the same time.
Now let's look at the results measured under Linux:
Create a VPOETDB Database first:
Create a store_information table in the VPOETDB library:
Insert a record of the response in the table:
SELECT statement:
Reprint please specify: Xiao Liu
A concise tutorial of SQL statements for Linux---SELECT