随机从1到100000中间随机取出100个不同的质数,然后按从小到大的顺序排列
public class IsPrime { //工具类 // 输入一个数,判断是否为质数,费时方法 public static Integer isPrime(int num) { if (num == 0 || num == 1) return -1; for (int i = 2; i < num - 1; i++) { if (num % i == 0) return -1; } return num; }}// 一个大于1的自然数,除了1和它自身外,不能被其他自然数整除的数叫做质数;否则称为合数。 List
public int JumpFloor(int target) { if (target == 1){ return 1; }else if(target == 2){ return 2; } else { return JumpFloor(target-1)+JumpFloor(target-2); } }
用JSON格式描述下面表格的数据学号
姓名
性别
年龄
1001
张三
男
20
1002
李四
女
22
1003
王五
男
18
// json数组// static String json = "[// {'学号':'1001','姓名':张三,'性别':男,'姓名':26,'年龄':20},// {'学号':'1002','姓名':李四,'性别':女,'姓名':26,'年龄':22},// {'学号':'1003','姓名':王五,'性别':男,'姓名':26,'年龄':18},// ]";
已知两张表完成如下SQL语句:学生基本信息:StudentID NUMBER 学号NAME VARCHAr2(10) 姓名SEX VARCHAr2(2) 性别:男女CLASS VARCHAr2(2) 班级:1,2,3,4AGE NUMBER 年龄SUBJECT VARCHAr2(10) 最高分课程SCORE NUMBER 最高成绩学生考试成绩:ScoreID NUMBER 学号SUBJECT VARCHAr2(10) 课程YEAR NUMBER 考试年份SCORE NUMBER 成绩SET NAMES utf8mb4;SET FOREIGN_KEY_CHECKS = 0;-- ------------------------------ Table structure for student-- ----------------------------DROp TABLE IF EXISTS `student`;CREATE TABLE `student` ( `ID` int(10) NOT NULL COMMENT '学号', `NAME` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名', `SEX` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '性别:男女', `CLASS` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '班级:1,2,3,4', `AGE` int(11) NULL DEFAULT NULL COMMENT '年龄', `SUBJECT` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最高分课程', `SCORE` int(10) NULL DEFAULT NULL COMMENT '最高成绩', PRIMARY KEY (`ID`) USING BTREE) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;-- ------------------------------ Records of student-- ----------------------------INSERT INTO `student` VALUES (1, '张三', '男', '1', 18, '语文', 90);INSERT INTO `student` VALUES (2, '李四', '男', '2', 18, '语文', 100);INSERT INTO `student` VALUES (3, '王五', '男', '2', 18, '语文', 90);INSERT INTO `student` VALUES (4, '丽丽', '女', '1', 18, '英语', 90);SET FOREIGN_KEY_CHECKS = 1;SET NAMES utf8mb4;SET FOREIGN_KEY_CHECKS = 0;-- ------------------------------ Table structure for score-- ----------------------------DROP TABLE IF EXISTS `score`;CREATE TABLE `score` ( `ID` int(10) NULL DEFAULT NULL COMMENT '学号', `SUBJECT` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '课程', `YEAR` int(255) NULL DEFAULT NULL COMMENT '考试年份', `SCORE` int(255) NULL DEFAULT NULL COMMENT '成绩') ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;-- ------------------------------ Records of score-- ----------------------------INSERT INTO `score` VALUES (1, '语文', 2021, 80);INSERT INTO `score` VALUES (1, '数学', 2021, 90);INSERT INTO `score` VALUES (1, '英语', 2021, 70);INSERT INTO `score` VALUES (2, '语文', 2021, 100);INSERT INTO `score` VALUES (2, '数学', 2021, 70);INSERT INTO `score` VALUES (4, '英语', 2021, 23);INSERT INTO `score` VALUES (3, '语文', 2021, 80);INSERT INTO `score` VALUES (3, '数学', 2021, 12);INSERT INTO `score` VALUES (3, '英语', 2021, 90);INSERT INTO `score` VALUES (4, '语文', 2021, 90);INSERT INTO `score` VALUES (4, '数学', 2021, 45);INSERT INTO `score` VALUES (2, '语文', 2012, 50);INSERT INTO `score` VALUES (2, '数学', 2012, 20);INSERT INTO `score` VALUES (2, '英语', 2012, 30);SET FOREIGN_KEY_CHECKS = 1;
-- 列出2012年1班各科成绩的平均值。
SELECT AVG( sc.SCORE ) AS '平均成绩', sc.YEAR AS '年份', st.CLASS AS '班级', sc.SUBJECT AS '课程' FROM score sc LEFT JOIN student st ON sc.ID = st.ID WHERe sc.YEAR = 2021 AND st.CLASS = 1 GROUP BY sc.SUBJECT
-- 列出2012年2班数学成绩不及格的学生人员列表。
SELECt st.`NAME` AS '姓名', sc.YEAR AS '年份', st.CLASS AS '班级', sc.SUBJECT AS '课程', sc.SCORE AS '成绩' FROM score sc LEFT JOIN student st ON sc.ID = st.ID WHERe sc.YEAR = 2012 AND st.CLASS = 2 AND sc.SUBJECT = '数学' AND sc.SCORE < 60
-- 查出每位同学成绩所有成绩中分数最高的科目、成绩并更新到学生基本信息中最高分课程和最高成绩字段中。
UPDATe student AS AINNER JOIN (SELECT MAX( sc.SCORE ) AS maxscore, sc.ID AS maxid, sc.`SUBJECT` maxsub FROM score sc LEFT JOIN student st ON sc.ID = st.ID GROUP BY sc.ID ) AS B ON A.ID = B.maxid SET A.ID = B.maxid, A.SUBJECT = B.maxsub, A.score = B.maxscore