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); } }