this post was submitted on 14 Feb 2025
482 points (96.9% liked)

No Stupid Questions

37405 readers
3238 users here now

No such thing. Ask away!

!nostupidquestions is a community dedicated to being helpful and answering each others' questions on various topics.

The rules for posting and commenting, besides the rules defined here for lemmy.world, are as follows:

Rules (interactive)


Rule 1- All posts must be legitimate questions. All post titles must include a question.

All posts must be legitimate questions, and all post titles must include a question. Questions that are joke or trolling questions, memes, song lyrics as title, etc. are not allowed here. See Rule 6 for all exceptions.



Rule 2- Your question subject cannot be illegal or NSFW material.

Your question subject cannot be illegal or NSFW material. You will be warned first, banned second.



Rule 3- Do not seek mental, medical and professional help here.

Do not seek mental, medical and professional help here. Breaking this rule will not get you or your post removed, but it will put you at risk, and possibly in danger.



Rule 4- No self promotion or upvote-farming of any kind.

That's it.



Rule 5- No baiting or sealioning or promoting an agenda.

Questions which, instead of being of an innocuous nature, are specifically intended (based on reports and in the opinion of our crack moderation team) to bait users into ideological wars on charged political topics will be removed and the authors warned - or banned - depending on severity.



Rule 6- Regarding META posts and joke questions.

Provided it is about the community itself, you may post non-question posts using the [META] tag on your post title.

On fridays, you are allowed to post meme and troll questions, on the condition that it's in text format only, and conforms with our other rules. These posts MUST include the [NSQ Friday] tag in their title.

If you post a serious question on friday and are looking only for legitimate answers, then please include the [Serious] tag on your post. Irrelevant replies will then be removed by moderators.



Rule 7- You can't intentionally annoy, mock, or harass other members.

If you intentionally annoy, mock, harass, or discriminate against any individual member, you will be removed.

Likewise, if you are a member, sympathiser or a resemblant of a movement that is known to largely hate, mock, discriminate against, and/or want to take lives of a group of people, and you were provably vocal about your hate, then you will be banned on sight.



Rule 8- All comments should try to stay relevant to their parent content.



Rule 9- Reposts from other platforms are not allowed.

Let everyone have their own content.



Rule 10- Majority of bots aren't allowed to participate here.



Credits

Our breathtaking icon was bestowed upon us by @Cevilia!

The greatest banner of all time: by @TheOneWithTheHair!

founded 2 years ago
MODERATORS
 

I'm a tech interested guy. I've touched SQL once or twice, but wasn't able to really make sense of it. That combined with not having a practical use leaves SQL as largely a black box in my mind (though I am somewhat familiar with technical concepts in databasing).

With that, I keep seeing [pic related] as proof that Elon Musk doesn't understand SQL.

Can someone give me a technical explanation for how one would come to that conclusion? I'd love if you could pass technical documentation for that.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 10 points 1 week ago (2 children)

I saw a comment about this in the last couple of days that was really interesting and educational. Unfortunately I can't seem to find it again to link it, but the gist of it was that there would be two things wrong with using SSNs as primary keys in a SQL database:

  • You should not use externally generated data as primary keys
  • You should not use personally identifying data as primary keys

Using SSNs as keys would violate both.

I went looking for best practices regarding SQL primary keys and found this really interesting post and discussion on Stack Overflow:

https://stackoverflow.com/questions/337503/whats-the-best-practice-for-primary-keys-in-tables

My first thought was that people's SSNs can and do change, and sometimes (rarely?) people may have more than one SSN. Like someone mentions in that link, human error would be another reason why you would not want to use external data and particularly SSNs as primary keys.

[–] [email protected] 5 points 1 week ago (1 children)

It may be bad practice to use SSN as a primary key, but that won't deter thousands of companies from doing exactly that.

[–] [email protected] 2 points 1 week ago

Oh, I hear you!

[–] [email protected] 2 points 1 week ago (2 children)

From what I'm seeing in other comments, it seems SSNs aren't used as primary keys, but they are part of generating the primary key. I haven't seen anyone directly say it, but it sounds like the primary key is a hash of SSN + DOB (I hope with more data to add entropy, because thats still a tiny bit of data to build a rainbow table from).

Still, assuming we haven't begun re-using SSNs, it seems concerning to me that a SSN is appearing multiple times in the database. It seems a safe assumption that the uniqueness of a SSN should make the resultant hash unique, so a SSN appearing as associated to multiple primary keys should be a concern, right?

Other comments have led me to believe the "duplicate SSNs" are probably appearing in "different fields" (e.g. a dead man's SSN would appear directly associated to him, but also as a sort of "collecting payments from" entry in his living wife's entry). That would a misrepresentation of the facts (which we know Vice Bro, Elon Musk the Wise and Honest would never do). Occam's Razor though has me leaning in that direction.

[–] [email protected] 7 points 1 week ago* (last edited 1 week ago)

I think the thing that's catching you up the most is that you're assuming Elon has the slightest clue what he's talking about about. In your mind, you've read the words "the social security database" from his post and have made assumptions about what that means.

I've worked with databases for 20+ years, several of those being years working on federal government systems. Each agency has dozens or possibly hundreds of databases all used for different purposes. Saying "the social security database" is so fucking general that it's basically nonsensical. It'd be like saying "Ford's car database".

Elon clearly heard someone technical talking about something, then misinterpreted it for his own purposes to justify what he is doing by destroying our government institutions. His follow up of saying the government doesn't use SQL just reinforces that point.

Trying to logically backtrack into what he actually meant - and what the primary keys should be - is just sane washing an insane statement.

[–] [email protected] 4 points 1 week ago (2 children)

That all makes sense, except if someone's SSN changes (which happens under certain circumstances), doesn't that invalidate their primary key or require a much more complicated operation of issuing a new record and relinking all the existing relationships?

I can imagine an SSN existing in more than one primary key due to errors. If they use SSNs in the primary key at all, but combined with something else, that leads me to believe that the designers felt that SSNs were reliable for being a pure primary key.

I agree with you about Occam's Razor. The guy has demonstrated multiple times that he's a dishonest moron.

[–] [email protected] 3 points 1 week ago (1 children)

I'm not familiar with cases where someone's SSN could change. Could you link to resources on when that would happen?

[–] [email protected] 3 points 1 week ago (1 children)

I don't have any resources handy, but I do know someone who this happened to: they were an immigrant who got an SSN the first time they migrated to the US, went back to live in their country for a number of years, then returned to the US and I guess applied for an SSN again. Voilá, two SSNs and a mess.

[–] [email protected] 3 points 1 week ago (1 children)

Yeah, I can imagine thats be an administrative headache. I do not envy them the opportunity of sorting that out.

Thanks for the example though. That makes sense.

[–] [email protected] 2 points 1 week ago

I don't envy either party either. You're welcome!

[–] [email protected] 2 points 1 week ago* (last edited 1 week ago) (1 children)

That all makes sense, except if someone’s SSN changes (which happens under certain circumstances), doesn’t that invalidate their primary key or require a much more complicated operation of issuing a new record and relinking all the existing relationships?

Yes, in the case of duplicate SSN assignments for two people (rare) l you would need to change their records to align with the new SSN while not changing the records that go the the person who keeps the SSN. We do it with state identifiers and it is a gigantic pain in the ass.

If two numbers are assigned to the same person merging them to one of the two is far easier.

[–] [email protected] 2 points 1 week ago

I can definitely imagine all that. Thanks!