淘先锋技术网

首页 1 2 3 4 5 6 7
mysql表查询字段值,sql语句查位数大于100的字段?

//连接数据库 mysql conn = DriverManager.getConnection("jdbc:mysql://" + IPAddress+ ":3306/库名", "root", "密码"); //取得该库的所有表 ResultSet rs=conn.createStatement().executeQuery("show tables"); while(rs.next()){ String tableName=rs.getString(1); ResultSet rs2=conn.createStatement().executeQuery("select count(*) from "+tableName); rs2.next(); int hs=rs2.getInt(1); if(hs>=100){ System.out.println("表名:"+tableName+"\t 行数:"+hs); } }