this post was submitted on 11 Feb 2025
1098 points (98.8% liked)

Programmer Humor

20460 readers
2715 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

See the post on BlueSky: https://bsky.app/profile/provisionalidea.bsky.social/post/3lhujtm2qkc2i

According to many comments, the US government DOES use SQL, and Musk is not understanding much what's going on.

you are viewing a single comment's thread
view the rest of the comments
[–] Rubanski@lemm.ee 9 points 5 hours ago (8 children)

Ok genuine question, what is the difference between a SQL database and a simple Excel spreadsheet?

[–] rumba@lemmy.zip 1 points 31 minutes ago* (last edited 5 minutes ago)

Sql Database:

  • Tables: like excel sheets
  • Rows: like excel rows
  • Temp Tables: you can make a throw away table where data is all organized how you need it and it just goes away when you're done.
  • Indexes: stores information about all the data to speed up searches. you can have 10 million rows in SQL and still get pretty quick results.
  • Relational data store: The default in SQL is to do a kind of inter-sheet linking. You can set up references so that if you delete a line in one of the linked sheets, it won't let you because there's an active reference to it in another sheet. Like if you try to delete the Ohio Row from the states table, it can be made so that you can't because users are linked to Ohio in their another sheet. (data integrity)
  • Joins: You can logically link multiple tables together. Your data can be structured over many many tables with a one to many relationship, so massive reduction in storage and memory needs.
  • Memory: SQL only uses enough memory to load what you're using. You can have a 100GB database and maybe get away with a few gigs of ram. Excel needs to load everything into ram.
  • Transaction: SQL can wrap a series of operations into a transaction. If there's something wrong with the data, it can rollback everything that happened in the transaction. You can safely operate on large amounts of data without danger of corrupting it if you do something wrong.
  • Procedures: SQL can store off code and compile it down to be much much faster. you can surface just a simple function instead of full db access and end users have a hard time hacking apps to get data they shouldn't see out of the database.
  • Replicas: You can set up a secondary server with the same databases and chain them so that the origin server takes all the changes and the secondary server is a backup, read-only replica.
  • Incremental backups: You can set up the servers so that the changes are noted day in and day out, so if you have a REALLY large database, you can restore it to any point in time with just a regular backup and all the logs for the day up to the latest.

Excel Database:

  • Tables and Rows
  • Easy to edit in a client everyone has
  • Supports some decent macro capability
  • Can be problematic when more than one person is editing at the same time
  • Can struggle with large datasets.
  • really likes to misinterpret data as dates
  • doesn't do most of what *sql can do
  • edit: wrong word
[–] lefixxx@lemmy.world 7 points 2 hours ago

The excel file contains the data. It's equivalent to the database.

The excel program is how you interact with the data. SQL is how you interact with databases.

Doesn't matter how the data is structured inside the database. You can ask in the SQL language and you will receive an SQL answer.

[–] OrnateLuna@lemmy.blahaj.zone 40 points 5 hours ago (1 children)

People yell at you if you use an excel spreadsheet as a database

[–] moseschrute@lemmy.world 4 points 4 hours ago (3 children)

Does anyone yell if I use SQL?

[–] rumba@lemmy.zip 3 points 50 minutes ago* (last edited 49 minutes ago) (1 children)

Does anyone yell if I use SQL?

If you use MySQL, Maria DB people yell

If you use Maria DB, Postgres people yell

If you use Postgres, the nosql people yell

If you use Excel, the MySQL, MariaDB, Postgres and nosql people yell.

[–] moseschrute@lemmy.world 1 points 45 minutes ago (1 children)

Can you give this to me in function form so I can find the global max the gets the most people yelling?

[–] rumba@lemmy.zip 1 points 25 minutes ago

Only if you can tolerate AI, I only have so much time to commit to this bit.

[–] Wiz@midwest.social 6 points 4 hours ago

Only the programmers that have to run queries in it because that's their job. 😭

[–] Irelephant@lemm.ee 5 points 4 hours ago (1 children)
[–] moseschrute@lemmy.world 1 points 44 minutes ago* (last edited 44 minutes ago)

Wow wow what did sqlite ever do to you

[–] frezik@midwest.social 5 points 3 hours ago (1 children)

A whole lot. Too much to cover in one post in any kind of detail.

A modern relational database management system (RDBMS) is a highly optimized beast. How it accesses storage is very carefully considered. It has a whole mini language for defining relations between data. There are tools for debugging specific queries to make them faster. They index data with tradeoffs between read and write speeds. There are sophisticated locking mechanisms so multiple users can read and write at the same time. They have transactions where many alterations can be packed up together and written efficiently at once. Those transactional alterations are atomic, meaning there are guarantees that all of them happen or none of them happen. The entire thing is based on set theory, and it has survived attacks by many other pretenders to the throne for decades.

And if you're using Oracle, you can get all that while paying a highly optimized pricing model set up by the best financial advisors Larry Ellison can find to maximize value extraction from your company.

[–] captainlezbian@lemmy.world 1 points 2 hours ago

And alternatively, for excel once you leave the realm of a single person entering data for a single project over time sizes you start entering the "why does this take 10 minutes to open" territory

[–] iii@mander.xyz 11 points 5 hours ago* (last edited 4 hours ago) (2 children)

In the context of this tweet most important differences are:

SQL is a language for querying databases.

Most common used databases are relational databases. With relational databases you can setup, well, relations and constraints.

Imagine you have 2 tables (2 excel sheets) one with people, and one with home ownership. You can set the following constraint: (1) each person shows up only once in the people table. And the following relation: (2) every home owner must refer to an existing person in people table.

When modifying the table contents, the system checks if no constraints or relations are violated.

Excel, just like a badly designed relational databse, would, for example, have no problem with duplicate people, or home ownership referring to non-existant people.

[–] stevedice@sh.itjust.works 1 points 4 hours ago

I spent more than I'd like to admit wondering "what the fuck is a wel relation?!"

[–] answersplease77@lemmy.world 1 points 4 hours ago

I get what you say but excel even the 98 version can do duplicate/missing data constraints.

[–] sexual_tomato@lemmy.dbzer0.com 2 points 3 hours ago

Storage data structures. Database tables are designed for fast read/write. Excel is designed for fast simultaneous parallel computation.

To get a sense of what this looks like, you can read more about their data structures; Databases typically store data in what's called a "B Tree" and spreadsheets typically store as a format that can be easily converted into a "Directed Acyclic Graph" (although Excel lets you turn off the "acyclic" part if you allow circular references).

Although, with Excel specifically, there's probably not much difference since it has some database functionality now.

[–] Covenant@sh.itjust.works 7 points 5 hours ago

The amount of data, sql is designed to manage large datasets, millions of rows. Excel has its limits.

[–] mossberg590@lemmy.world 6 points 5 hours ago

SQL is a language used to manage and interact with most relational databases so it is used often to describe relational databases. There are many tables in a relational database, each is very much like an excel tab. The excel spreadsheet can have many tabs relating to each other. So kinda similar. However a relational database is better defined, more functions and forced relationships, and most important space efficenct. Excel takes probably 100-1000 times more space, and that is best case.