EasyEnv
Engineering/Courses/Catalog/Go/Databases with database/sql
Go
BeginnerLesson 17 of 2045 min · hands-on

Databases with database/sql

Part of the Go course

Every program you have written so far forgets everything the moment it exits. That is fine for a tool that transforms its input and stops, and useless for anything that has users, orders, sessions or history. Sooner or later a Go program needs to put data somewhere that survives it, and for most programs that somewhere is a relational database.

Go's approach to this is unusual and worth understanding before you write a line of it. The standard library ships a package called database/sql that knows nothing whatsoever about PostgreSQL, MySQL or SQLite. It defines the shape of the conversation: how you open a connection, how you send a statement, how you read rows back. The knowledge of any particular database lives in a separate package called a driver. ...

Want to learn Go Databases with database/sql in a real environment?

Click below, get a fresh Linux box with Go ready to go, and work through Databases with database/sql hands-on with an AI tutor that knows your code.

Start this lessonDatabases with database/sql

What you'll learn

  • Database/sql package
  • Driver imports
  • Sql.Open and sql.DB pool
  • Exec vs Query vs QueryRow
  • Prepared statements
  • Scanning rows
  • Transactions

Read this lesson in your language

All lessons in this course

20 lessons
  1. 1Hello, Go25 min
  2. 2Variables and Types25 min
  3. 3Control Flow: if and for30 min
  4. 4Functions30 min
  5. 5Slices and Maps35 min
  6. 6Structs and Pointers35 min
  7. 7Methods and Interfaces35 min
  8. 8Error Handling35 min
  9. 9Modules and Project Structure35 min
  10. 10Tiny CLI Capstone40 min
  11. 11A Tour of the Standard Library40 min
  12. 12Testing and Benchmarks40 min
  13. 13Goroutines and Channels40 min
  14. 14Concurrency Patterns45 min
  15. 15Generics35 min
  16. 16HTTP Servers45 min
  17. 17Databases with database/sql45 min
  18. 18Performance and Profiling40 min
  19. 19Design Patterns in Go40 min
  20. 20Deployment and Production45 min

Explore other courses

Databases with database/sql - Go (English) | Engineering Courses