Follow

Does anybody know where to learn database programming? I have a thing at work that would work so well with a database but I don't know where to begin learning the mental model or interface.

@acdw Do you mean using a database? Writing a database? What kind of database? What kind of programming have you done before?

@emacsen Using, writing, querying a database. Right now all the data is in a big Excel spreadsheet with tables and VBasic functions to query the data.

1/

@emacsen

Basically, I work in a library. I build a list every month for the books we check out to local preschools. I have a table with all the books we have in our collection, and I have another table with all the checkouts I've done over time. Each month I generate a report that figures out what books we're going to check out next month, which is based on what books were previously checked out (I don't want to check the same book out two months in a row, for example).

2/

@emacsen

I've thought since making this big Excel sheet that it seems like a good application for a database, but I don't know for sure.

I'd consider myself a "hobbyist-level" programmer. I know what control flows and variables and all that are, but I don't get pointers yet. I've used python, bash, haskell, javascript, lua, etc., but mostly just to write little scripts.
---
I hope that answers your questions! Sorry for the wall of text. It's a complex problem I'm facing.

3/3

@acdw Here's what I'd do:

I don't know what language(s) you know but for the sake of discussion, let's say Python.

There are many online tutorials for Django which include some ORM layer. Learn that.

@bhaugen @emacsen Okay, so I'd use Django as the interface with the backend in the database? I think this is where my confusion lies. I'll try reading that tutorial.

I did half-heartedly try this with Flask before, but maybe if it's more batteries-not-included, I should start with a more comprehensive solution.

@acdw @bhaugen Django is a lot easier. I use flask for things more often, but for a newbie you want the batteries included.

Flask won't teach you a ton about what's going on behind the scenes, but for where you are, that's not as important.

@acdw @bhaugen Sorry I mean Django won't (no ORM will- that's the idea... it abstract it away)

@acdw I wanna chime in and say that I second everything that has been said by
@emacsen @bhaugen

@acdw

You already know how to build databases: your Excel spreadsheet is one.

You might however be interested in one specific type of databases, which we call “relational databases”. If you have a science background then you could do worse than read Codd's seminal paper (seas.upenn.edu/~zives/03f/cis5).

If you want to go deeper you will have to study (and put up with the pedantic writing in) C. Date's “An introduction to database systems”. My copy's #ISBN is 9780201385908.

@61 thanks for the (to me) kind words regarding my spreadsheet! I've been telling myself that, and that as a spreadsheet it's more portable, but I also want to try writing something as a learning exercise. I'll check out those papers!

Sign in to participate in the conversation
Writing Exchange

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!