21 PostGreSQL and {RPostgres} / {RPostgreSQL}

PostgreSQL is an open-source, object-relational database management system (ORDBMS) that is not owned or controlled by one company or individual. Because postgresSQL software is open-source, it is managed mostly through a coordinated online effort by an active global community of developers, enthusiasts and other volunteers. First released in the mid-1990s, postgresSQL is written in C. Its primary competitors include Oracle DB, SQL Server and MySQL.This term is also known as Postgres.
PostgresSQL and ingres, an earlier effort, were both developed by a team at the University of California at Berkeley. PostgresSQL did not originally support structured query language (SQL) -- QUEL query language was used until 1994, when SQL support was added. In 1996, the first official open-source software version of PostgresSQL was released. PostgresSQL supports almost all relational database features and offers a few unusual features that are normally absent in other RDBMS engines. Commonly supported objects include views, stored procedures, indexes, triggers and object-defined data types, in addition to general RDBMS features such as primary keys, foreign key relationships and atomicity. Certain critical postgresSQL features are similar to Oracle DB and other database engines; such features include the use of concepts like tablespaces, savepoints and point-in-time recovery.

From: https://www.techopedia.com/definition/3499/postgresql

docker pull postgres:11.3
docker run --rm -e POSTGRES_PASSWORD=docker --name postgre --net r-db postgres:11.3

In RStudio

library(DBI)
# Connect to a specific postgres database i.e. Heroku
con <- dbConnect(RPostgres::Postgres(),
                 dbname = 'postgres', 
                 host = 'postgre',
                 port = 5432, 
                 user = 'postgres',
                 password = 'docker')

dbListTables(con)
dbWriteTable(con, "mtcars", mtcars)
dbListTables(con)

res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4")
dbFetch(res)
dbClearResult(res)