cghtom / someTips

log4j日志级别 shell操作手册 面试 总结
0 stars 0 forks source link

总结-mysql1 #12

Open cghtom opened 7 years ago

cghtom commented 7 years ago

拼接字段 Mysql select concat(id,null,code) from cgh; select id + null from cgh; SELECT concat(id,code) from cgh;

Oracle select NULL || SEX_ID from newTable union all SELECT CONCAT(sex_id,name) FROM newTable;

总结 mysql + 和 ||(oracle) 1 ‘+’ 有 null 则为 null 2 ‘||’ 有非null 则为 该非空拼装之后的值 concat() oracle只能拼两个值 mysql可以拼多个值 导入导出数据 加表写锁 LOCK TABLES ab WRITE; INSERT INTO ab VALUES (2,3),(1,2); UNLOCK TABLES; DROP TABLE IF EXISTS articles; 数据库备份 和 远程备份 mysqldump -u root -p --no-create-info --tab=F:/AppData/sql/mysql test articles;

备份 一个表 mysqldump -u root -p database_name table_name > dump.txt mysqldump -u root -p test articles > F:/AppData/sql/mysql/dump.txt 备份 一个库 mysqldump -u root -p test > F:/AppData/sql/mysql/database_dump.txt

导出表时会 表写锁 LOCK TABLES ab WRITE; INSERT INTO ab VALUES (2,3),(1,2); UNLOCK TABLES; 备份所有的库 mysqldump -u root -p --all-databases > F:/AppData/sql/mysql/database_all_dump.txt