select t.TABLE_NAME,t.NUM_ROWS from user_tables t order by t.TABLE_NAME:--oracle SELECT object_name (i.id) TableName, rows as RowCnt FROM sysindexes i INNER JOIN sysObjects o ON (o.id = i.id AND o.xType = 'U ') WHERE indid < 2
代码格式如下: select * from BillConsume where obId in (select obId from OpenBills where clearTheMarket is null or clearTheMarket=0) 要注意的是:in后面的查询语句必须是查询一个字段跟前面的表相对应的.比如要根据订单号orderID,OpenBills 这个表就需要查询到orderID这个字段,BillConsume这个表的条件就要判断orderID
查询数据总数:<select id="selectCount" resultType="java.lang.Integer"> <!-- WARNING - @mbggenerated This element is automatically generated by MyBatis Generator, do not modify. --> select count(id) from tb_user <where > <
import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet; import com.mysql.jdbc.Statement; public class MySQLDao { public static void main(String[] args) {try {Class.forName("com.mysql.jdbc.Driver");Connection conn = Dr
本文转载自:http://hi.baidu.com/ajyajyajy/item/4e2a7f4dc83393d2c1a592c1 use DBNAMEgoselect * from sysobjects where xtype='U'; --这是查询所有表的信息select count(*) from sysobjects where xtype='U' --这是查询表的数量 select a.name, b.rows from sysobjects a with(nolock) join
查看所有表对应的数据量 SELECT a.name AS 表名, MAX(b.rows) AS 记录条数 FROM sys.sysobjects AS a INNER JOIN sys.sysindexes AS b ON a.id = b.id WHERE (a.xtype = 'u') GROUP BY a.name ORDER BY 记录条数 DESC 查看数据库的总数据量 SELECT SUM(记录条数) AS 总记录数 FROM (SELECT TOP (10000) a.name A