表: Employee
Id是该表的主键列。该表的每一行都表示雇员的名字、他们的部门和他们的经理的id。
如果managerId为空,则该员工没有经理。没有员工会成为自己的管理者。
问题:编写一个SQL查询,查询至少有5名直接下属的经理 。以 任意顺序 返回结果表。
结果格式如下:
输入:
输出:
import java.sql.*;
import java.util.*;
public class test2 {
public static void main(String[] args) throws Exception {
Class.forName("com.mysql.jdbc.Driver");
Connection conn= DriverManager.getConnection("jdbc:mysql://localhost:3306/student_course?useSSL=false", "root", "123456");
Statement state=conn.createStatement();
String s01="select managerId from employee group by managerId having count(managerId)>=5";
//找到至少有5名下属的所有经理的ID
ResultSet res01 = state.executeQuery(s01);
String mid[]=new String[10];
int i=0;
while(res01.next()){
mid[i]= res01.getString("managerId");
i++;
}
res01.close();
int j=i;
i=0;
while(i



