What are the ways to get the count of records in a table

0 votes
Hi!!

Can someone tell me the various ways to get the count of records in a table?
Sep 27, 2018 in Database by DataKing99
• 8,250 points
3,991 views

2 answers to this question.

0 votes

To count the number of records in a table, you can use the below commands:

SELECT * FROM table1

SELECT COUNT(*) FROM table1

SELECT rows FROM sysindexes WHERE id = OBJECT_ID(table1) AND indid < 2

answered Sep 27, 2018 by Sahiti
• 6,370 points
0 votes
With the help of the SQL count statement, you can get the number of records stored in a table.

SELECT COUNT (*) FROM tableName;

If you are working on vb.net, you can capture the count result as follows
Dim cnt As Integer = cmd.ExecuteReader();
answered Aug 20, 2020 by Okugbe
• 280 points

Related Questions In Database

0 votes
1 answer

What are the ways of Data Import and Export in MySQL Workbench?

There are majorly three ways to export ...READ MORE

answered Dec 14, 2018 in Database by DataKing99
• 8,250 points
2,319 views
0 votes
1 answer

Query to list number of records in each table in a database

Use the below code to list number of ...READ MORE

answered Oct 11, 2019 in Database by Omaiz
• 560 points
1,439 views
0 votes
0 answers

How to select the last record of a table in SQL?

Here is an example of code that ...READ MORE

Aug 23, 2022 in Database by Kithuzzz
• 38,000 points
1,085 views
0 votes
1 answer

What are the different types of keys used in the database?

There are mainly 5 types of Keys, ...READ MORE

answered Nov 19, 2018 in Database by Sahiti
• 6,370 points
5,926 views
0 votes
1 answer

How to color code cells of a column based on the text value in Tableau

You can use the following steps to ...READ MORE

answered Mar 27, 2018 in Tableau by Atul
• 10,240 points
9,892 views
0 votes
1 answer

Is it possible to access Couchbase by terminal?

What you want to accomplish isn't possible ...READ MORE

answered Apr 29, 2018 in DevOps & Agile by DareDev
• 6,890 points
770 views
0 votes
1 answer

How to connect Java program to the MySQL database?

You can connect your Java code with ...READ MORE

answered May 11, 2018 in Java by Parth
• 4,640 points
1,913 views
0 votes
1 answer
0 votes
1 answer

What is the SQL query to get the third highest salary of an employee from employee_table

You can try out something like this: SELECT ...READ MORE

answered Sep 27, 2018 in Database by Sahiti
• 6,370 points
12,623 views
0 votes
1 answer

What do ‘Record’, ‘Field’ and ‘Table’ mean in terms of a database?

You can refer to the following definitions ...READ MORE

answered Nov 12, 2018 in Database by Sahiti
• 6,370 points
22,041 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP