![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据库
天然居
这个作者很懒,什么都没留下…
展开
-
MySQL行级锁、表级锁、页级锁详细介绍
页级:引擎 BDB。表级:引擎 MyISAM , 理解为锁住整个表,可以同时读,写不行行级:引擎 INNODB , 单独的一行记录加锁表级,直接锁定整张表,在你锁定期间,其它进程无法对该表进行写操作。如果你是写锁,则其它进程则读也不允许行级,,仅对指定的记录进行加锁,这样其它进程还是可以对同一个表中的其它记录进行操作。页级,表级锁速度快,但冲突多,行级冲突少,但速度慢。所以转载 2014-12-19 19:07:16 · 445 阅读 · 0 评论 -
MySQL存储引擎MyISAM与Innodb的那些事
MyISAM与Innodb是MySQL中两个常用的数据库存储引擎。MySQL默认的存储引擎是MyISAM,Innodb是后来推出的一个存储引擎,支持MVCC模式的读写。下面就对两种数据库存储引擎简单介绍。索引MySQL两种存储引擎MyISAM与Innod在不同的场景两种存储引擎会有不同的效率。其中MyISAM读的效率是优于Innodb的,这和MyISAM的存储数据的数据结构有关。虽转载 2014-12-19 19:10:50 · 503 阅读 · 0 评论 -
LeetCode | Customers Who Never Order
Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything.Table: Customers.+----+-------+| Id | Na原创 2015-02-08 11:26:03 · 492 阅读 · 0 评论 -
LeetCode | Consecutive Numbers
Write a SQL query to find all numbers that appear at least three times consecutively.+----+-----+| Id | Num |+----+-----+| 1 | 1 || 2 | 1 || 3 | 1 || 4 | 2 || 5 | 1 || 6 | 2原创 2015-01-20 22:09:37 · 638 阅读 · 0 评论 -
LeetCode | Rank Scores
Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking number should be the next consecutive integer value.原创 2015-01-20 10:56:58 · 553 阅读 · 0 评论 -
LeetCode | Second Highest Salary & Nth highest salary
Write a SQL query to get the second highest salary from the Employee table.+----+--------+| Id | Salary |+----+--------+| 1 | 100 || 2 | 200 || 3 | 300 |+----+--------+For exa原创 2015-01-19 11:36:28 · 1275 阅读 · 0 评论 -
MySQL不插入重复记录
想插入一条记录,如果有则不插入,无则插入。表示由一个自增长id主键和其他几个记录: t_version(id,package_name, first,SECOND,third,forth)原先想用insert ignore into,但是发现没有用,因为它把id也看做不同。于是我找了网上的另外一种方法 insert … select … where not exist。insert原创 2015-04-16 19:03:17 · 809 阅读 · 0 评论 -
MySQL执行SQL文件乱码
登陆测试数据库的服务器,进入MySQL后,执行source update_units.sql命令,在测试服务器用命令查看没有乱码,但是在本地客户端连接测试数据库查看为乱码,一开始排除文件编码问题,Linux下用file update_units.sql查看编码。也查看数据库的编码类型,最后定位为执行source命令出现了问题。mysql -u root -p --default-charact原创 2015-08-19 17:53:07 · 1410 阅读 · 2 评论 -
Cassandra学习笔记
CAP:CAP理论在互联网界有着广泛的知名度,知识稍微宽泛一点的工程师都会把其作为衡量系统设计的准则。大家都非常清楚地理解了CAP:任何分布式系统在可用性、一致性、分区容错性方面,不能兼得,最多只能得其二,因此,任何分布式系统的设计只是在三者中的不同取舍而已。C(一致性):所有的节点上的数据时刻保持同步。等同于所有节点访问同一份最新的数据副本A(可用性):每个请求都能接受到一个原创 2016-04-14 16:54:53 · 736 阅读 · 0 评论