将 SQL 表数据格式化为文本表

Format SQL Table data as Text Table(将 SQL 表数据格式化为文本表)
本文介绍了将 SQL 表数据格式化为文本表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 Oracle 数据库得到如下结果:

I have a result from Oracle database as below:

1   Chi Phí Lương   FA_Phan_Bo_Chi_Phi_Luong    8   JOHN    8   2015    (BLOB)  FA_Phan_Bo_Chi_Phi_Luong_Final.csv  09-NOV-15   Đã Hoàn Thành
2   Tổng Hợp TimeSheet Nhân Viên    FA_Tong_Hop_Timesheet   8   JOHN    8   2015    (BLOB)  FA_Tong_Hop_Timesheet_COM_Final.csv 09-NOV-15   Đã Hoàn Thành
3   Tổng Hợp Doanh Thu  FA_Tong_Hop_Doanh_Thu   8   JOHN    8   2015    (BLOB)  FA_Tong_Hop_Doanh_Thu_Final.csv 09-NOV-15   Đã Hoàn Thành
4   Chi Phí Hoạt Động Công Ty   FA_CP_Hoat_Dong 8   JOHN    8   2015    (BLOB)  FA_CP_Hoat_Dong_Final.csv   09-NOV-15   Đã Hoàn Thành
5   Khấu Hao Máy Móc Thiết Bị   FA_CP_Khau_Hao_Phan_Bo_MMTB 8   JOHN    8   2015    (BLOB)  FA_CP_Khau_Hao_Phan_Bo_MMTB_Final.csv   09-NOV-15   Đã Hoàn Thành

如何将文本格式化为具有相同列宽的表格?

How can I format text as a table with the same width of column?

推荐答案

你的文本sql结果:

+---+------------------------------+-----------------------------+---+------+---+------+--------+---------------------------------------+-----------+---------------+
| 1 | Chi Phí Lương                | FA_Phan_Bo_Chi_Phi_Luong    | 8 | JOHN | 8 | 2015 | (BLOB) | FA_Phan_Bo_Chi_Phi_Luong_Final.csv    | 09-NOV-15 | Đã Hoàn Thành |
+---+------------------------------+-----------------------------+---+------+---+------+--------+---------------------------------------+-----------+---------------+
| 2 | Tổng Hợp TimeSheet Nhân Viên | FA_Tong_Hop_Timesheet       | 8 | JOHN | 8 | 2015 | (BLOB) | FA_Tong_Hop_Timesheet_COM_Final.csv   | 09-NOV-15 | Đã Hoàn Thành |
+---+------------------------------+-----------------------------+---+------+---+------+--------+---------------------------------------+-----------+---------------+
| 3 | Tổng Hợp Doanh Thu           | FA_Tong_Hop_Doanh_Thu       | 8 | JOHN | 8 | 2015 | (BLOB) | FA_Tong_Hop_Doanh_Thu_Final.csv       | 09-NOV-15 | Đã Hoàn Thành |
+---+------------------------------+-----------------------------+---+------+---+------+--------+---------------------------------------+-----------+---------------+
| 4 | Chi Phí Hoạt Động Công Ty    | FA_CP_Hoat_Dong             | 8 | JOHN | 8 | 2015 | (BLOB) | FA_CP_Hoat_Dong_Final.csv             | 09-NOV-15 | Đã Hoàn Thành |
+---+------------------------------+-----------------------------+---+------+---+------+--------+---------------------------------------+-----------+---------------+
| 5 | Khấu Hao Máy Móc Thiết Bị    | FA_CP_Khau_Hao_Phan_Bo_MMTB | 8 | JOHN | 8 | 2015 | (BLOB) | FA_CP_Khau_Hao_Phan_Bo_MMTB_Final.csv | 09-NOV-15 | Đã Hoàn Thành |
+---+------------------------------+-----------------------------+---+------+---+------+--------+---------------------------------------+-----------+---------------+

您可以在 tablesgenerator 生成文本表格,如以下格式.

You can generate text tables at tablesgenerator like following formats.

您可以提供如下输入:

  1. 文件中的 SQL 结果 -> 粘贴表数据
  2. 文件 -> 导入 CSV 文件
  3. 或者您可以手动生成表格

您可以在此处将列值对齐到左、右、中心.

Here you can align column values to left, right, centre.

表格边框不使用 Unicode 符号

Without Using Unicode symbols for table borders

+----+-------------+--------+-------+-----+
| id | name        | gender | state | age |
+----+-------------+--------+-------+-----+
| 1  | John Kenedy | male   | NY    | 32  |
+----+-------------+--------+-------+-----+
| 2  | Meresa Oslo | female | HI    | 26  |
+----+-------------+--------+-------+-----+
| 3  | Mike Lanes  | male   | FL    | 25  |
+----+-------------+--------+-------+-----+

对表格边框使用 Unicode 符号

Useing Unicode symbols for table borders

╔════╦═════════════╦════════╦═══════╦═════╗
║ id ║ name        ║ gender ║ state ║ age ║
╠════╬═════════════╬════════╬═══════╬═════╣
║ 1  ║ John Kenedy ║ male   ║ NY    ║ 32  ║
╠════╬═════════════╬════════╬═══════╬═════╣
║ 2  ║ Meresa Oslo ║ female ║ HI    ║ 26  ║
╠════╬═════════════╬════════╬═══════╬═════╣
║ 3  ║ Mike Lanes  ║ male   ║ FL    ║ 25  ║
╚════╩═════════════╩════════╩═══════╩═════╝

降价表

| id | name        | gender | state | age |
|----|-------------|--------|-------|-----|
| 1  | John Kenedy | male   | NY    | 32  |
| 2  | Meresa Oslo | female | HI    | 26  |
| 3  | Mike Lanes  | male   | FL    | 25  |

这篇关于将 SQL 表数据格式化为文本表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)