How to check number of rows in postgres table

Check number of rows in postgres table

In this tutorial in will show you how to check number of rows in postgres table.

PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness. It runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows. It is fully ACID compliant, has full support for foreign keys, joins, views, triggers, and stored procedures (in multiple languages). It includes most SQL:2008 data types, including INTEGER, NUMERIC, BOOLEAN, CHAR, VARCHAR, DATE, INTERVAL, and TIMESTAMP. It also supports storage of binary large objects, including pictures, sounds, or video. It has native programming interfaces for C/C++, Java, .Net, Perl, Python, Ruby, Tcl, ODBC, among others, and exceptional documentation.

Read Also: How to install postgresql 9.6 on centos 7
Read Also: Install postgres  on mac using postgres app
Read Also: How to install postgresql 9.6 on Ubuntu
Read Also: How to create database in postgres – postgres tutorial

Check number of rows in postgres table

There is a time when we need to check the number of rows in postgres table. We can use the following command to check the number of rows in a particular table.

SELECT COUNT(*) from public.users;

In the above command you need to replace the name of schema and table with yours.

SELECT COUNT(*) from public.users;
count
--------
10
(1 row)

In the above output we can see we have 10 users.

If you get any issue using this tutorial please feel free to comment below.

Leave a Reply

Your email address will not be published.


*


Secured By miniOrange