Introduction to SQL language in simple SQL series tutorials

Source: Internet
Author: User

SQL is the abbreviation for a Structured Query language (structured-Language). This language allows us to perform complex operations on the database. The SQL language is used in a wide range of applications. Many database products support the SQL language, which means that if we learn the SQL language, we can apply that knowledge to Ms Access or SQL Server, Oracle, DB2, and many other databases.

SQL language is used in relational databases. A relational database stores data in tables (also known as relationships). The main component of each database is a set of tables. Each table is made up of a set of records-each record has the same structure in the table, and contains a fixed number of fields of a certain type.

Let's look at a table in the actual database. The table, which is called the CIA, contains more than 250 records, each representing a country. A table consists of 5 fields with a string type and some numeric types.

Name Region area population GDP
---- ------ ------ ---------- -----------
Yemen Middle East 527970 14728474 23400000000
Zaire Africa 2345410 44060636 18800000000
Zambia Africa 752610 9445723 7900000000
Zimbabwe Africa 390580 11139961 17400000000

Here we can use some SQL statements to query the table for the data we are interested in.

1. How much is China's GDP?

The SQL statement used for the query is:

Select GDP from CIA where name= ' i '

The results of the query are:

4800000000000

2. Give the number of countries and the total population of each region. And by the number of people in the region from more to less sort.

The SQL statement used for the query is:

SELECT region, COUNT (name), SUM (population)
From CIA
GROUP by region
ORDER BY 3 DESC

The results of the query are:

Region COUNT (name) SUM (population)
------ ----------- ---------------
Asia 14 2963031109
Africa 59 793382933
Europe 43 580590872
....

How about the SQL language has a basic understanding of it, while the database, tables, records, fields and so on a series of commonly used in the SQL language of gratitude also have a general understanding of it. If it's not clear, it doesn't matter, and in the next section, we'll introduce the simplest content from the SQL language and provide you with a lot of practice. I believe you can become a master of SQL language after learning this series of tutorials.

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.