Database
This section will demonstrate how to connect to popular databases from Zig.
Data model used is as follows:
- Create two tables:
cat_colors,cats,catshas a reference incat_colors. - Create a prepare statement for each table, and insert data.
- Execute a join query to get
cat_nameandcolor_nameat the same time.
cat_colors
| id | name |
|---|---|
| 1 | Blue |
| 2 | Black |
cats
| id | name | color_id |
|---|---|---|
| 1 | Tigger | 1 |
| 2 | Sammy | 1 |
| 3 | Oreo | 2 |
| 4 | Biscuit | 2 |