I am very curious as to how databases are used in the real world, whether you’re using MySQL and what not, how does it all come together in a real world business? Banking and gaming I know, but is it something that gets stored on data centres and then put into a VM?

I might be overcomplexing this but I understand the good use cases with VMs and containers etc just not with databases.

I’d google, but I’d like a ELI5 due to my smooth brain with these concepts, thank you.

  • Max-P@lemmy.max-p.me
    link
    fedilink
    English
    arrow-up
    7
    ·
    5 months ago

    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).