Skip to content

The SQL Myth

October 6, 2017
tags: ,

Sometimes people make an assumption and then state it as a fact. Those that hear it, pass it on, and before you know it the mistaken assumption takes on a life of its own. This is what has happened with the computer language named SQL (pronounced ess-que-ell).

Where did SQL come from?

How did it become the query language of choice for relational databases?

Why are so many people confused about its name and how to pronounce it?

The relational database model was invented by Edgar F. “Ted” Codd, and published in a paper in 1970. Codd was working for IBM at the time, but IBM did not initially commercialize the idea. A group at IBM created a language to work with an internal relational effort. The language, SEQUEL, was an acronym for Structured English QUEry Language. The Structured English part related to the fact that statements in the language were very similar to ordinary English language statements, but were more highly structured. The QUEry Language part related to the fact that one of the things you could do with the language was to ask questions of a database. The language also could be used to create and destroy databases, as well as provide security.

IBM was finally forced into releasing a relation product when rival Relational Software, now Oracle, released one first. By that time, the name SEQUEL had already been trademarked by another company, for an unrelated product. IBM decided to drop the vowels in the name and go with SQL. This caused a couple of points of confusion.

  1. The people at IBM who were accustomed to calling the language SEQUEL continued to do so, causing that pronunciation to proliferate throughout the community, even though the name had been officially changed to SQL, pronounced ess-que-ell.
  2. People who had not been part of the original project assumed that SQL was an acronym, and that the letters SQL stood for Structured Query Language. This was an easy mistake to make, since that is what the letters had stood for in the original, unofficial acronym for the language.

The problem with calling SQL an acronym for Structured Query Language is that SQL is not a structured language, as computer scientists understand the term “structured language.” In the early days of computers, all computer languages were unstructured. By that I mean that it was possible for execution to jump from one place in the code to any other place. In many of those languages this was accomplished with a GOTO command. The result was often code that was almost impossible to understand or debug, derisively called “spaghetti code.”

In the 1970s, to overcome this problem, a discipline called structured programming came into use. It forbids the indiscriminate jumping from one place in a program to another. The GOTO command was banished in structured languages and programs became much more reliable.

SEQUEL, which was invented at about the same time that structured languages were first talked about, was not a structured language. It included GOTO functionality. SQL, when it was officially released to the world, retained that functionality and still does. It is thus not a structured language. However, as its original name implies, its syntax is a kind of structured English.

So what is to be done? People who have been pronouncing SQL as “sequel” for their entire careers will probably continue to do so. However, the difference between a structured and an unstructured language is important. We don’t want to return to the bad old days of spaghetti code. It’s important that we call a thing what it is and that we don’t call a thing what it isn’t. SQL is not a structured language, query or otherwise, and should not be called one.

Advertisements

Why Would a Perfectly Healthy, Wealthy, and Happy Person Hope to Die?

October 1, 2017

In the October 2014 issue of The Atlantic magazine, oncologist Ezekiel J. Emanuel published a 5,000-word article with the provocative title “Why I Hope to Die at 75.” The article was accompanied by a photo of the author with a broad grin on his face. He did not look forward to an early death because he was depressed, but rather for some, to my mind, dubious philosophical reasons.

Emanuel predicts that by the time he reaches age 75 he will have lived a complete life. He will have lived to see his children grow to adulthood and have children of their own. He will have made whatever contributions to the world that he is likely to make. He wants to go out while still on top, avoiding the downsides of hanging on too long.

Addressing fellow Americans specifically, Emanuel made several assertions, including:

  • Americans today may live longer than their parents, but they are likely to be more incapacitated.
  • Over the past 50 years, health care hasn’t slowed the aging process so much as it has slowed the dying process.
  • Medical science has been ineffective at countering Alzheimer’s disease and other dementias.
  • Older people become slower, both physically and mentally, and are less creative.
  • Living longer puts a caregiving burden on the next generation.
  • Parents sticking around prevent their offspring from assuming the mantle of the head of the family.
  • Children and grandchildren will remember you as stooped and sluggish, and forgetful and repetitive, rather than active, vigorous, and engaged.

Emanuel looks at the glass and to him it appears to be half empty. I look at the same glass and it is clear to me that it is half full. There is still quite a lot of water in it.

When Emanuel wrote his piece for The Atlantic, his seventy-fifth birthday was 18 years in the future. For me today, my seventy-fifth birthday is less than three years away. From where I stand, his assertions seem to ignore the major strides being made in knowledge of healthy living and in learning the causes of and remedies to the declines caused by aging. Let’s take his assertions one by one.

  • Americans today may live longer than their parents, but they are likely to be more incapacitated.

This does not reflect my experience, or that of many of my contemporaries. Both of my parents were in worse shape than I am now, at a much younger age. They were overweight and sedentary, suffered from high blood pressure, and had heart problems and diabetes. None of those things are true of me.

Both of my parents have now passed on, my father at an age seven years younger than what I am now. Sure, there are some people today who are in worse shape than their parents were at the same age, but I believe they are in the minority. Fewer people are smoking today than was true a generation ago. More people may be obese today than a generation ago, but you will not find among them the people Emanuel derisively calls the American immortals. He is referring to people who exercise, watch their diet, and take nutritional supplements. These people have the biological age and disease profile of people of a significantly younger chronological age. They are not chasing immortality. They are merely working to keep robust health and high functionality for as long as possible, based on current knowledge.

  • Over the past 50 years, health care hasn’t slowed the aging process so much as it has slowed the dying process.

The fallacy with this observation is that medical knowledge and practice of the past 50 years is not the same as the medical knowledge and practice of today. Fifty years ago, twenty-five years ago, even ten years ago, there was no field of study whose object was the halting and reversal of age-related decline. Today, the new field of regenerative medicine is exploding, with major advances being announced on almost a daily basis. The old rules don’t apply any more.  Whereas Western medicine has traditionally relied on drugs to cure disease, now genetic engineering, molecular machines, and other recent technologies are opening entirely new avenues to treat the damage caused by aging and thereby to restore robust good health.

  • Medical science has been ineffective at countering Alzheimer’s disease and other dementias.

The fallacy of this assertion is the same as the previous one. The medical science of the past had no idea what was causing Alzheimer’s disease, so of course was ineffective in countering it. With powerful tools that have recently come on line, researchers are finally figuring out causes, and effective interventions are appearing on the horizon.

  • Older people become slower, both physically and mentally, and are less creative.

This assertion is largely true, but so what! I cannot run as fast or as far as I could when I was 30, but I still run. Perhaps regenerative medicine will someday return me to the physical ability I had at age 30, but even if that does not happen, I expect to be able to continue to engage in many activities that I enjoy. Today, it may take me a little longer to solve a hard sudoku puzzle than it did when I was younger and I may not be as successful at blitz chess as I used to be, but I can still be as competitive as ever at classical chess.

I don’t think I am any less creative than I was at a younger age. I didn’t win any Nobel prizes back then either. I am still writing books and articles and am about as prolific now as I have ever been. I expect that to continue until I am well past age 75. Even Emanuel mentions an eighty-year-old collaborator who was still making major contributions to his field. He dismissed him as an outlier. I suspect that there are a lot more “outliers” than Emanuel imagines, many of them among thoe Emanuel calls American immortals.

  • Living longer puts a caregiving burden on the next generation.

Regardless of whether lives are longer or shorter, a caregiving burden will be placed on the next generation. If lives are longer, the next generation is more mature and better able to handle the responsibility. Not only that, but the caregiving burden is much diminished if it is healthy life that is extended rather than prolonged illness. People who are consciously trying to live longer are doing so by making lifestyle choices that extend healthy life, not just calendar years.

  • Parents sticking around prevent their offspring from assuming the mantle of the head of the family.

This is a pretty weak argument. But at any rate, should not be an issue for most people. My grown children have become the heads of their own households. I didn’t have to die for that to happen. I don’t think my experience is unusual.

  • Children and grandchildren will remember you as stooped and sluggish, and forgetful and repetitive, rather than active, vigorous, and engaged.

This argument is even weaker than the previous one. What people think of me after I am gone is no concern of mine. They will have their own lives to live and they will think what they will think. My legacy will be the things I have done to help people throughout my life. Regardless of that, I don’t believe I am fated to end up stooped and sluggish, forgetful and repetitive. I am working hard to maintain my health and vitality, and as new medical advances are made, I intend to take advantage of them to extend healthy life.

After 5,000 words on why Emanuel does not want to live past age 75, in the last paragraph, he gives himself a golden parachute. He says “And I retain the right to change my mind and offer vigorous and reasoned defense of living as long as possible.”

What a cop out.

My advice to you? “Live long and prosper.”

A Unique Experience

September 14, 2017
tags:

The recent total eclipse that we experienced in Oregon and all across the United States was one of those things that come along perhaps only once in a lifetime. It definitely took me out of my ordinary, business-as-usual, lifestyle.

 

Amazing as the experience was, I think most people don’t realize just how unique eclipses here on Earth really are.

I’m amused every time I hear someone say that something was “more unique” or “the most unique.” The word ‘unique’ means that there is only one of whatever is being described. There are no degrees of uniqueness. It’s not possible for something to be more unique than something else. A unique experience is one that cannot be duplicated.

Having said that, and knowing that a total eclipse of the sun happens somewhere on the surface of the Earth once every eighteen months, there is a sense that a total eclipse of the sun, as seen from the Earth, is really unique.

The fact that we can see total eclipses at all is due to a freak coincidence that is so unlikely that it probably does not occur anywhere else in the entire Milky Way galaxy.

The Milky Way contains somewhere between 300 billionand 400 billion stars, and just about every one of them has at least one planet orbiting it. An eclipse happens when something, such as a moon or another planet, comes between a planet and its star.

A partial eclipse occurs when something comes between a star and an observer on a planet, when something comes between the two that does not completely block the light from the star. This slide shows what the sun looks like when Venus comes between the Earth and the Sun.

This is called a transit of Venus, because Venus appears to move across the face of the sun. You wouldn’t even know this was happening if you weren’t looking for it because the dimming caused by the transit is so slight.

Another example of an eclipse, but from the surface of Mars rather than Earth  is the eclipse of the Sun by Mars’ moon Phobos. As is the case with the transit of Venus, Phobos is too small to completely eclipse the sun, so there is a ring of brightness around it.

 (triple exposure)

I mentioned that the total eclipses that we see on Earth are due to a freak coincidence. That coincidence is the fact that the sun is 400 times larger in diameter than the moon, and the moon is 400 times closer to the Earth than is the sun. That means that during a total eclipse, the moon EXACTLY covers the disk of the sun, known as the chromosphere. This allows us to see the sun’s corona, which at any other time is too dim to see because of the overpowering brightness of the chromosphere.

What does it take for a total eclipse to be observed from the surface of a planet?

  • The planet must have a moon that orbits in the same plane as the line of sight between the planet and its star.
  • The ratio of the distance between the planet and the moon, and the planet and its star, must be the same as the ratio of the diameter of the moon to the diameter of the star.
  • The planet must be habitable, with a solid surface, a breathable atmosphere, and be in the star’s “Goldilocks” zone where the temperature is such that liquid water can exist on the surface, not too hot and not to cold.
  • Intelligent beings, capable of experiencing a sense of wonder, must exist to appreciate the eclipse.
  • All the above conditions must occur at the same time.

What are the odds that these conditions will be met? The odds are VERY long. In fact, out of the hundreds of billions of stars in the Milky Way, it is most likely that there is only one planet in one star system, out of all those hundreds of billions, that satisfies ALL those conditions. It’s the planet you are on right now. On the scale of the Milky Way galaxy, a total eclipse of a star is indeed a UNIQUE experience. Next time you get a chance to see one, go for it.

Find What You are Looking for, Easily

August 8, 2017

For a long time, perhaps thousands of years, people have described any near-impossible search task as “trying to find a needle in a haystack.” This task is so hard because the haystack is a huge random jumble of hay stalks and a needle is a very tiny, nearly invisible sliver of metal. If you tried to pull a single piece of information out of a computer file containing millions or even billions of similar items, your job would be near impossible too. Thankfully, relational databases are not random jumbles of items, but are organized according to a rigid structure. This structure enables you to quickly and easily retrieve the information you want, using a query written in SQL, the international standard query language, which is supported by all major relational database management systems today.

At one level, SQL is a really easy computer language to learn, at least for English speakers. That’s because its syntax and structure is very similar to the syntax and structure of English. In fact, it could be considered a more highly structured and precise form of English. People can read a statement that contains some ambiguity and understand its intent, based on context. Computers, at least for now, are not able to do this, so when writing code for a computer, one must be very precise. SQL gives you the tools to write with the needed precision.

Although it’s fairly easy to gain enough knowledge of SQL to do useful work, SQL is sophisticated enough to be used to make highly nuanced queries. Advanced users will be able to pull just about anything out of a database that they want, even one with a very complex structure.  The need to retrieve specific data from a database is widespread across all kinds of organizations. Learning SQL will provide you with a broadly applicable skill that is much in demand today, and will be even more valuable in the future. My new online course will get you started. Click the link to find out more. http://pioneer-academy1.teachable.com/p/basic-sql-queries

Now Is the Time to Learn SQL

July 20, 2017

I have created a brand new online course on SQL, specifically designed for people who are not database experts. It will give you the knowledge and tools you need to be able to operate on any relational database that allows access to its underlying SQL. Practically all database management systems provide such access. The course is a highly interactive hands-on course. You download a free database management system and solve problems by running SQL queries against a sample database. The course is personally administered by Allen Taylor, the course developer and best-selling author of multiple books on database and SQL. You can discuss each concept and challenge with Allen and with your fellow students.

The course, SQL for Business Analysts is ready to go, but will not be “officially” released until August 1. If you register now, before the official roll-out, you can do so for half the regular price, a 50% discount. Click here to find out more.

 

Refine Database Retrievals with Comparison Predicates

July 19, 2017

domenico-loia-310197 (1)In a previous post, we saw that, using SQL, it’s easy to retrieve all the data contained in a database table with a simple SELECT statement, such as:

SELECT * FROM customers ;

We also saw that it’s almost as easy to retrieve only what we want from a table, leaving behind all the rest:

SELECT * FROM customers

                WHERE state = ‘CA’ ;

That returns only the customers located in California.

The equals operator (=) is an example of a comparison operator and when two operands are compared with the equals operator, it is called a comparison predicate. A comparison predicate either evaluates to a true value or a false value. A customer is either located in California or she is not.

In addition to the ‘is equal to’ operator, there are five additional comparison operators. They are:

Is not equal to (<>)

Is less than (<)

Is greater than (>)

Is less than or equal to (<=)

Is greater than or equal to (>=)

All six of these operators may be used with numerical operands. It makes sense to say that:

One number is equal to another number

One number is unequal to another number

One number is less than another number

One number is greater than another number

One number is less than or equal to another number

One number is greater than or equal to another number

Similarly, all six operators make sense when applied to dates and times. However, all six do not make sense when applied to text strings. One string may be equal to another string, or unequal to it. However if you try to apply any of the others, such as less than, you will probably not receive the result you are looking for.

Comparison predicates enable you to zero in on the exact information that you want to extract from a database.

Four Myths about SQL

July 17, 2017

 

 

 

 

 

 

Some people may decide not to learn SQL because of something they may have heard, or just assumed, that is completely untrue. Myths such as these can stand in the way of people moving ahead in their careers. There are number of these myths that hold people back, but I would like to discuss just four of them.

  1. 1. SQL is a programming language and I am not a programmer. Although SQL is a language, it is not a programming language in the way you are probably thinking. Most computer languages are procedural languages. To use them, a programmer creates a procedure in which a series of instructions are written in a step-by-step manner to cause a computer to perform some action. The programmer must understand what is going on at a deep level in order to generate the correct sequence of instructions.

 

SQL is not like that. It is not a procedural language. It is called a non-procedural language because there is no need to write a procedure. With SQL all you need to do is write a statement that tells the computer what action you want it to perform. The DBMS figures out the details of how to do that, then goes ahead and does it.

  1. Knowing SQL would be of no value to me since I don’t have a programming job. Although it is true that information technology professionals have the most to do with databases, these days practically everyone in an organization has some exposure to them and may need information contained in them in order to do their jobs. You may not work with a database every day, but occasions will arise when you will need a fact contained in a database and there is no IT professional available to obtain it for you. Anyway, you should be able to perform basic database retrieval operations for yourself. It makes you a more valuable employee.
  2. You need to be some kind of brainiac to understand SQL. There is a mystique surrounding computers in general and SQL in particular that they are beyond the comprehension of ordinary people. This is particularly untrue about SQL, which consists of simple statements that are very similar to ordinary English-language sentences. If you can compose and write down a sentence, you could just as easily write an SQL statement that would perform a query.
  3. Knowing SQL won’t be of any value to me. This is the biggest myth of all. Our world today is totally dependent upon computers and the data stored within them. A lot of jobs will become obsolete and disappear within the next ten years, but jobs associated with information technology will not be among them. Learning SQL could be one of the most effective things that you could do to guarantee your future employability.