数据库
本频道是数据库的应用和实践专栏,公布数据库使用过程中遇到的问题,以及解决办法,本频道为免费专栏,希望能帮助到您。
MyFreeIT
Working in IT more than 19 years ,目前供職於全球最大的保險公司,管理技術和產品。曾經主導多個國家級項目,用戶覆蓋全國,至今仍在健康運行。金融軟件產品developed more than 10 years ,應用在證券、银行、保险、基金、期貨等。設計和研發的產品簡單易用,性能穩定,給客戶帶來全新的體驗,協助持續穩定的盈利。從事IT管理工作達10年之久,帶領多個部門和團隊,高效協調和有效溝通,發揮團隊的力量。創業多年,主導研發CRM BOOK系列產品,風控预警、风险對沖軟體在業内位列前茅。不斷地鍛煉邏輯思維和抽象思維能力,從而形成快速解決問題的能力。
展开
-
数据库设计-使用Auto Increase Int的优缺点
很容易被识别,只要按照递增或者递减去Try,就能很轻易的获得非法数据。原创 2024-07-03 17:27:03 · 114 阅读 · 0 评论 -
Mybatis MySQL allowMultiQueries 一次性执行多条语句
Mybatis MySQL allowMultiQueries 一次性执行多条语句原创 2024-06-21 19:38:32 · 412 阅读 · 0 评论 -
SQL ambiguous 联合查询时,必须制定别名
【代码】SQL ambiguous 联合查询时,必须制定别名。原创 2024-06-19 12:31:31 · 111 阅读 · 0 评论 -
MySQL sum后再计算percentage的多种解决办法
以下是SQL片段,在外面嵌套一个Select是因为over 不会SQL语句所有的data sum,而不是 limit 之后的数据,所以需要先limit 在over()这种方法适合简单Case,如果条件复杂时,第二个Select就会臃肿,比如 增加 时间条件、Group,Limit等。通过cross join 把total 作为一个结果集并到sum的sql,然后通过除法计算Percentage。此方法简单,分块处理,一些复杂的SQL可以考虑使用with方法处理。原创 2024-05-29 17:57:54 · 353 阅读 · 1 评论 -
mysql @value := 简单用法示例
有这么一张表,记录名字和分数,现在需要按照成绩排名,存在并列名次的情况。转载 2024-04-24 14:35:21 · 36 阅读 · 0 评论 -
MySQL recursive 递归
只适用于一个节点,而不是多个节点。,通过子节点向上查询。原创 2024-04-24 10:59:35 · 250 阅读 · 0 评论 -
MySQL 行变列
通过case when 或者Sum if 语法糖把行变成列原创 2024-03-07 20:39:59 · 511 阅读 · 0 评论 -
Mybatis 主从表有名字相同,只能查询出一条数据
Mybatis 主从表有名字相同,只能查询出一条数据。重新命名后,可以正常查询。原创 2024-03-01 16:16:57 · 417 阅读 · 0 评论 -
MySQL 行变列,去空,插入
MySQL 行变列,去空,插入。原创 2024-01-29 10:37:22 · 375 阅读 · 0 评论 -
MySQL substring_index 分割字符串
substring_index 定位是位置的左边,或者右边。而不能准确定位字符,需要做判断来返回正确的结果。对于第一个匹配的位置,可能会出现空的情况,例如;把同一個Column的字符串,通過分隔符分割后逐行插入數據庫。原创 2024-01-15 10:02:06 · 394 阅读 · 0 评论 -
MySQL && PostgreSQL截取substring
MySQL && PostgreSQL截取substring原创 2024-01-13 21:50:49 · 553 阅读 · 0 评论 -
Mybatis查詢的結果為空NULL
數據庫查詢出來的結果,不能通過xml的配置文件進行匹配,所以結果為空。比如emailSet 返回N條記錄數,但是每條記錄為NULL。儅xml文件配置的數據庫字段錯誤,返回的結果為NULL。原创 2023-12-21 19:04:03 · 373 阅读 · 0 评论 -
MySQL 内外连接,以及外连接的LEFT JOIN,Cross Join
LEFT OUTER JOIN 就是LEFT JOIN,LEFT OUTER JOIN只是个人书写习惯。原创 2023-12-20 21:17:06 · 578 阅读 · 0 评论 -
PostgreSQL manual
【代码】PostgreSQL manual。原创 2023-11-03 16:56:18 · 414 阅读 · 0 评论 -
Mysql的關鍵字或者保留字
不能用group作爲字段名。原创 2023-10-20 10:21:03 · 179 阅读 · 0 评论 -
mybatis - no getter for property,以及@JsonIgnore
user_full_name是数据库字段,不需要有get 和 set方法,显然这里是配置错误。Mybatis 配置错误,XML配置文件有Java对象以及数据库字段,配置时需要小心。@JsonIgnore 在参数映射时,不是去掉参数,而是自动赋予null。原创 2023-07-28 17:41:10 · 282 阅读 · 0 评论 -
Mybatis manual
【代码】Mybatis manual。原创 2023-07-20 17:03:42 · 134 阅读 · 0 评论 -
MySQL Client
MySQL客户端很多,自身携带的一些客户端工具也需要了解,方便快速测试。原创 2023-05-11 17:25:26 · 84 阅读 · 0 评论 -
Microsoft SQL Server manual
【代码】Microsoft SQL Server manual。原创 2022-10-20 11:05:43 · 132 阅读 · 0 评论 -
Error 1205-Microsoft SQL Server Deadlocks
Ideally, despite locks, your database system will allow a lot of users at once, and each transaction will get in, make the single change needed, and get out again; but locks inevitably mean blocking, and when transactions need to do multiple operations, th原创 2022-10-19 09:24:01 · 348 阅读 · 0 评论 -
Microsoft SQL Server Management Studio - Unable to open file
Newtonsoft.Json的版本不一致引起的问题,Microsoft SQL Server Management不能打开数据库连接原创 2022-10-03 17:34:20 · 267 阅读 · 0 评论 -
DBeaver manual
DBeaver manual原创 2022-09-30 15:15:17 · 1113 阅读 · 0 评论 -
Powerdesigner使用手冊
更改当前的DBMSDatabase - Change Current DBMS原创 2021-12-24 17:05:09 · 711 阅读 · 0 评论 -
MySQL 的SQL_MODE
select version(), @@sql_mode;1. STRICT_TRANS_TABLES2. NO_ZERO_IN_DATE3. NO_ZERO_DATE4. ERROR_FOR_DIVISION_BY_ZERO5. NO_ENGINE_SUBSTITUTION6. ONLY_FULL_GROUP_BY原创 2021-11-04 20:24:00 · 72 阅读 · 0 评论 -
MySQL Master && Slave
Binlog & 位点查询relay log show variables like '%relay%';max_relay_log_size标记 relay log 允许的最大值,如果该值为 0,则默认值为 max_binlog_size(1G);如果不为 0,则max_relay_log_size 则为最大的 relay_log 文件大小。relay_log_purge是否自动清空不再需要中继日志时。默认值为1(启用)。relay_log_recovery当 slave 从原创 2021-11-04 18:34:37 · 228 阅读 · 0 评论 -
MySQL引擎
innodb日志维护策略InnoDB 内部维护了一个 redo log ,包含了 InnoDB 数据的所有更改信息,在 InnoDB 启动时,会先检查 datafile 和 transaction log,前滚所有已提交的事务并且回滚未提交的事务。myisamxtradb...原创 2021-11-04 10:45:08 · 51 阅读 · 0 评论 -
MySQL DBlink
开启Federated引擎show engines;原创 2021-11-03 16:56:39 · 668 阅读 · 0 评论 -
Mysql 远程连接Host和权限设置
通过Navicat 客户端设置通过mysql command设置 update user set host='%' where host='127.0.0.1';原创 2021-10-21 11:25:57 · 898 阅读 · 0 评论 -
MySQL5.6 in SpringBoot升级到8.016
mvnrepository<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --><dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.26</version>原创 2021-08-27 15:20:42 · 544 阅读 · 0 评论 -
MySQL in SpringBoot,Loading class `com.mysql.jdbc.Driver‘ is deprecated
问题描述:Access denied for user 'root'@'localhost' (using password: NO)Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of.原创 2021-08-26 18:28:45 · 95 阅读 · 0 评论 -
Eclipse in Springboot-Failed to determine suitable jdbc url
问题描述:Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.Reason: Failed to determine suitable jdbc urlConsider the following: If you want an embedded database (H2, HSQL or Derby), pl...原创 2021-08-24 23:51:16 · 511 阅读 · 0 评论 -
MySQL in Springboot-SQL Error: 0, SQLState: 08001
1. Could not create connection to database server2. java.lang.NullPointerException: null com.mysql.jdbc.ConnectionImpl.getServerCharset(ConnectionImpl.java:2997)3.o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 08001 Co...原创 2021-08-24 12:36:13 · 1657 阅读 · 0 评论 -
調整內存,提高MySQL的執行效率
##虚拟内存原创 2021-06-19 23:15:49 · 142 阅读 · 0 评论 -
MySQL的SQL_MODE
TODO:详细总结MySQL各个版本中Mode的变化原因MySQL的Server SQL Modes官方ER_BAD_NULL_ERRORER_CUT_VALUE_GROUP_CONCATER_DATA_TOO_LONGER_DATETIME_FUNCTION_OVERFLOWER_DIVISION_BY_ZEROER_INVALID_ARGUMENT_FOR_LOGARITHMER_NO_DEFAULT_FOR_FIELDER_NO_DEFAULT_FOR_VIEW_FIELDER原创 2021-06-16 22:59:17 · 108 阅读 · 0 评论 -
MySQL-V5.6以后#ERROR1055 sql_mode=only_full_group_by
在sql_mode=only_full_group_by模式下不能执行Insert1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is inco原创 2021-06-16 22:48:52 · 98 阅读 · 0 评论 -
MySQL Integer display width #1681 Error
#1681 Error Integer display width is deprecated and will be removed in a future release.mysql8.0.17版本之后不支持int指定寬度,原创 2021-06-01 19:48:31 · 335 阅读 · 0 评论 -
MySQL Manual
CREATE TABLE t_tick_mt4 SELECT * FROM t_tick_hbhb;原创 2021-05-31 10:30:35 · 3075 阅读 · 2 评论 -
MySQL加密方式之更改(error 1251)
caching_sha2_password To mysql_native_passworderror 1251 [Client does not support authentication protocol requested by server; consider upgrading MySQL client]修改权限mysql> ALTER USER 'root'@'%' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER;Query OK, 0原创 2021-04-21 11:56:06 · 491 阅读 · 0 评论 -
Mysql基础命令
Mysql基础命令CMD连接重写权限mysql> flush privileges;原创 2021-04-21 11:11:24 · 83 阅读 · 0 评论 -
MySQL之ibdata1删除后恢复,Error1146
data目录的数据库文件夹下 ibd文件存储数据,frm文件存放表结构的定义,ibdata1是表空间数据,有关ibdata1的作用详见另一篇Blog,MySQL之表空间。当删除ibdata1文件后,恢复数据库的方法有两种。通过重新导入数据恢复ibdata1被删除后,再访问各表时提示,Error1146,Table doesn’t exist,如下图所示:通过重新导入备份的脚本数据方式,重新修复数据。ibdata1被删除,而各个数据库下的表文件没有被删除,在导入脚本数据时,提示如下:[Err] 18原创 2020-12-04 16:08:24 · 863 阅读 · 0 评论