数据库
文章平均质量分 86
怪盗基德007
这个作者很懒,什么都没留下…
展开
-
工具篇:mysql(二)——数据的导出导入
把select查询结果导出到文件中mysqldump -h dbHost -u userName -ppassword dbName tableName --where="where-clause" > /path/to/table.sqlmysql -hhostName -uuserName -ppassword -e "select * from db.table" > ...原创 2019-04-19 15:40:58 · 813 阅读 · 0 评论 -
工具篇:mysql(四)——sql
一、update当update table时,如果数据来自与其他表的关联,那么使用inner joinupdate tableA a inner join tableB b on a.id=b.aid and b.name = 'tom' set a.date=b.date where a.id = 5;...原创 2019-11-07 14:48:46 · 159 阅读 · 0 评论 -
工具篇:mysql(五)——查询中的and和or
在sql查询中and与or混合使用时,or的优先级低于and,即or前面的多个and条件相当于带有括号,or后面的多个and条件也相当于带有括号,or前后的条件是并列关系。如果需要单个条件的或,那么需要使用括号改变优先级。比如对于如下表create table test(id bigint not null auto_increment primary key,name varchar(30) not null default '',gender tinyint not null def原创 2020-12-26 13:21:18 · 1032 阅读 · 0 评论 -
数据库——mvcc
一、基本概念mvcc是multi-version concurrency control(多版本并发控制)的英文缩写,它是应用程序并发读写数据库时,提供高性能的一种并发控制方式,相当于一种数据库乐观锁的实现方式。这里的多版本是指当多个事务对同一数据进行读写时,该数据会存在多条拷贝,即多个版本,而每个事务只能看到其中的某个合理的版本号数据。二、适用范围mvcc适用于数据库两种事务隔离级别,即读已提交和可重复读。另外两种事务隔离界别,读未提交,由于可以读取到其他事务的未提交数据,所以不需要做版...原创 2020-05-29 19:17:16 · 432 阅读 · 0 评论 -
工具篇:mysql
一、启动1. windows控制面板-〉管理工具-〉服务找到mysql,点击启动2. linux/mac登陆本地:mysql –u root –p登陆远程:mysql –h hostname –P port –u username -p退出:exit/quit二.命令mysql中命令都以分号结束数据类型varchar:字符型int:整数型date...原创 2018-10-24 17:34:16 · 245 阅读 · 1 评论 -
工具篇:mysql(一)——key
1. primary key表的主键,同时会建立索引。mysql中每张table最多有一个primary key,也可以没有。primary key可以包含一个column,也可以包含多个column。当包含多个column时,这些column的组合必须在table中唯一。2. unique key唯一键,可以定义多个,也可以不定义。一个unique key可以包含一个col...原创 2019-04-16 14:11:22 · 2513 阅读 · 1 评论 -
工具篇:hbase
hbase中没有关系型数据库中库的概念,表、列都要用单引号扩起来。hbase shell 进入hbase shellversion:查询版本号desc 'tableName' 或describle 'tableName' 查询表结构count 'tableName' 查询表中数据量scan 'tableName' 全表扫描,显示全表数据scan 'table...原创 2019-05-09 10:44:36 · 150 阅读 · 0 评论 -
工具篇:mysql(三)——修改表结构
一、创建表-- 创建表testcreate table test(id int not null default 0 primary key,name varchar(30) not null default '',age tinyint not null default 0);-- 修改表名rename table test to test1;二、列的修改...原创 2019-09-25 14:47:51 · 241 阅读 · 0 评论