SQL --------------- count () function

COUNT () function returns the number of rows that meet specified criteria.

SQL COUNT (column_name) function returns the value of the specified number of columns (NULL not included), but empty records

 

 grammar:

 

the SELECT  COUNT (table field) from table name

Build a data table to get some attention rem field

 

 

 Find out how many rows field

 

 Using a fast and as, no record is null, but empty record

 

 And where the words using a

 

 COUNT(*)

COUNT (*) function returns the number of records in the table, no longer specified field 

grammar:

the SELECT  COUNT ( * ) AS number records   from the table name

 

 COUNT (DISTINCT field)

        Returns the column number of different values

Note: COUNT (DISTINCT) applies to ORACLE and Microsoft SQL Server, but can not be used in Microsoft Access.

grammar:

the SELECT  COUNT ( DISTINCT   column name) AS Salary rows from the table name

 Code

-   SQL COUNT function 
- Syntax: count (field names) from the table name 
the SELECT  COUNT (Bank) from obgetest 


- when data in any field is null, null is not counted as the line, but also for the empty record 
the SELECT  COUNT (REM) AS Memo number of rows from obgetest 

-   and where the words used for a fast 
SELECT  COUNT (Bank) from obgetest where Gongzi >  3000 

-   returns the number of rows in the table 
SELECT  COUNT ( * ) AS number of records from obgetest 

-    DISTINCT field is used to return the number of data is not the same, 
-- If there are two numbers as salary, it is only considered a 
SELECT  COUNT ( the DISTINCT   Gongzi) AS number of pay lines from obgetest

 

Guess you like

Origin www.cnblogs.com/obge/p/11670779.html