this post was submitted on 24 Dec 2023
97 points (96.2% liked)

Today I learned

7870 readers
1 users here now

founded 4 years ago
MODERATORS
 

Learned this from a friend. The types are null, integer, real, text, and blob. My friend describes them thusly:

  • Null stores nothing, but like, actively nothing, as opposed to the absence of a thing.
  • Integer is a signed integer, up to 8 bytes.
  • Real is always an 8-byte float.
  • Text is an arbitrary-length UTF-8 or UTF-16.
  • Blob is an arbitrary-length anything-else. But I hope you remembered what you put there. Because it sure isn't gonna tell you. Oh, and it doesn't have strong typing, so if you ask for it back as an integer, it'll quite happily give you it back as an integer, especially if that doesn't make sense!
all 24 comments
sorted by: hot top controversial new old
[–] drkt@feddit.dk 32 points 10 months ago

Well it's kinda in the name SQLite

[–] incogtino@lemmy.zip 21 points 10 months ago (2 children)

I find the lack of dates the most annoying

[–] stackPeek@kbin.social 10 points 10 months ago

Is it me or isn't ISO 8601 string more than enough?

[–] bionicjoey@lemmy.ca 20 points 10 months ago* (last edited 10 months ago)

IMO this is fine. The whole point of sqlite is to be as lightweight as possible. It doesn't need the bloat introduced by any other types. Blobs + data serialization in the client library will be good enough for most other cases.

[–] eran_morad@lemmy.world 6 points 10 months ago (1 children)

Anyone else here use R (+ openxlsx2) + SQLite to produce Excel reports? I’m finding that to be way better than flat file bullshit and writing macros.

[–] BeigeAgenda@lemmy.ca 3 points 10 months ago

I started a project trying to use excel to analyse data, but quickly found that it's very limited, then I dumped the data into SQLite and added a statistics plugin, and bingo!

[–] BradleyUffner@lemmy.world 5 points 10 months ago* (last edited 10 months ago) (1 children)

"Null" is not a distinct data type. It's a specific value that a data type can contain.

[–] themeatbridge@lemmy.world 4 points 10 months ago* (last edited 10 months ago) (1 children)

Ok, but is a Null Integer the same as a Null Text value? I'm really asking, I don't know.

[–] BradleyUffner@lemmy.world 5 points 10 months ago* (last edited 10 months ago) (1 children)

Conceptually, as in what the null represents at the DB level, yes. Logically, at the software level, I'd say sort of, but not really. It's complicated. Does it make sense to compare values of fundamentally different types?

[–] kogasa@programming.dev 3 points 10 months ago

In a system like Java's where everything derives from a common object class one can say null is a valid value of object type, so any two null values are equivalent. With ANSI nulls, even null isn't equivalent to null.

[–] packadal@beehaw.org 3 points 10 months ago

Have you ever tried storing a string in an INTEGER column ?

Due to a bug it happened in a software I worked on.

SQLite just stores the string. I have no idea if the column type has any real effect on storage as far as SQLite is concerned.