新年🏮集【福】咯

新年🏮集【福】咯

严少安 Lv.6

墨天轮新年活动—— 新年SQL“祝福”大赛 ,投稿参与一下,SQL水平功底薄弱,只好用别的方法找补,总不能交白卷不是。

过程简述:

  1. 使用本地PostgreSQL作为基础环境
  2. 以静态图转ascii文本
  3. 将文本文件作为外部表,创建file_fdw,并关联外部文件

过程演示:

  1. 本地数据库版本:
1
2
3
4
5
6
7
postgres# select version();
+---------------------------------------------------------------------------------------------------------+
| version |
+---------------------------------------------------------------------------------------------------------+
| PostgreSQL 12.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit |
+---------------------------------------------------------------------------------------------------------+
(1 row)
  1. 静态图

fu1.jpg

  1. 创建file_fdw
1
2
3
4
CREATE EXTENSION file_fdw;
CREATE SERVER file_fdw_server FOREIGN DATA WRAPPER file_fdw;
CREATE FOREIGN TABLE fu(fu text) server file_fdw_server options
(format 'text',filename '/tmp/fu.sql',delimiter ',',null '');
  1. 查询【福】表(fu
1
select * from fu;

fu2.jpg


略显单调,但祝福的意愿满满。


https://www.modb.pro/db/237415

  • Title: 新年🏮集【福】咯
  • Author: 严少安
  • Created at: 2022-01-12 23:01:22
  • Updated at: 2022-01-12 23:01:22
  • Link: https://shawnyan.cn/2022/modb/modb-new-year-fu/
  • License: This work is licensed under CC BY-NC-SA 4.0.
if (hexo-config('comment.enable') == true && hexo-config('comment.system') != "") { if (hexo-config('comment.system') == "waline") { @require "./waline.styl" } else if (hexo-config('comment.system') == "gitalk") { @require "./gitalk.styl" } else if (hexo-config('comment.system') == "twikoo") { @require "./twikoo.styl" } } .comments-container display inline-block margin-top $spacing-unit width 100% #comment-anchor width 100% height 10px .comment-area-title width 100% margin 10px 0 font-size 1.38rem color var(--default-text-color) font-family 'Consolas', '宋体', sans-serif font-weight bold i color var(--default-text-color) +redefine-tablet() margin 5px 0 font-size 1.2rem
On this page