From the course: PostgreSQL: Client Applications
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Solution: Export a data table - PostgreSQL Tutorial
From the course: PostgreSQL: Client Applications
Solution: Export a data table
(upbeat music) - [Instructor] I hope you are able to export your data table as an HTML formatted document according to my specifications. Let's go ahead and walk through the solution. I'm going to start up a brand new PowerShell window which places me at my system's Command Prompt. The first thing I need to do is create a connection to the Postgres database. So, psql -h localhost. Connect to the two_trees database and -U to establish the Postgres user as the user that we're going to use. Okay, so that sets up the initial connection. Now I can start passing in some additional parameters or do some additional options. I need to export a file, so I'll set up the output file with -o and I'll specify the file path that I want it to go to. And I'll just place this on my desktop. Now, what are we going to call this? The query that I gave you said that we're going to select everything from inventory.products where the category ID is equal to three. So, I'm going to call this…
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)
-
-