Go - SQL Databases in Golang with the database/sql package

BugBytes September 4, 2023
Video Thumbnail

About

On this channel, we create tutorials and videos primarily about web development, data analytics and data science. We'll focus on implementations using primarily Python and JavaScript, occasionally diving into other languages. As the channel progresses, we will also touch on concepts such as DevOps, containerization, cloud computing (AWS) and machine learning/AI. If you can spare any change, please consider buying me a coffee to help keep me motivated to write tutorials, make videos and write blog posts! It would be greatly appreciated: https://ko-fi.com/bugbytes Blog: https://www.bugbytes.io/posts/ Github: https://github.com/bugbytes-io

Video Description

Playlist ▶️: https://www.youtube.com/playlist?list=PL-2EBeDYMIbQRWxVjUwE4uVXKr2lnquD- In this video, we'll look at the database/sql package in Go, and how to use this package to work with SQL relational databases. We will look at how to connect to a PostgreSQL database running in a Docker container, and how to create tables, insert data and query data using the Go database package. We'll look at the difference between three database functions: - db.Exec() - db.Query() - db.QueryRow() And will outline when to use each. Playlist: https://www.youtube.com/playlist?list=PL-2EBeDYMIbQRWxVjUwE4uVXKr2lnquD- ☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲: To support the channel and encourage new videos, please consider buying me a coffee here: https://ko-fi.com/bugbytes 📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀: 00:00 Intro 00:49 Setting up PostgreSQL Docker container 04:20 Connecting to Postgres from Go app with sql.Open 09:36 Creating table in database with CREATE TABLE SQL 14:28 Inserting data into table with Go 22:02 Querying single row with db.QueryRow() 26:21 Querying for multiple rows with db.Query() 𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮: 📖 Blog: https://bugbytes.io/posts/ 👾 Github: https://github.com/bugbytes-io 📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻: Go database/sql package: https://pkg.go.dev/database/sql Go Postgres driver pq: https://pkg.go.dev/github.com/lib/pq #golang #webdevelopment #database #sql

You May Also Like

No Recommendations Found

No products were found for the selected channel.