Predicate relations or join on clause

Some of my friends vehemently prefer the SQL-89 predicate relations definition of joins.

Some of my friend vehemently perfer the SQL-92 “join on” clause, aka ANSI joins (which always puzzles me since I think both are defined in ANSI standards.)

 

Some folks (and this probably doesn’t include my friends) have called the Oracle join specification (+) “an abomination.”

I think each has strong points and drawbacks. In Oracle both are still legal.

In which syntax is it quicker to discover all the tables involved in a particular query? (hint: the one where you list all the tables immediately after the from clause.) Of course inline views and “with” common table expressions have diluted that old advantage of ’89.

In re: (+) being “an abomination” that holds only if you were never taught to read it correctly. It distinctively and succinctly documents the table having null tuples “added” to it to equalize the join.

Neither syntax is inherently “better” and just as perfectly structured programs can always be written in BASIC6 and spaghetti can be written in Pascal, perfectly clear syntax can be had in either 89 or 92. (notice I didn’t say Wirth was stupid. When he wrote his article there were MANY amateur programmers creating spaghetti in bad ports of Basic who didn’t get the proper schooling of Kemeny and Kurtz to write structured code. Wirth noticed that it was extremely easy to use goto poorly and harmfully.)

 

If you want an easy to read query, you can have an easy to read query!

In 89, put the tables in an order. Add the join clauses in that same order and always put the (+) denoting sets to be expanded on the right.

Then put all the filters in, in the table order of the from clause and the column order of the columns of each table.

Do that and you’ve got a complete, well-formed, repeatable and easy to digest query.

There are a few equally clear variants, and you can also write spaghetti. If you start like this (and especially if you have a defined order for your tables through-out your application suite) your code will be probably be extremely easy to read.

Likewise 92. In 92 you might have to look through more code than you’d like to find all the tables involved in the query, but it is difficult for even the creatively obtuse to disguise the join criteria.

I count myself amongst those who rue that they stuck in “LEFT” and “RIGHT” and didn’t just make it all earlier to later implicitly. And others have already pointed out that using the shorthand NATURAL means you have to look in the dictionary to see which columns participate in the join.

This shouldn’t be a religious war. Bad code should be re-written to be readable because sooner or later some human will have to support it. But that is a distinct issue from re-writing clear 89 syntax just because you don’t like 89 syntax.

Now one more question: Why haven’t we re-written the SQL standard to include the few little bits that are missing to make it an orthogonal representation of relations?

Posted in Oracle, Thinking Clearly | Tagged | 2 Comments

Temporary? Sewage from the Washington Post

The Washington Post has slyly entered the liberal media campaign against D. Rump (take the pledge to *NOT* give his full name social media hits as well as to document whence come his policy proposals) by temporarily publishing a cartoon depicting Cruz’s children as monkeys. Nice play Post – if you no longer care about your integrity and reputation as an actual news outlet and home to journalists. Let’s review: 1) You gave Cruz a media storm 2) You created sympathy for Cruz amongst the folks who are certain of your liberal bias 3) You admitted that your editor is completely asleep at the switch 4) You lowered yourself to the rung of publications several layers of sewage below the surface where it is perfectly fine to attack innocent children 5) You washed your hands of all this with a note 6) Good luck with the hand washing, Pilate – at least it is sewage, not blood.

Anyone who believes this was inadvertent likely believes you are an objective source of news. Shame on them. Shame on you.

Posted in politics, Thinking Clearly | 2 Comments

#SyrianRefugees

So how much would it cost to house 50,000 Syrian immigrants in luxury for as long as it takes to be sure they are safe?

Nothing, compared to our humanity.

This entire issue is being presented as an either/or “I’m right and you are wrong” issue. We absolutely should take a share of world-wide refugees on a continuous basis over time. That should be a general policy of every stable free country the even pretends to be a member of the community of nations.

Ah, but we do have some specifics to consider.

If they happen to be from a region (neither ethnicity nor race nor religion) where it seems likely persons with bad intentions will infiltrate the refugee pool, I don’t find it innately offensive that we take our sweet time getting the innocents completely free into our society.

Done poorly it could be offensive.

Done well it could be a model for civilization.

Oh, and by the way: Some folks are trying to liken this to the almost certainly illegal detention of citizens of Japanese extraction in World War II. If you are paying attention, that should not pass the laugh test for more reasons than I’ll try to enumerate. But I will give you a few off the top of my head:

First, the WWII interment included citizens as opposed to petitioners for entry.

Second, the WWII interment probably expropriated wealth from citizens without due process.

Third, the WWII interment (whether for lack of resources or wanting to punish persons of Japanese extraction for the bombing of Pearl Harbor whether or not they had anything to do with it or both) involved facilities that could be generously described as austere.

Okay. I hope that is enough that you will actually laugh out loud if someone tries to convince you that detaining #SyrianRefugees for a while has any correspondence with the WWII interment of citizens of Japanese extraction.

What we should be proposing for the #SyrianRefugees should be so good and laden with features (such as education, cultural opportunities, and entertainment) that the candidates for entry will be disappointed upon release from the screening facility. It should be so good that someone who infiltrated with bad intentions will exit into society with a new world view. Finally: Give the #SyrianRefugees who are candidates for entry to the US a legitimate opt-in, opt-out choice for alternative placement in some other country. We’ll know our program is not good enough if there are not plenty of candidates for entry into other countries who will leap at the chance to come here knowing they may face a protracted stay at the screening facility.

Dear Congress:

Do the right thing. I’m pretty doggone sure you can find some money for this in defense and intelligence budgets. It will probably cost less than one fighter jet. And if you’re more interested in adding up the financial ledger than doing the right thing as its own reason, get your staff to estimate the public relations (okay, propaganda) value of this approach over those shouting “Death to America.” And please remember: Most of the refugees are just plain folks running away from trouble they had no means to fight against. If we take 50,000 or 100,000 it would be a difficult task for the bad authorities in the currently bad places these fellow humans are fleeing to place more than one or two infiltrators. So let’s treat all of them extremely well as we provide them a safe haven. And release them carefully.

Posted in politics, Thinking Clearly | Leave a comment

Merry Christmas and Happy Holidays!

I’ll be saying Merry Christmas, perhaps as early as the start of Advent. I might also toss in a Happy Holidays now and then and the only reason I won’t say “Happy Hanukah” to my Jewish Friends is I can’t get agreement on spelling or pronunciation. But I won’t be offended by any business or person who says anything else or even is rude about my greeting. First, Christ would not like it. Second, the First Amendment has got freedom of religion just right: The state cannot establish a particular church nor impede the free exercise of a particular church. And while I might reward a business with a nice Christmas display after Thanksgiving, I won’t be boycotting a business for whatever reason they decide to not have a Christmas display. That would be downright un-Christian.

Peace.

Posted in politics, religion, Thinking Clearly | Tagged , , , , | Leave a comment

Improved #IranDeal

The existing #IranDeal proposed by the Obama administration for approval by congress involves a considerable amount of questionable verification procedures. For the moment, let us assume the verifications will all work and even that Iran will make no attempt to circumvent the proposed deal. In that case, it is entirely reasonable to expect Iran to have a nuclear arsenal within twenty years. With a modest amount of circumvention and subterfuge that could be as little as twelve years, but let us not get side tracked by splitting hairs over eight years more or less.

The Obama administration and various pundits claim this is the best deal we are going to get and that the alternatives are all worse. My response is that plenty of alternatives that would be readily agreed to by Iran exist. They are too numerous to list, so I will just relate my personal favorite, which tends to stabilize the region, eliminate any reason for Israel to make a preemptive strike, and generally sets the stage for Iran to work on the welfare of its people and economy.

My favorite version of an improved #IranDeal is this: Iran gets a nuclear arsenal NEVER.

Apart from removing the time limits on the various inspections and quantities in favor of Iran getting a nuclear arsenal NEVER, we sweeten the deal: As long as Iran does not have a nuclear arsenal, we promise to not invade them. (And they still get all the accommodations in the current deal.)

This is a far better deal for Iran, and if you doubt they will accept it, offer it to them.

I do not respect any counter arguments or reasoning claiming to understand the minds of those in  power in Iran regarding their strategic interest so as to presume they will not accept this version of the deal. Argue all you want why they won’t accept the deal. OFFER the deal genuinely and they will accept. Prove me wrong, don’t try to argue me wrong. When a simple test is available, it is idiotic to argue that you know the minds of someone else. So rather than writing a tome about exactly how I think it is in Iran’s strategic interest to avoid the costs and risks of a nuclear weapons program, just do this: OFFER the deal.

Posted in politics, Thinking Clearly | Tagged , , , , | Leave a comment

test blog entry to check filter to oaktable.net

nothing to see here, just testing a filter to a technical blog aggregator.

Posted in politics | Tagged | Leave a comment

IRAN “Deal” is a plan for IRAN to have nukes within a dozen years

The Iran “Deal” trading a removal of economic sanctions (which make it difficult economically for Iran to pursue development of nuclear weapons and delivery mechanisms) for the promise of a delay in developing nuclear weapons by Iran is a short sighted agreement.

In fact, even assuming that Iran perfectly adheres to all it is supposed to do, this “deal” is a plan for  Iran to be within its rights to be able to resume building a nuclear arsenal in a decade and probably have significant throw weight within a dozen years.

Are we convinced a mere decade will transform Iran into a nation we can trust with nuclear weapons?

Not likely.

No nukes for Iran now, No nukes for Iran tomorrow. No nukes for Iran for a *LOT* more than a dozen years. Stop this plan. Stop any plan for Iran to eventually have nuclear weapons.

Posted in politics, Thinking Clearly | Tagged , , , , , | Leave a comment