The query statement that is inseparable from database development-select statement

Source: Internet
Author: User

Database systems are the core of management information systems and one of the most important computer applications. From the perspective of most system application instances, query operations account for the largest proportion of various database operations. Let's take a closer look at the common query statements in queries-select statements!

 

This is the general query method of the SELECT statement.

 

Next, let's take a look at each query method separately.

1. Simple SELECT query

 

2. Where condition Query

A select statement containing the WHERE clause is called a conditional query statement. A table usually has thousands of records. When you only need a portion of the records, you need to use the WHERE clause to specify a series of query conditions.

3. query by group

The group by clause divides rows in a table into different groups. Summarize each group separately, so that you can control the level of detailed information you want to see

Notes:

A. In the field list of the select clause, except for the clustering function, other fields must be defined in the group by clause. For example: "group by a, B", then "select sum (A), C" has a problem.

 

B. The Field List of the select clause does not have to have a clustering function, but at least one project in the list of group by clauses must be used. For example, if "group by a, B, c", "select a" is acceptable.

 

C. in SQL Sever, fields of the text, ntext, and image data types cannot be used as grouping bases for group by clauses.

 

D. The field alias cannot be used for group.

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.