标签:01 Java no employees 9999 文档 date array 考试
一、笔试题部分
一、Mysql笔试题
列名 |
数据类型 |
长度 |
是否为空 |
备注 |
emp_no |
int |
11 |
否 |
ID,主键,自增 |
birth_date |
datetime |
|
是 |
生日 |
first_name |
varchar |
14 |
是 |
姓氏 |
last_name |
varchar |
16 |
是 |
名字 |
gender |
char |
1 |
是 |
性别 |
hire_date |
datetime |
|
是 |
入职日期 |
1.按照上述表用sql语句创建数据库company,创建表employees
create database `company`;
use `company`;
create table `employees`(`emp_no` int(11) not null primary key auto_increment comment 'ID,主键,自增',`birth_date` datetime comment '生日',`first_name` varchar(14) comment '姓氏',`last_name` varchar(16) comment '名字',`gender` char(1) comment '性别',`hire_date` datetime comment '入职日期');
列名 |
数据类型 |
长度 |
是否为空 |
备注 |
emp_no |
int |
11 |
否 |
员工ID,外键 |
dept_no |
int |
11 |
否 |
部门ID,主键,自增 |
from_date |
datetime |
|
是 |
入职日期 |
to_date |
datetime |
|
是 |
离职日期 |
2.创建表department部门表
create table `department`(`emp_no` int(11) not null comment '员工ID,外键',`dept_no` int(11) primary key auto_increment comment '部门ID,主键,自增',`from_date` datetime comment '入职日期',`to_date` datetime comment '离职日期',foreign key(emp_no) references employees(`emp_no`));
10001 |
1953-09-29 |
Georgi |
Facello |
M |
1986-06-26 |
10002 |
1964-06-02 |
Bezalel |
Simmel |
F |
1985-11-21 |
10003 |
1959-12-03 |
Parto |
Bamford |
M |
1986-08-28 |
10004 |
1954-05-01 |
Christian |
Koblick |
M |
1986-12-01 |
10005 |
1955-01-21 |
Kyoichi |
Maliniak |
M |
1989-09-12 |
10006 |
1958-02-09 |
Saniya |
Kalloufi |
M |
1994-09-15 |
3.插入测试数据到employees表
insert into `employees` values('10001','1953-09-29','Georgi','Facello','M','1986-06-26'),('10002','1964-06-02','Bezalel','Simmel','F','1985-11-21'),('10003','1959-12-03','Parto','Bamford','M','1986-08-28'),('10004','1954-05-01','Christian','Koblick','M','1986-12-01'),('10005','1955-01-21','Kyoichi','Maliniak','M','1989-09-12'),('10006','1958-02-09','Saniya','Kalloufi','M','1994-09-15');
emp_no |
dept_no |
from_date |
to_date |
10001 |
10001 |
1986-06-26 |
9999-01-01 |
10002 |
10002 |
1985-11-12 |
9999-01-01 |
10003 |
10003 |
1986-07-07 |
9999-01-01 |
10004 |
10004 |
1987-01-09 |
9999-01-01 |
10005 |
10005 |
1988-02-14 |
9999-01-01 |
10006 |
10006 |
1988-06-14 |
9999-01-01 |
4.插入测试数据到department表
insert into `department` values('10001','10001','1986-06-26','9999-01-01'),('10002','10002','1985-11-12','9999-01-01'),('10003','10003','1986-07-07','9999-01-01'),('10004','10004','1987-01-09','9999-01-01'),('10005','10005','1988-02-14','9999-01-01'),('10006','10006','1988-06-14','9999-01-01');
5.查询employees表里最晚入职员工的所有信息
select * from employees order by hire_date desc limit 1;
4.查找employees里入职员工时间排名倒数第三的员工所有信息
select * from employees order by hire_date desc limit 2,1;
6.请你查找两表,所有已经分配部门的员工的last_name和first_name以及dept_no,未分配的部门的员工不显示
select last_name,first_name,department.dept_no from employees,department where employees.emp_no = department.emp_no;
7.用联接查询两表,以部门表为主表,员工表为从表,查找所有员工的last_name和first_name以及对应的dept_no
select last_name,first_name,dept_no from employees inner join department on employees.emp_no = department.emp_no;
8.统计employees表里性别男、女人数,显示性别、人数字段
select gender,count(*) from employees group by gender;
9.将department表里所有to_date为9999-01-01的全部更新为NULL
update department set `to_date` = 'NULL' where `to_date` = '9999-01-01';
10.分页查询employees表,每5行一页,返回第2页的数据
select * from employees limit 5,5;
二、Java笔试题部分
1.编写自定义异常流程
定义一个类继承于Exception
在方法名后声明
在方法体里抛出
2.请写出调试代码的步骤
打断点
dbug
一步一步的步进
3.编写一个九九乘法表(手写代码)
for (int i = 1; i <= 9; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(j + "x" + i + "=" + j * i+"\t");
}
System.out.println();
}
4.写出五个常见的运行时异常,并说明是什么异常
NullPointerException空指针异常
ArrayStoreException数组越界异常
ArithmeticException算术异常
ClassCastException类型转换异常
NumberFormatException数字格式不正确异常
二、机试题部分
一、Java部分
编写一个冒泡排序代码
//升序
for (int i = 0; i < array.length - 1; i++) {
for (int j = 0; j < array.length - i - 1; j++) {
if (array[j] > array[j + 1]) {
int temp = array[j];
array[j] = array[j + 1];
array[j + 1] = temp;
}
}
}
//降序
for (int i = 0; i < array.length - 1; i++) {
for (int j = 0; j < array.length - i - 1; j++) {
if (array[j] < array[j + 1]) {
int temp = array[j];
array[j] = array[j + 1];
array[j + 1] = temp;
}
}
}
二、Html部分
请按照下列图片效果编写HTML和CSS代码
特别说明:图标可以不按上图显示一模一样,引入其它图标代替也可以
https://www.bootcss.com/p/font-awesome/# Font Awesome免费图标
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>list</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/list.css" type="text/css" />
</head>
<body>
<section class="after">
<div class="concent">
</div>
<ul class="after">
<li>
<i class="icon-home"></i>
<p><a href="#">进口食品</a>、<a href="#">生鲜</a></p>
<i class="icon-angle-right"></i>
</li>
<li>
<i class="icon-beer"></i>
<p><a href="#">食品</a>、<a href="#">饮料</a>、<a href="#">酒</a></p>
<i class="icon-angle-right"></i>
</li>
<li>
<i class="icon-medkit"></i>
<p><a href="#">母婴</a>、<a href="#">玩具</a>、<a href="#">童装</a></p>
<i class="icon-angle-right"></i>
</li>
<li>
<i class="icon-truck"></i>
<p><a href="#">家居</a>、<a href="#">家庭清洁</a>、<a href="#">纸</a></p>
<i class="icon-angle-right"></i>
</li>
<li>
<i class="icon-magic"></i>
<p><a href="#">美妆 </a>、<a href="#">个人护理</a>、<a href="#">洗护</a></p>
<i class="icon-angle-right"></i>
</li>
<li>
<i class="icon-user"></i>
<p><a href="#">女装 </a>、<a href="#">内衣</a>、<a href="#">中老年</a></p>
<i class="icon-angle-right"></i>
</li>
<li>
<i class="icon-briefcase"></i>
<p><a href="#">鞋靴 </a>、<a href="#">箱包</a>、<a href="#">腕表配饰</a></p>
<i class="icon-angle-right"></i>
</li>
<li>
<i class="icon-umbrella"></i>
<p><a href="#">男装 </a>、<a href="#">运动</a></p>
<i class="icon-angle-right"></i>
</li>
<li>
<i class="icon-laptop"></i>
<p><a href="#">手机 </a>、<a href="#">小家电</a>、<a href="#">电脑</a></p>
<i class="icon-angle-right"></i>
</li>
<li>
<i class="icon-credit-card"></i>
<p><a href="#">礼品 </a>、<a href="#">充值</a></p>
<i class="icon-angle-right"></i>
</li>
</ul>
</section>
</body>
</html>
* {
margin: 0;
padding: 0;
}
body {
width: 260px;
margin: 20px auto;
}
section {
padding: 30px;
background-color: #b11d1d;
}
.after::after {
content: '';
display: block;
clear: both;
}
a,
p,
.icon-angle-right {
color: #fff;
}
.icon-home,
.icon-beer,
.icon-medkit,
.icon-truck,
.icon-magic,
.icon-user,
.icon-briefcase,
.icon-umbrella,
.icon-laptop,
.icon-credit-card {
font-size: 20px;
float: left;
position: relative;
top: 12px;
right: 10px;
color: #f88074;
}
.icon-angle-right {
float: right;
position: relative;
bottom: 28px;
right: 2px;
}
a {
text-decoration: none;
}
li {
position: relative;
list-style: none;
line-height: 40px;
}
.concent {
float: left;
position: absolute;
top: 65px;
left: 625px;
width: 265px;
height: 370px;
border: 5px solid #cd0507;
box-shadow: 0px 0px 10px black inset
}
标签:01,
Java,
no,
employees,
9999,
文档,
date,
array,
考试
From: https://www.cnblogs.com/ynxiyan/p/17090396.html