SQL statements for linux-SELECT and select
What is SQL used? The most common method is to select data from the database table. From this answer, we can immediately see two keywords:FROM (FROM)Tables in the databaseSELECT). (A table is a structure in a database. It aims to store data. InTable ProcessingIn this section, we will mention how to use SQL to set tables .) Here we can see the most basic SQL architecture:
SELECT "column name" FROM "table name ";
Let's use the following example to see how it is actually used. Suppose we have the following table:
Store_InformationTable
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 |
If you want to select all store names (Store_Name), we will enter:
SELECT Store_Name FROM Store_Information;
Result:
Store_Name |
Los Angeles |
San Diego |
Los Angeles |
Boston |
We can read several columns at a time, or select data from several tables at the same time.
Now let's take a look at the tested results in Linux:
Create a vpoetDB database first:
Create a Store_Information table in the vpoetDB database:
Insert a response record in the table:
SELECT statement:
Reprinted, please note: Xiao Liu