Creating a table in a database in PostgreSQL
A database is a structured set of data with one or multiple numbers of tables in it to store, query, create, or perform any other kind of processing. Once you have installed the database software such as PostgreSQL onto your computer, the next obvious task is to create a database and then insert tables (actual data) into that database. In this recipe, you will create a database in the PostgreSQL database server.
Getting ready
Before creating a data table, you should connect with the database server, and it should run properly onto your computer. The task is to create a new data table called airlinesDB
. The data table will contain the following columns:
YEAR
(integer
)QUARTER
(integer
)MONTH
(integer
)ORIGIN
(character
,3
)DEST
(character
,3
)DEP_DELAY
(numeric
,6
digits with2
decimals)ARR_DELAY
(numeric
,6
digits with2
decimals)
How to do it...
The easiest way to create a data table in the PostgreSQL database server is to use pgAdmin 4. Connect to the...