SQL statements for linux-SELECT and select

Source: Internet
Author: User
Tags how to use sql

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

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.