本文解答了关于《不能转专业的学生》相关内容,同时关于1、不能转专业的学生,2、不能转专业的学生有哪些,3、不能转专业的学生包括,4、不能转专业的学生怎么办,5、不能转专业的学生叫什么,的相关问答本篇文章福途教育网小编也整理了进来,希望对您有帮助。
不能转专业的学生
String sql2 ="INSERT INTO CanChangeMajor (StudentID,Name,MajorName,Level)"
+"SELECT distinct a.StudentID ,a.Name, a.MajorName , a.Level FROM studneta a"
+" where a.StudentID not in ( SELECT distinct b.StudentID FROM CanChangeMajor b )";
//查找CanChangeMajor 表
String sql3 = "select * from CanChangeMajor";
//查找MajorChange表
String sql4 = "select * from MajorChange ";
//查找CanChangeMajor 和 majorchange 两个表
String sql5 ="SELECT distinct c.AStudentID ,c.Name, c.AMajorName , c.ALevel,b.BMajorName,b.BLevel FROM CanChangeMajor c , MajorChange b "
+"WHERE c.AStudentID = b.BStudentID";
//查找有新专业的学生
String sql6 ="select distinct c.AStudentID ,c.Name, c.AMajorName , c.ALevel,b.BMajorName,b.BLevel FROM CanChangeMajor c , MajorChange b "
+"WHERE c.AStudentID = b.BStudentID and b.BMajorName not in ( select distinct a.MajorName from studneta a where a.StudentID = c.AStudentID) ";
s.executeUpdate(sql1);
s.executeUpdate(sql2);
ResultSet result3 = s.executeQuery(sql3);
ResultSet result4 = s.executeQuery(sql4);
ResultSet result5 = s.executeQuery(sql5);
ResultSet result6 = s.executeQuery(sql6);
System.out.println("*此图表仅展示从studneta表,把没有转专业的学生补充到CanChangeMajor表中");
System.out.println("CanChangeMajor 表");
System.out.println("StudentID Name MajorName Level");
while (result3.next())
{
System.out.println(result3.getString("StudentID")+" "+result3.getString("Name")+" "+result3.getString("MajorName")+" "+ result3.getString("Level"));
ChartData chartdata3 = new ChartData();
chartdata3.setStudentID(result3.getString("StudentID"));
chartdata3.setName(result3.getString("Name"));
chartdata3.setMajor(result3.getString("MajorName"));
chartdata3.setLevel(result3.getString("Level"));
chartdataList3.add(chartdata3);
}
System.out.println("\nMajorChange 表");
System.out.println("BStudentID BName BMajorName BLevel");
while (result4.next())
{
System.out.println(result4.getString("BStudentID")+" "+result4.getString("BName")+" "+result4.getString("BMajorName")+" "+ result4.getString("BLevel"));
ChartData chartdata4 = new ChartData();
chartdata4.setStudentID(result4.getString("BStudentID"));
chartdata4.setName(result4.getString("BName"));
chartdata4.setMajor(result4.getString("BMajorName"));
chartdata4.setLevel(result4.getString("BLevel"));
chartdataList4.add(chartdata4);
}
System.out.println("\nCanChangeMajor 和 MajorChange 两个表联合后的查询结果");
System.out.println("AStudentID AName AMajorName ALevel BMajorName BLevel");
while (result5.next())
{
System.out.println(result5.getString("AStudentID")+" "+result5.getString("Name")+" "+result5.getString("AMajorName")+" "+ result5.getString("ALevel")+" "+result5.getString("BMajorName")+" "+ result5.getString("BLevel"));
ChartData chartdata5 = new ChartData();
chartdata5.setStudentID(result5.getString("AStudentID"));
chartdata5.setName(result5.getString("Name"));
chartdata5.setMajor(result5.getString("AMajorName"));
chartdata5.setLevel(result5.getString("ALevel"));
chartdataList5.add(chartdata5);
}
System.out.println("\n课查询CanChangeMajor 和 MajorChange 两个表关联查询,学生有新专业时的结果");
System.out.println("AStudentID AName AMajorName ALevel BMajorName BLevel");
while (result6.next())
{
System.out.println(result6.getString("AStudentID")+" "+result6.getString("Name")+" "+result6.getString("AMajorName")+" "+ result6.getString("ALevel")+" "+result6.getString("BMajorName")+" "+ result6.getString("BLevel"));
ChartData chartdata6 = new ChartData();
chartdata6.setStudentID(result6.getString("AStudentID"));
chartdata6.setName(result6.getString("Name"));
chartdata6.setMajor(result6.getString("AMajorName"));
chartdata6.setLevel(result6.getString("ALevel"));
dataList6.add(chartdata6);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
总结:以上是编辑:【梅】整理及AI智能原创关于《不能转专业的学生
》优质内容解答希望能帮助到您。