Go’s database/sql package — part of the standard library — provides a DB struct that allows us to interact with SQL (relational) databases.
There are 3 methods available for executing queries:
- DB.Query() for
SELECT
queries that return multiple rows; - DB.QueryRow() for
SELECT
queries that return a single row; - DB.Exec() for queries that don’t return any rows (e.g.
INSERT
)
RESUME HERE