SQL templates/Generic SQL

Count the rows in a table

Get the exact number of rows in any table in your database.

Generic SQL · PostgreSQL
SELECT COUNT(*) AS total_rows
FROM orders;

How it works

A plain COUNT(*) returns the exact row total. Swap `orders` for any table name. On very large tables this scans the whole table, so run it when you need an exact figure rather than constantly.

Run this on your own database

BeQuery mirrors your Generic SQL MySQL database to an isolated PostgreSQL copy, so you can run queries like this one without ever touching production.

Start free No credit card

More Generic SQL queries