number of rows in mysql code example

Example 1: get number of rows in every table mysql

mysql> SELECT table_name, table_rows
   ->FROM INFORMATION_SCHEMA.TABLES
   ->WHERE TABLE_SCHEMA = 'business';

Example 2: mysql num rows

//number of rows retrieved from a query
<?php

$link = mysql_connect("localhost", "mysql_user", "mysql_password");
mysql_select_db("database", $link);

$result = mysql_query("SELECT * FROM table1", $link);
$num_rows = mysql_num_rows($result);

echo "$num_rows Rows\n";

?>

Example 3: row number mysql

SELECT row_number() over ( order by firstName) RowNumberSqeuence,FirstName from rowNumberDemo
 order by FirstName;

Tags:

Sql Example