From the course: PostgreSQL: Client Applications
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Format aligned text output - PostgreSQL Tutorial
From the course: PostgreSQL: Client Applications
Format aligned text output
- [Instructor] The display of query results here in your terminal application is called aligned text. For instance, if we run a simple select query, such as SELECT * FROM sales.customers, you'll see what that output looks like. The resulting output uses text characters, such as dashes, plus symbols and these vertical pipe characters in order to create an approximation of a data table with the column and the header row dividing lines. We have some control over the appearance of the aligned text output using some psql meta-commands. To see the current settings, run the meta-command, \pset. This lists out the various display options that we can adjust to our liking. Let's focus on just two of them. I want to take a look at the fieldsep property, as well as the format property. The current format is aligned, which is what gives us the nicely spaced out table view of our data. The fieldsep property is currently a single vertical pipe character. We can change the format by typing in \pset…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Input queries from the command line2m 52s
-
(Locked)
Format aligned text output5m 15s
-
(Locked)
Output results to external files5m 30s
-
(Locked)
Save query results to .csv3m 28s
-
(Locked)
Output HTML and LaTeX tables3m 20s
-
(Locked)
Export files from the command line1m 48s
-
(Locked)
Challenge: Export a data table50s
-
(Locked)
Solution: Export a data table6m
-
(Locked)
-
-