Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to make a SQL table look like it comes from the terminal

I have a SQL table that comes from the terminal, and I would like to be able to replicate it "as is" in a LaTeX report. It would help the reader see more clearly and do copy-paste easier for them as well. The table can look like that :

+-----------+----------+------+-----+---------+-------+
| Field     | Type     | Null | Key | Default | Extra |
+-----------+----------+------+-----+---------+-------+
| Name      | char(16) | NO   |     | NULL    |       |
| RA        | float    | NO   |     | NULL    |       |
| DE        | float    | NO   |     | NULL    |       |
+-----------+----------+------+-----+---------+-------+

And would I ideally look like that :
SQL table in LaTeX (goal)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You could include the table as verbatim material:

\documentclass{article}

\begin{document}

\begin{verbatim}
+-----------+----------+------+-----+---------+-------+
| Field     | Type     | Null | Key | Default | Extra |
+-----------+----------+------+-----+---------+-------+
| Name      | char(16) | NO   |     | NULL    |       |
| RA        | float    | NO   |     | NULL    |       |
| DE        | float    | NO   |     | NULL    |       |
+-----------+----------+------+-----+---------+-------+
\end{verbatim}

\end{document}

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading