A UNIQUE experience
If you look at the postings on SQL forums, you will notice that people are sloppy. They expect that the reader can read their minds and figure out everything that’s not been posted. They seldom post...
View ArticleBETWEEN the two of us
This past August, I was looking at an online SQL tutorial. One of the sessions in it featured the BETWEEN predicate, which brought back some memories. In the early days of SQL on the ANSI X3H2 Database...
View ArticleQuantifier predicates
SQL is based on set theory and logic. The only bad news is that many programmers have never had a class on either of those topics. They muddle through using the Boolean operators in their programming...
View ArticleThe problem with averages
Broadly speaking, the function of statistics is to reduce a set of data to a single value which has some meaning. The most common example of this by far is the average, that we learned in school. This...
View ArticleCombinations, permutations, and derangements
Before I get to the database stuff, here are a few mathematical preliminaries. Factorials The factorial function is usually written as (n)!, and it is defined as the product of the first (n) natural...
View ArticleThe VALUES clause or building tables out of nothing
The VALUES clause is probably one of the most misused features in SQL. If you look at SQL forums online, you’ll see people use it as the second clause in an insertion statement, but they only use it to...
View ArticleGetting Out of Character
Pre-Unicode Younger programmers have grown up with ASCII and Unicode as the only ways of representing character data in a computer. But in the dark ages, before we invented dirt and entered into the...
View ArticleThe GROUP BY Clause
When you’re learning SQL DML, the most complicated clause is typically the GROUP BY. It’s a fairly simple grouping based on values from the FROM clause in a SELECT statement. It’s what a mathematician...
View ArticleFirst Normal Form Gets No Respect
Dr. Codd first described the relational model in a paper in Communications of the ACM (CACM 13 No 6; June 1970). Some more work followed up after that by other people, giving us normal forms and other...
View ArticleThe NTILE Function
The SQL NTILE() is a window function that allows you to break a table into a specified number of approximately equal groups, or <bucket count>. For each row in a grouping, the NTILE() function...
View ArticleDepartment of Redundancy Department
Ever wonder all the reasons that we use databases instead of file systems? While we don’t think of it too much anymore, the first reason that databases came into existence was to remove redundancies....
View ArticleSQL Logic
In this article, I will discuss the history and thinking behind several types of logic that are typically associated with writing relational database code. Because of how relational databases implement...
View ArticleThe CHECK() Constraint
One of the many ways a relational table differs from the file structures used by pre-relational storage systems is that the tables, rows and columns can have constraints on them. This allows you to...
View ArticleLIKE Constraints
In this article, I will cover a bit about the LIKE operator, including how it works, and a bit of history about why it is like it is. After establishing this, I will discuss a bit about how you can...
View ArticleBad Data and Dirty Databases
Many years ago, my wife and I wrote an article for Datamation, a major trade publication at the time, under the title, “Don’t Warehouse Dirty Data!” It’s been referenced quite a few times over the...
View ArticleUniqueness, Keys, and Identity
If you’ve ever had a traditional logic course, you’ll have run into “The Law of Identity” as the founding principle of all Western thought. It says that: “To be is to be something in particular; to be...
View ArticleRounding Numbers
I would hope by now everybody has figured out when you see a price like $39.99 that it might as well be forty bucks. Dropping that penny from the price is done is to fool the consumer! Since we read...
View Article