Jesus died at 33, so that can’t get returned in the query response lol

62 points

SELECT user FROM db WHERE age BETWEEN 25 AND 35;

Fuck your mongo

permalink
report
reply
22 points

Mongo only pawn in scheme of life.

permalink
report
parent
reply
9 points

AGGRESSIVE LANGUAGE

permalink
report
parent
reply
12 points

I DO NOT SEE ANYTHING WRONG WITH THE PREVIOUS COMMENT, JUST A NORMAL HUMAN TALKING LIKE ME.

permalink
report
parent
reply
6 points
*

We just got a ticket in, our users need several new fields in the user table

Relational virgin:

NNNNNOOOOOO I’ll need this sprint to modify the user table and write the etl script

NoSQL Chad:

private String newField1;

private boolean newField2;

private Object newField3;

//And now, I close the ticket and go get lunch beers.

permalink
report
parent
reply
1 point
*

You do know that a large majority of SQL flavours support JSON columns?

permalink
report
parent
reply
46 points

All this talk about query format and no one discussing the dogshit database design requiring the record to be updated whenever the user has a birthday? Store the day of birth and do the math at query time at least!

permalink
report
reply
7 points

Does mongodb have virtual columns?

permalink
report
parent
reply
1 point
*
Deleted by creator
permalink
report
parent
reply
29 points

I’m no mongo fan, but this is ragebait.

You can write it like this, but you can also write {age: {$gte: 25, $lt: 30}}

If you’re going to dunk on mongo, let’s talk about how db.collection.update() replaces the whole record by default instead of updating keys

permalink
report
reply
18 points

Thanks for letting me know that if I’m ever asked if I’m willing to learn mongo the answer is no.

permalink
report
reply
14 points
*

I do believe Mongo has some valid niche use cases, but far, far too many people think it’s just a no-worries way to dump objects into a database without having to deal with all that fussy schema stuff. They only realize their mistake when it comes time to actually use that data as anything other than a huge, unmanageable blob of nested fields.

Granted, Mongo’s marketing kind of encourages this.

permalink
report
parent
reply
10 points

Slightly off-topic: I get so confused with age conventions. I’m self-taught and do some ad-hoc work for the organization I work for (where no one else has any interest).

To get users between 25 and 30, wouldn’t you want strictly less than 30? And greater than or equal to 25? Or for age is it inclusive?

permalink
report
reply
16 points

Realistically you wouldn’t store age, you’d store birthdate or possibly a datetime value, and calculate it from there

permalink
report
parent
reply
6 points

First Normal Form users unite!

By the by, as someone who have used both NoSQL and SQL extensively (once in the same project), the trick of NoSQL is that you shouldn’t use FNF and compute that at write time. The idea is that it’s faster to MapReduce pre calculated values since that’s the operation you want to optimize in a NoSQL world. A lot of people get that wrong and just replace MySQL with Mongo without rethinking usage and schemas.

But even in a NoSQL context I’d rather use a Postgres jsonb column over MongoDB.

permalink
report
parent
reply
5 points

This is a question for story refinement.

permalink
report
parent
reply
5 points
*

Why strictly less than 30 and greater or equal 25? (25 ≤ X < 30)

Shouldnt it be strictly less and strictly more (25 < X < 30)?

permalink
report
parent
reply
9 points

And here comes the most annoying error, the off by one error

permalink
report
parent
reply
7 points

I guess you could argue that people we refer to as “25 years old” are actually 25 years and some days/hours/minutes/whatever old, therefore more than 25. People referred to as 30 are, in the same vein, more than 30

permalink
report
parent
reply
2 points
*

Well if you’re 25 and a day, that would mean you wouldn’t be able to fit any definition. The second after you turn 25 you would be “over 25” and could be included in 25, over 25 and between 25 and X until you turn 26 and the same repeats.

permalink
report
parent
reply
1 point

Even if you’re 25 and 11 months, you should still be counted as 25. Same way it should be for other age based restrictions

permalink
report
parent
reply
1 point
Deleted by creator
permalink
report
parent
reply
0 points

“Between 25 and 30” would tell me 25 birthday (since even at 12:00:01 you are over 25 by a second) to one second before 30th birthday.

So ages 25, 26, 27, 28, and 29.

permalink
report
parent
reply

SQL - any and all

!sql@lemmy.world

Create post

For discussion about SQL and databases. All versions welcome.

  • MSSQL
  • PostgreSQL
  • MariaDB
  • SQLite
  • etc…

Community stats

  • 1

    Monthly active users

  • 13

    Posts

  • 55

    Comments

Community moderators