2、【MySQL数据库】- 数据库简单练习题目和答案
在下图这些表中操作
customer 客户表
goods 商品表
orders 订单表
请使用easyshopping数据库,完成以下查询语句的编写:
1. 查询orders表中所有订单日期(ordersDate)大于2015-1--1的订单。
select ordersDate from orders where ordersDate>2015-1-1;
2. 查询orders表中数量(amount)不为空的数据。
select amount from orders where amount is not Null;
3. 查询goods表中价格(unitPrice)位于100-300之间的商品数据,并按工资降序排列。
select unitPrice from goods where unitPrice BETWEEN 100 and 300 order by unitPrice desc;
4. 查询customer表中刘一鸣的信息。
select * from customer where cName like '刘一鸣';
5. 查询customer表中地址为“北京”、“上海”的顾客信息。
select * from customer where city in('北京','上海');
1、【Java基础】-Java基础练习题目与答案(数组的应用)
题目 | 学校Java课程对同学进行抽检评测,评测分为两个部分:理论部分以及机试部分,最终评测成绩=理论成绩×0.3+机试成绩×0.7,要求输入5位学生的理论成绩和实操成绩,计算并输出各位学生的最终评测成绩。 |
运行效果 | |
答案:
package cn.com.mstanford.lotterysystem;
import java.util.Scanner;
public class ExamDemo {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// 定义数组存储学生理论成绩
int[] writenExam = new int[5];
// 定义数组存储学生机试成绩
int[] labExam = new int[5];
// 定义数组存储学生最终评测成绩
double[] scores = new double[5];
// 接收用户输入的理论成绩和机试成绩
for (int i = 0; i < writenExam.length; i++) {
System.out.printf(" 第 %d 位学生评测分数:\n", i + 1);
System.out.print(" 理论成绩:");
writenExam[i] = sc.nextInt();
System.out.print(" 机试成绩:");
labExam[i] = sc.nextInt();
}
// 计算学生最终评测成绩
for (int i = 0; i < scores.length; i++) {
scores[i] = writenExam[i] * 0.3 + labExam[i] * 0.7;
}
// 显示最终评测得分
System.out.println(" 最终评测成绩:");
for (double item : scores) {
System.out.printf("%.2f\n",item);
}
}
}