Syntax

SQL Count Rows Syntax

In SQL, count rows: counts the number of rows — SELECT COUNT(*) FROM users;

Quick Answer

Syntax
SELECT COUNT(*) FROM users;
SQLSyntax

Count Rows

Code example
SELECT COUNT(*) FROM users;

Counts the number of rows.

Learn More

How to count rows in SQL

  1. Open your SQL file or editor.
  2. Copy the example, then replace its sample names and values for your code.

SQL Count Rows Syntax

Use SELECT COUNT(*) FROM users;.

Related Syntax References

Frequently asked questions

What is the SQL syntax for count rows?

Use this pattern: SELECT COUNT(*) FROM users;

Can I copy this SQL code example?

Yes. Use Copy code and adapt the example to your program.

Is this SQL syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify