PostgreSQL简单使用体验

前言

img

相比于MySQL, 同样作为开源的关系型数据库(RDBMS), PostgreSQL(ORDBMS)的知名度远低于前者(至少在国内是如此). 但是随着MySQL被甲骨文收购(引起开源社区和其他大型存在业务竞争公司的担忧), 以及大数据的兴起, 近年PostgreSQL颇有异军突起的迹象.

阅读全文 »

MySQL-递归-日期

本文作为MySQL使用指南的延申讨论

  • 递归
  • 行列转换
  • 日期/时间处理相关函数

一. 递归

MySQL-Recursive-CTE.png

As mentioned previously, recursive common table expressions (CTEs) are frequently used for series generation and traversing hierarchical or tree-structured data.

阅读全文 »

MySQL命令行工具_mycli中文乱码解决

mycli

BlackLivesMatter

We value the diversity of our community. We strive to amplify the voices of the oppressed to eradicate racism and xenophobia. We ask our community to stand together in support of the Black community.

MyCLI is a command line interface for MySQL, MariaDB, and Percona with auto-completion and syntax highlighting.

  • Source: https://github.com/dbcli/mycli
  • Bug tracker: https://github.com/dbcli/mycli/issues
ppExzFJ.png

(注意, 可以直接输入密码)

mycli, 一款支持自动补全代码的命令工具, 支持ssh, 以及更多细节的优化, 如大量结果不会一次全部返回, 危险操作提示等.

阅读全文 »

MySQL_联合索引-分页检索

本文是作为MySQL使用指南一文的进一步细节延申和补充.

  • 分页查询
  • 联合索引
  • 回表

(由于Typora的字数超过2万速度会明显下降, 4万字已经出现卡顿, 这里将更多内容拆出来讨论).

# 创建测试的表
drop table if exists test_w;
create table test_w (
	id int UNSIGNED not null PRIMARY key auto_increment,
	grade float UNSIGNED not null,
	birth_date date not null,
	s_name varCHAR(15) not null,
	address varchar(16) not null
);
阅读全文 »

Pandas翻译系列-Indexing and selecting data

简化, 并不是逐句翻译, 只关注重点部分, 部分内容加入了自己的理解.

索引和数据选取.

The axis labeling information in pandas objects serves many purposes:

轴标签信息在pandas对象中有多个用途:

  • Identifies data (i.e. provides metadata) using known indicators, important for analysis, visualization, and interactive console display.
  • 数据的识别交互, 这非常重要在数据分析和可视化中.
  • Enables automatic and explicit data alignment.
  • 能够让数据可以显式自动对齐.
  • Allows intuitive getting and setting of subsets of the data set.
  • 能够直观明了的设置或者获取数据集中的子集.

In this section, we will focus on the final point: namely, how to slice, dice, and generally get and set subsets of pandas objects. The primary focus will be on Series and DataFrame as they have received more development attention in this area.

在这部分中, 将着重讨论最后一点, 如何对pandas的对象进行切片获取其中的部分数据(即读写操作). 这是pandas的开发优先关注的.

阅读全文 »

Pandas翻译系列-SettingWithCopyWarning - 视图 OR 副本

一. 问题的起源

在使用pandas进行处理数据时, 时不时会出现一个异常的警告(注意这不是错误)

C:\Users\Lian\AppData\Local\Temp/ipykernel_15272/2330773252.py:4: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy tmp['c'] = tmp['a'] + tmp['b']

阅读全文 »