Count function usage in Oracle

Source: Internet
Author: User

Count function usage in Oracle

Count is used to count the results of a query with several records

Example Table T_test

name

Gender

Age

Wages

Tom

Man

23

2000

John doe

Woman

34

Wang Wu

Man

25

1300

① Simple Application

Query: Select COUNT (*) from t_test;

Results: 3

Explanation: The above query returns the number of bars recorded in the table T_test.

Application of ② with where condition

Query: Select COUNT (*) from t_test where gender = ' male '

Results: 2

Explanation: The above query returns the number of records in the table t_test where the Gender field is "male."

③ the application of a field count

Query: Select count (payroll) from T_test

Results: 2

Explanation: The above query returns the number of records in the Payroll column in table T_test, excluding the results when a record's payroll is empty.

Application of ④ coordination distinct

Query: Select count (Distint sex) from t_test

Results: 2

Explanation: The above query returns the number of record bars for the select distinct gender from t_test result.

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.