-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
347 lines (325 loc) · 17.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
<!DOCTYPE html>
<html class="no-js" lang="zh-cn">
<head>
<meta name="generator" content="Hugo 0.58.3" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>TecX 编程/设计/数据/可视化</title>
<script>(function(d,e){d[e]=d[e].replace("no-js","js");})(document.documentElement,"className");</script>
<meta name="description" content="John Doe's Personal blog about everything">
<meta property="og:title" content="TecX 编程/设计/数据/可视化" />
<meta property="og:description" content="John Doe's Personal blog about everything" />
<meta property="og:type" content="website" />
<meta property="og:url" content="/" />
<meta property="og:updated_time" content="2019-10-10T00:00:00+00:00" />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="TecX 编程/设计/数据/可视化"/>
<meta name="twitter:description" content="John Doe's Personal blog about everything"/>
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//fonts.gstatic.com">
<link rel="alternate" type="application/rss+xml" href="/index.xml" title="TecX 编程/设计/数据/可视化">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700">
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="/css/custom.css">
<link rel="shortcut icon" href="/favicon.ico">
<script type="application/javascript">
var doNotTrack = false;
if (!doNotTrack) {
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-149339844-1', 'auto');
ga('send', 'pageview');
}
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
</head>
<body class="body">
<div class="container container--outer">
<header class="header">
<div class="container">
<div class="logo">
<a class="logo__link" href="/" title="TecX 编程/设计/数据/可视化" rel="home">
<div class="logo__title">TecX 编程/设计/数据/可视化</div>
<div class="logo__tagline">半分钟短技巧分享,技术博也可以很轻巧</div>
</a>
</div>
<div class="divider"></div>
</div>
</header>
<div class="wrapper flex">
<div class="primary">
<main class="main list" role="main">
<article class="list__item post">
<header class="list__header">
<h3 class="list__title post__title ">
<a href="/post/postgres_insert1/" rel="bookmark">
在Postgres中实现UPSERT UPDATE/INSERT 效果
</a>
</h3>
<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
<time class="meta__text" datetime="2019-10-10T00:00:00">October 10, 2019</time>
</div>
<div class="meta__item-categories meta__item">
<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
<span class="meta__text"><a class="meta__link" href="/categories/%e6%95%b0%e6%8d%ae%e5%ba%93" rel="category">数据库</a></span>
</div>
</div>
</header>
<div class="content list__excerpt post__content clearfix">
<p>上回我们在sqlite中达到了UPSERT UPDATE/INSERT的效果,那Postgres中该如何实现呢。</p>
</div>
</article><article class="list__item post">
<header class="list__header">
<h3 class="list__title post__title ">
<a href="/post/sqlite_insert1/" rel="bookmark">
在sqlite中实现UPSERT UPDATE/INSERT 效果
</a>
</h3>
<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
<time class="meta__text" datetime="2019-10-06T00:00:00">October 06, 2019</time>
</div>
<div class="meta__item-categories meta__item">
<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
<span class="meta__text"><a class="meta__link" href="/categories/%e6%95%b0%e6%8d%ae%e5%ba%93" rel="category">数据库</a></span>
</div>
</div>
</header>
<div class="content list__excerpt post__content clearfix">
<p>有时候我们希望在sqlite中插入新数据,又不想用到REPLACE INTO,因为它类似于DELETE和INSERT的效果,如果想达到UPSERT UPDATE/INSERT的效果,那应该怎样做呢。</p>
</div>
</article><article class="list__item post">
<header class="list__header">
<h3 class="list__title post__title ">
<a href="/post/postgres_sys2/" rel="bookmark">
在Postgres中批量将表名或字段名改为英文小写
</a>
</h3>
<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
<time class="meta__text" datetime="2019-10-05T00:00:00">October 05, 2019</time>
</div>
<div class="meta__item-categories meta__item">
<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
<span class="meta__text"><a class="meta__link" href="/categories/%e6%95%b0%e6%8d%ae%e5%ba%93" rel="category">数据库</a></span>
</div>
</div>
</header>
<div class="content list__excerpt post__content clearfix">
<p>有时候为了方便处理我们需要将数据库中所有表格的表名统一成小写形式,或者某张表格中所有字段名改为小写,这里可以通过命令生成的方式变相地来实现</p>
</div>
</article><article class="list__item post">
<header class="list__header">
<h3 class="list__title post__title ">
<a href="/post/postgres_sys1/" rel="bookmark">
在Postgres中查询数据库的所有表或表中的所有字段
</a>
</h3>
<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
<time class="meta__text" datetime="2019-10-05T00:00:00">October 05, 2019</time>
</div>
<div class="meta__item-categories meta__item">
<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
<span class="meta__text"><a class="meta__link" href="/categories/%e6%95%b0%e6%8d%ae%e5%ba%93" rel="category">数据库</a></span>
</div>
</div>
</header>
<div class="content list__excerpt post__content clearfix">
<p>有时候我们需要将数据库中所有表格的信息,或者某张表格中所有字段的信息转化为查询结果,可以使用如下方法查询</p>
</div>
</article><article class="list__item post">
<header class="list__header">
<h3 class="list__title post__title ">
<a href="/post/postgres_doc1/" rel="bookmark">
使用copy命令通过命令行导入导出Postgres的数据
</a>
</h3>
<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
<time class="meta__text" datetime="2019-10-04T00:00:00">October 04, 2019</time>
</div>
<div class="meta__item-categories meta__item">
<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
<span class="meta__text"><a class="meta__link" href="/categories/%e6%95%b0%e6%8d%ae%e5%ba%93" rel="category">数据库</a></span>
</div>
</div>
</header>
<div class="content list__excerpt post__content clearfix">
<p>使用copy命令可以方便的在命令行中导入导出数据,实现两者的相互转换,相比其他方式效率和速度都有很大的优势。</p>
</div>
</article><article class="list__item post">
<header class="list__header">
<h3 class="list__title post__title ">
<a href="/post/sqlite_sys1/" rel="bookmark">
在sqlite中查询数据库的所有表或表中的所有字段
</a>
</h3>
<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
<time class="meta__text" datetime="2019-10-04T00:00:00">October 04, 2019</time>
</div>
<div class="meta__item-categories meta__item">
<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
<span class="meta__text"><a class="meta__link" href="/categories/%e6%95%b0%e6%8d%ae%e5%ba%93" rel="category">数据库</a></span>
</div>
</div>
</header>
<div class="content list__excerpt post__content clearfix">
<p>有时候我们需要将数据库中所有表格的信息,或者某张表格中所有字段的信息转化为查询结果,可以使用如下方法查询</p>
</div>
</article><article class="list__item post">
<header class="list__header">
<h3 class="list__title post__title ">
<a href="/post/sqlite_sys2/" rel="bookmark">
在sqlit中生成数字序列
</a>
</h3>
<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
<time class="meta__text" datetime="2019-10-04T00:00:00">October 04, 2019</time>
</div>
<div class="meta__item-categories meta__item">
<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
<span class="meta__text"><a class="meta__link" href="/categories/%e6%95%b0%e6%8d%ae%e5%ba%93" rel="category">数据库</a></span>
</div>
</div>
</header>
<div class="content list__excerpt post__content clearfix">
<p>利用CTE中的递归写法可以方便的sqlite中生成数字序列</p>
</div>
</article><article class="list__item post">
<header class="list__header">
<h3 class="list__title post__title ">
<a href="/post/mongodb_path/" rel="bookmark">
如何在mac/linux中修改mongodb的文件位置
</a>
</h3>
<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
<time class="meta__text" datetime="2019-10-04T00:00:00">October 04, 2019</time>
</div>
<div class="meta__item-categories meta__item">
<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
<span class="meta__text"><a class="meta__link" href="/categories/%e6%95%b0%e6%8d%ae%e5%ba%93" rel="category">数据库</a></span>
</div>
</div>
</header>
<div class="content list__excerpt post__content clearfix">
<p>通常数据库会占用大量的硬盘资源,如果希望移动mongodb可以先关闭数据库,将数据库文件夹从缺省的<code>/data/db</code>移动到新的位置,比如<code>/usr/local/mongodb-data</code>,然后运行</p>
</div>
</article><article class="list__item post">
<header class="list__header">
<h3 class="list__title post__title ">
<a href="/post/sqlite_time2/" rel="bookmark">
在sqlite中查询固定时间段的数据
</a>
</h3>
<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
<time class="meta__text" datetime="2019-10-03T00:00:00">October 03, 2019</time>
</div>
<div class="meta__item-categories meta__item">
<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
<span class="meta__text"><a class="meta__link" href="/categories/%e6%95%b0%e6%8d%ae%e5%ba%93" rel="category">数据库</a></span>
</div>
</div>
</header>
<div class="content list__excerpt post__content clearfix">
<p>固定时间段的查询是非常常用的功能,这里介绍几个sqlite中的语句。</p>
</div>
</article><article class="list__item post">
<header class="list__header">
<h3 class="list__title post__title ">
<a href="/post/sqlite_time1/" rel="bookmark">
将sqlite时间戳精确到毫秒
</a>
</h3>
<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
<time class="meta__text" datetime="2019-10-03T00:00:00">October 03, 2019</time>
</div>
<div class="meta__item-categories meta__item">
<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
<span class="meta__text"><a class="meta__link" href="/categories/%e6%95%b0%e6%8d%ae%e5%ba%93" rel="category">数据库</a></span>
</div>
</div>
</header>
<div class="content list__excerpt post__content clearfix">
<p>sqlite默认的时间戳10位,并不支持直接生成13位的毫秒级时间戳,使用拼接的方法可以实现。</p>
</div>
</article>
</main>
<div class="pagination">
<span class="pagination__item pagination__item--current">1/2</span>
<a class="pagination__item pagination__item--next btn" href="/page/2/">»</a>
</div>
</div>
<aside class="sidebar">
<div class="widget-recent widget">
<h4 class="widget__title">近期文章</h4>
<div class="widget__content">
<ul class="widget__list">
<li class="widget__item"><a class="widget__link" href="/post/postgres_insert1/">在Postgres中实现UPSERT UPDATE/INSERT 效果</a></li>
<li class="widget__item"><a class="widget__link" href="/post/sqlite_insert1/">在sqlite中实现UPSERT UPDATE/INSERT 效果</a></li>
<li class="widget__item"><a class="widget__link" href="/post/postgres_sys2/">在Postgres中批量将表名或字段名改为英文小写</a></li>
<li class="widget__item"><a class="widget__link" href="/post/postgres_sys1/">在Postgres中查询数据库的所有表或表中的所有字段</a></li>
<li class="widget__item"><a class="widget__link" href="/post/postgres_doc1/">使用copy命令通过命令行导入导出Postgres的数据</a></li>
</ul>
</div>
</div>
<div class="widget-categories widget">
<h4 class="widget__title">分类</h4>
<div class="widget__content">
<ul class="widget__list">
<li class="widget__item"><a class="widget__link" href="/categories/%e6%95%b0%e6%8d%ae%e5%ba%93">数据库</a></li>
<li class="widget__item"><a class="widget__link" href="/categories/%e7%b3%bb%e7%bb%9f">系统</a></li>
</ul>
</div>
</div>
<div class="widget-taglist widget">
<h4 class="widget__title">标签</h4>
<div class="widget__content">
<a class="widget-taglist__link widget__link btn" href="/tags/crud" title="Crud">Crud</a>
<a class="widget-taglist__link widget__link btn" href="/tags/imagemagick" title="Imagemagick">Imagemagick</a>
<a class="widget-taglist__link widget__link btn" href="/tags/mac" title="Mac">Mac</a>
<a class="widget-taglist__link widget__link btn" href="/tags/mongodb" title="Mongodb">Mongodb</a>
<a class="widget-taglist__link widget__link btn" href="/tags/node" title="Node">Node</a>
<a class="widget-taglist__link widget__link btn" href="/tags/postgres" title="Postgres">Postgres</a>
<a class="widget-taglist__link widget__link btn" href="/tags/sqlite" title="Sqlite">Sqlite</a>
<a class="widget-taglist__link widget__link btn" href="/tags/%e5%91%bd%e4%bb%a4%e8%a1%8c" title="命令行">命令行</a>
<a class="widget-taglist__link widget__link btn" href="/tags/%e5%9b%bd%e5%86%85%e6%ba%90" title="国内源">国内源</a>
<a class="widget-taglist__link widget__link btn" href="/tags/%e5%9b%be%e5%83%8f%e5%a4%84%e7%90%86" title="图像处理">图像处理</a>
<a class="widget-taglist__link widget__link btn" href="/tags/%e5%ad%97%e7%ac%a6%e4%b8%b2" title="字符串">字符串</a>
<a class="widget-taglist__link widget__link btn" href="/tags/%e6%96%87%e4%bb%b6" title="文件">文件</a>
<a class="widget-taglist__link widget__link btn" href="/tags/%e6%96%87%e4%bb%b6%e7%ae%a1%e7%90%86" title="文件管理">文件管理</a>
<a class="widget-taglist__link widget__link btn" href="/tags/%e6%97%b6%e9%97%b4" title="时间">时间</a>
<a class="widget-taglist__link widget__link btn" href="/tags/%e6%9f%a5%e8%af%a2" title="查询">查询</a>
<a class="widget-taglist__link widget__link btn" href="/tags/%e8%bd%af%e4%bb%b6%e5%ae%89%e8%a3%85" title="软件安装">软件安装</a>
</div>
</div>
</aside>
</div>
<footer class="footer">
<div class="container footer__container flex">
<div class="footer__copyright">
© 2019 TecX 编程/设计/数据/可视化.
<span class="footer__copyright-credits">基于 <a href="https://gohugo.io/" rel="nofollow noopener" target="_blank">Hugo</a> 引擎和 <a href="https://github.com/Vimux/Mainroad/" rel="nofollow noopener" target="_blank">Mainroad</a>主題</span>
</div>
</div>
</footer>
</div>
<script async defer src="/js/menu.js"></script>
<script src="/js/custom.js"></script></body>
</html>