实习面试笔记

11次阅读

共计 2173 个字符,预计需要花费 6 分钟才能阅读完成。

项目经历
数据库

数据库事务 (Transaction) 的 ACID 特性
原子性(Atomicity), 一致性(Consistency), 隔离型(Isolation), 持久性(Durability)

原子性 (A) 是指事务中的操作不可拆分,只允许全部执行或者全部不执行
一致性 (C) 指事务的执行不能破坏数据库的一致性,一致性也称为完整性。一个事务在执行后,数据库必须从一个一致性状态转变为另一个一致性状态
隔离性 (I) 指并发的事务相互隔离,不能互相干扰
持久性 (D) 指事务一旦提交,对数据的状态变更应该被永久保存

数据库事务隔离级别有 4 个
# 由低到高依次为
Read uncommitted, 读到了未提交的事物, 只是 add 还没有 commit
Read committed, 读到了上一次的 commit, 也就是说还没有更新 最新的 commit
Repeatable read, 保证读取最新的 commit, 为此, 读取的时候不允许提交
Serializable, 要求有很高的实时同步性
# 这四个级别可以逐个解决脏读、不可重复读、幻读 这几类问题

锁(并发控制的手段)
关系数据模型的三个组成部分数据结构, 对数据的操作, 完整性约束

参考链接数据库事务、隔离级别、锁的理解与整理

SQL

CRUDCreate, Read, Update, and Delete

过程
1. 首先连接到数据库
conn = sqlite.connect(‘test.db’)
2. 建立游标 cursor
cursor = conn.cursor()
3. 建立表
create table user (id int, name varchar(20), score int )
4.insert into 插入数据,注意占位符是 ?
insert into user (id, name) values(1, “Alice”, 88)
insert into user (id, name) values(2, “Bob”, 89)
insert into user (id, name) values(3, “Cindy”, 88)
5.select * from user where 查找数据
select * from user where id between 1 and 3 order by score asc
6.cursor.close()
7.conn.commit()
8.conn.close()

column, 列, 字段
select * from user
select col1, col2 from user

下面以这个表格 customers 为例, 展示 SQL 的语法

id
name
age
city
postalcode
country

1
Alfreds
25
Berlin
12209
Germany

2
Ana
15
Mexico
05021
Mexico

3
Antonio
20
Mexico
05023
Mexico

4
Thomas
30
London
WA11DP
UK

5
Berglunds
35
Lulea
S-958-22
Sweden

where 条件选择
select * from customers where country=’Germany’ and city=’Berlin’

order by 排序
select * from customers order by country

插入
insert into customers (name, age, city, postalcode, country) values (‘Bart’, 10, ‘LA’, ‘4006’, ‘USA’)

更新
update customers set name = ‘Smith’, city = ‘Paris’ where id = 5

删除
delete from customers where name = ‘Berglunds’

limit/top 不返回全部结果, 只返回有限数量的记录
# SQL
select top 3 from customers
# MySQL
select * from customers limit 3

最大最小值
select min(age) from customers

统计 count, distinct
# 统计有多少个不同的国家
select count(distinct country) from customers

平均值
select avg(age) from customers

求和
select sum(age) from customers

通配符
# SQL
select * from customers where name like ‘B%’
# sqlite
select * from customers where name like ‘B*’

选择范围
# 离散
select * from customers where country in (‘Germany’, ‘France’)
# 连续
select * from customers where age between 10 and 20

连接表格
inner join, (A ∩ B)
left join, (A ∩ B) U A
right join, (A ∩ B) U B
full outer join, (A U B)

参考资料

Java

基本数据类型
抽象类跟接口的区别只说我知道接口只定义函数的声明,而抽象类的函数可以有具体实现。然后他问我一个类能实现多少接口,一个类能继承多少个抽象类,我这才想起来原来这也是一个区别。。。

开发模型 MVC

多线程
错误和异常
垃圾回收机制

前端

选择器 getElementByName

正则表达式
ajax 参数

数据结构

排序

复杂度
稳定性
实现代码

Fib

其他
牛客网面试经历 (视频面试)

正文完
 0