Max_P ,
@Max_P@lemmy.max-p.me avatar

A good ELI5 is to imagine a couple of Excel sheets. Each sheet is a "table" and each row is a record. So you're gonna have a column for the first name, a column for the last name, a column for the email address and so on. That'd be your users table/sheet.

Then you would have another Excel sheets that contains posts. Each post record references the row number of the users sheet so you can cross-reference the user record of the author of the post record.

And so on. It's a way to store, lookup and retrieve records, usually cross-referencing other records until you have all the information you need to serve a particular request. There's an index like the table of content of a book that lets you quickly find on which page the record you're looking for is.

We use databases because they're engines designed to ensure data consistency, and fast access to the data in a structured manner. Usually that runs on some server that other servers connect to to access the database, so all servers can have the same view of the data. That can be a VM in the cloud, that can be a cluster of VMs in a cloud, it can be Docker containers. It's just software that manages data so we don't have to reinvent the wheel everytime we need to store stuff. Then you just ask questions to the database, like, "what's all the last 50 posts made by this user number" (SELECT user.username, post.title FROM posts LEFT JOIN users USING (user_id) WHERE posts.user_id = 42 ORDER BY posts.date_inserted ASC LIMIT 50).

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • kbinchat
  • All magazines