• Dave@lemmy.nz
    link
    fedilink
    arrow-up
    0
    ·
    11 days ago

    Do people actually write SQL in all caps? Ever since I was a boy I’ve always written SQL (and HTML) in lower case.

    • umbraroze@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      11 days ago

      SQL is an Old Language of Ancient Power. You have to write the keywords in all caps.

      (Fortran is basically the same, but it’s rarer. Lisp is too, but you don’t need to capitalise everything, as the Ancient Power is contained in the parentheses.)

    • PotatoesFall@discuss.tchncs.de
      link
      fedilink
      arrow-up
      0
      ·
      11 days ago

      I do it because it helps me visually separate SQL keywords from table and column names.

      Helps especially when your SQL is embedded in another file so there is no syntax highlighting.

      • Dave@lemmy.nz
        link
        fedilink
        arrow-up
        0
        ·
        11 days ago

        That’s a good reason. I guess when I’m directly writing SQL the queries are point in time and not part of some enduring codebase.

    • cobysev@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      11 days ago

      They’re both acronyms, so yes? You always write acronyms in upper case.

      Structured Query Language (SQL)

      HyperText Markup Language (HTML)

      Some exceptions to the rule exist, like “Database” is usually abbreviated as Db in acronyms. For instance, IMDb (Internet Movie Database).

      Although considering database is a singular word, it makes sense to lower-case the middle letter of the word, as it wouldn’t be capitalized in the spelled-out word anyway.

        • cobysev@lemmy.world
          link
          fedilink
          English
          arrow-up
          0
          ·
          11 days ago

          SQL is the language. Its name is also an acronym, for “Structured Query Language.”

          • Dave@lemmy.nz
            link
            fedilink
            arrow-up
            0
            ·
            11 days ago

            More specifically I meant when I am writing in the language.

            I don’t write “SELECT * FROM users;”, I write “select * from users;”