Category: Programming

Performance differences between IN and EXISTS

Very often I hear people wondering if it’s better the EXISTS or the IN operator. Let’s start by saying that the two operators behave differently when NULL values are involved (see this post).

If you are sure that the field used to join the tables does not include NULL values then the IN operator “generally” performs better than EXISTS. I say “generally” because this is not always the case. For example consider the following query:

Read more...

NOT IN vs. NOT EXISTS when NULL values are involved

NOT IN does not behave as you would expect when NULL values are involved. Suppose you have the following tables:

Now try the following query:

   
SELECT *
FROM table_a a
WHERE a.cd_field NOT IN (SELECT b.cd_field FROM table_b b);

Does the previous query return any row? The answer is NO it doesn’t, even if there is a value (2) in table_a.cd_field which is not present in table_b.cd_field.

Read more...

Funny long jokes and aphorisms about programming (and programmers of course)

Here are some funny jokes and aphorisms about computer programmers and programming in general:


A man is smoking a cigarette and blowing smoke rings into the air. His girlfriend becomes irritated with the smoke and says, “Can’t you see the warning on the cigarette pack? Smoking is hazardous to your health!“To which the man replies, “I am a programmer. We don’t worry about warnings; we only worry about errors.”


A programmer is walking along a beach and finds a lamp. He rubs the lamp, and a genie appears. “I am the most powerful genie in the world. I can grant you any wish, but only one wish.“The programmer pulls out a map, points to it and says, “I’d want peace in the Middle East.“The genie responds, “Gee, I don’t know. Those people have been fighting for millennia. I can do just about anything, but this is likely beyond my limits.“The programmer then says, “Well, I am a programmer, and my programs have lots of users. Please make all my users satisfied with my software and let them ask for sensible changes.”

Read more...

Funny short jokes and aphorisms about programming (and programmers of course)

Here are some funny jokes and aphorisms about computer programming and programmers in general:


There are only 10 types of people in the world: Those who understand binary, and those who don’t.


It’s always a long day, 86,400 won’t fit into a short.


Why do programmers always mix up Halloween and Christmas? Because Oct 31 equals Dec 25.


“Knock, knock.” “Who’s there?” very long pause… “Java.”


Programming is like sex: One mistake and you have to support it for the rest of your life.

Read more...