You are viewing a single thread.
View all comments
178 points

Speaking as a Senior Dev specialized in database access and design… you don’t have to use all caps - SQL is actually case agnostic.

But… but my fucking eyes man. I’m old, if your branch doesn’t have control keywords in all caps I’m going to take it out back and ol’ yeller it.

There are few hills I’ll die on but all caps SQL and singular table names are two of them.

permalink
report
reply
71 points

I’m a sql developer, and I am completely the opposite to you. I will find it incredibly difficult to read when everything is in caps

permalink
report
parent
reply
25 points

Same, I prefer lower case. Every other language has keywords in lower case, why do you need to shout when writing sql?

permalink
report
parent
reply
10 points

THE DATABASE CAN’T HEAR ME IF I DON’T SCREAM

permalink
report
parent
reply
13 points

Just some key words in uppercase (FROM, JOIN,WHERE,etc) so they pop out

permalink
report
parent
reply
21 points
*

I understand it as an attempt to get very basic, manual syntax highlighting. If all you have is white text on black background, then I do see the value of making keywords easy to spot by putting them in all caps. And this probably made sense back when SQL was first developed, but it’s 2023, any dev / data scientist not using a tool that gives you syntax highlighting seriously needs to get with the times

permalink
report
parent
reply
1 point

What about Intercal?

permalink
report
parent
reply
130 points

You should do a project together

permalink
report
parent
reply
41 points

You monster.

permalink
report
parent
reply
21 points
Deleted by creator
permalink
report
parent
reply
18 points
*

Sorry, to clarify, not everything is in all caps. I’ll append my prefered syntax below

WITH foo AS (
    SELECT id, baz.binid
    FROM
            bar
        JOIN baz
            ON bar.id = baz.barid
)
SELECT bin.name, bin.id AS binid
FROM
        foo
    JOIN bin
        foo.binid = bin.id

The above is some dirt simple SQL, when you get into report construction things get very complicated and it pays off to make sure the simple stuff is expressive.

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

You indent your JOIN? Why on earth? It lives in the same context as the SELECT.

permalink
report
parent
reply
1 point

Um you forgot the semicolon before with assuming there isn’t one in the previous statement. Syntax error. Code review failed

permalink
report
parent
reply
2 points

I’m at a Data Engineer and I alternative caps lock and non caps lock at random

permalink
report
parent
reply
1 point
*

I believe this has been proven. It’s because capital letters all have the same shape whereas lower case letters do not. So your brain can take shortcuts to reading lower case but cannot with upper case.

Also most if not all editors will highlight SQL keywords so it’s probably not too hard to discern SQL commands and everything else in modern day.

permalink
report
parent
reply
18 points

The place I work decided to name all tables in all caps. So now every day I have to decide if I want to be consistent or I want to have an easy life.

permalink
report
parent
reply
11 points

Fuuuuck. That’s why I love postgres… and fuck anyone that requires double quoted identifiers for special casing.

permalink
report
parent
reply
6 points
*

Postgres normalizes table and field names to lowercase, unless you put them in quotes. It’s also case sensitive.

That means if you use quotes and capital letters when creating the table, then it’s impossible to refer to that table without using quotes.

It also means if you rename the table later to be all lowercase, then all your existing code will break.

Still a much better database than MySQL though.

permalink
report
parent
reply
4 points

That’s just cruel.

permalink
report
parent
reply
2 points

My work standards are table name all caps keywords all lower case

permalink
report
parent
reply
9 points

Singular table names? You savage…

permalink
report
parent
reply
15 points

It’s an English literacy thing - we have several non-native English speakers and using only singular avoids making those folks’ lives harder. Besides it’s really nice to autopilot that categoryid is a foreign key to the category table. It also simplifies always plural words… I haven’t yet written CREATE TABLE pants but if I ever do there’s zero chance of me creating a pantid.

permalink
report
parent
reply
11 points

no underscores either? What are we, apes?

permalink
report
parent
reply
4 points

I always thought they should be singular to be closer to the names we give entities and relations in a entity-relation diagram.

permalink
report
parent
reply
5 points

is syntax highlighting not sufficient to recognize the keywords?

permalink
report
parent
reply
8 points

Look at you with your color vision being all elitist. Some of us old bastards don’t see them pretty rainbows so much any more.

permalink
report
parent
reply
3 points

Ditto.

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 4.3K

    Monthly active users

  • 1.5K

    Posts

  • 35K

    Comments