In PostgreSQL, the VALUES
command returns a set of one or more rows as a table. It’s a table value constructor that can be used as part of a larger command, or as a standalone SQL statement.
Tag: psql
How to Show the Current Setting for Null Output in PostgreSQL (psql)
When using psql, null values are returned as an empty string by default.
This can easily be changed with the \pset
command, so it could be a value other than the default empty string.
If you’re not sure what your current value is, you can use the show \pset null
command to show the current value.
PostgreSQL DESCRIBE TABLE Equivalent
Some DBMSs such as Oracle, MySQL, and MariaDB have a DESCRIBE
command that returns information about tables and views. It goes DESCRIBE table
where table is the name of the table or view, and it can also be followed by a column name if you only want information about a specific column.
PostgreSQL doesn’t have a DESCRIBE TABLE
command as such, but there are alternatives.
3 Ways to Check a Column’s Data Type in PostgreSQL
Here are three ways to get the data type of a given column in MariaDB.
Continue readingHow to Change the Table Border Style in the psql Query Results
When using psql
to run queries against PostgreSQL, we can use the \pset border
and \pset linestyle
commands to change the border of the table that displays our results.
How to Show Null Values When Running Queries in psql (PostgreSQL)
By default, null values are returned as an empty string in psql. But this can easily be changed.
One reason you might want to change this is to avoid null values being confused with actual empty strings.
You can change this with the \pset null 'value'
command.
How to Check your psql Client Version
Here’s how to find out what version of psql you’re using.
Continue readingWhat is psql?
psql is a terminal based interface for PostgreSQL.
psql enables you to administer PostgreSQL from the command line interface (CLI) as an alternative to using a graphical user interface (GUI), such as pgAdmin, Postico, Azure Data Studio, etc.
Continue reading