项目经历数据库数据库事务(Transaction)的 ACID 特性原子性(Atomicity), 一致性(Consistency), 隔离型(Isolation), 持久性(Durability)原子性(A)是指事务中的操作不可拆分,只允许全部执行或者全部不执行一致性(C)指事务的执行不能破坏数据库的一致性,一致性也称为完整性。一个事务在执行后,数据库必须从一个一致性状态转变为另一个一致性状态隔离性(I)指并发的事务相互隔离,不能互相干扰持久性(D)指事务一旦提交,对数据的状态变更应该被永久保存数据库事务隔离级别有4个# 由低到高依次为Read uncommitted, 读到了未提交的事物, 只是 add 还没有 commitRead committed, 读到了上一次的commit, 也就是说还没有更新 最新的commitRepeatable read, 保证读取最新的 commit, 为此, 读取的时候不允许提交Serializable, 要求有很高的实时同步性# 这四个级别可以逐个解决脏读 、不可重复读 、幻读 这几类问题锁(并发控制的手段)关系数据模型的三个组成部分数据结构, 对数据的操作, 完整性约束参考链接数据库事务、隔离级别、锁的理解与整理SQLCRUDCreate, 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 asc6.cursor.close()7.conn.commit()8.conn.close()column, 列, 字段select * from userselect col1, col2 from user下面以这个表格 customers 为例, 展示 SQL 的语法idnameagecitypostalcodecountry1Alfreds25Berlin12209Germany2Ana15Mexico05021Mexico3Antonio20Mexico05023Mexico4Thomas30LondonWA11DPUK5Berglunds35LuleaS-958-22Swedenwhere 条件选择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 不返回全部结果, 只返回有限数量的记录# SQLselect top 3 from customers# MySQLselect * 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通配符# SQLselect * from customers where name like ‘B%’# sqliteselect * 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 Aright join, (A ∩ B) U Bfull outer join, (A U B)参考资料Java基本数据类型抽象类跟接口的区别只说我知道接口只定义函数的声明,而抽象类的函数可以有具体实现。然后他问我一个类能实现多少接口,一个类能继承多少个抽象类,我这才想起来原来这也是一个区别。。。开发模型MVC多线程错误和异常垃圾回收机制前端选择器getElementByName正则表达式ajax 参数数据结构排序复杂度稳定性实现代码Fib其他牛客网面试经历 (视频面试)