Databases are odd folks.

Today I realized, that SQLite has a feature that allows you to skip the Primary Key in a table declaration.

You might remember SQL? SELECT * FROM table WHERE id = 5? This ID field is often either an ever incrementing number or a UUID in more special cases. But if you create a table in SQLite (maybe also in other DBs) you can leave out the primary key and SQLite will do it for you and call it rowid. Actually, if you have a typical primary key field, it will be even just an alias to rowid.

But there’s a catch: you can not reference rowid if it’s not explicitly specified. So if you have a table that needs to be referenced as foreign key from some other table, better give it a primary key. Weird!

Do you speak SQL? Tell me in the comments.

Comments

Adding comments is only possible via Instagram directly, sorry. If you're okay with visiting Instagram, you can use the link to my post .

  1. #worldcode #workenvironment #mindsetmatters #webdeveloper #developerjobs #htmlcode #seniordeveloper #peoplewithlaptops #workhardanywhere #peoplewhocode #thedevlife #appdeveloper #buildtheweb #codergallery #weprogrammers #developerdiaries #developerlifestyle #setupgoals #myworkspace #designyourworkspace #minimalbeast #hustle #techsetup #deskgoals #informationtechnology #dellxps #linux @codeclique @comment_sense @lovecoders @coding @worldcode @coderlifes @programmerrepublic @thedevlife @peoplewhocode @developerstuff

    1. @kratochviljiricz fancy choice! Who cares about Sindarin or Klingon, if you can talk to symbiotic, gate jumpers?

      1. @coffee_n_code because StarGate is better than Star Trek and Star Wars 🤩💪

        1. @kratochviljiricz debatable! 😂

        2. What distro do u use?

          1. @fvckandrew.jpg I use Void Linux. If you want to know more, look at https://voidlinux.org

          2. 🔥

            1. 👏👏👏👏👏