January 19, 2021 at 12:00 am
Comments posted to this topic are about the item Mathematicians and SQL
Books in Celko Series for Morgan-Kaufmann Publishing
Analytics and OLAP in SQL
Data and Databases: Concepts in Practice
Data, Measurements and Standards in SQL
SQL for Smarties
SQL Programming Style
SQL Puzzles and Answers
Thinking in Sets
Trees and Hierarchies in SQL
January 19, 2021 at 1:57 pm
Hi,
From mathematics to SQL Server, a fast introduction to set theory
April 25, 2017, by Jefferson Elias
Introduction
In the previous article of this series “An introduction to set-based vs procedural programming approaches in T-SQL”, we’ve seen from a simple example that we could find actual benefit from learning set-based approach when writing T-SQL code.
In this article, we will carry on in this way by having a look at what a set is and what we can do with it in a mathematical point of view and how it’s implemented and provided to us in SQL Server( SQL Server Online Training) . We will also have a look at more “realistic” examples using Microsoft’s AdventureWorks database.
Set Theory and fundamentals
Set definition
In mathematics, we define set theory is a branch of mathematics and more particularly mathematical logic that studies collections of objects we refer to assets.
Don’t worry, we won’t do a lot of maths here as we will focus on practical aspects that we will use when writing T-SQL queries. Let’s just review some fundamentals of this theory:
The elementary set is the empty set. It’s a collection of zero objects and you will find in some references, it’s also called the null set. Its notation is Ø or { }.
A non-empty set contains the empty set plus one or more objects. This also means that a set can contain a set.
There is a fundamental binary relation between an object and a set: object to set membership. This is equivalent to the IN operation in a T-SQL query.
As a set can contain another set, last binary relation can be extended to set to set membership also known as subset relation or set inclusion.
Just like any arithmetic theory, set theory defines its own binary operations on sets. As an example, in number theory, we can find operations like addition or division.
Graphical representation of a set
In order to graphically represent an operation on sets, it’s common to use Venn diagrams, which show all possible logical relations between a finite number of different sets.
You will find an example of representation for a single set and its objects in following figure. This set contains the following objects: A, B, D, L, o, Q and z.
In following, we will use this representation in order to provide a good understanding of the product of each operation we will define.
January 19, 2021 at 2:53 pm
Joe,
I come at databases from a linguist's perspective understanding the communicative limitations that a numerically (ultimately binary) based system works off of. I've loved listening to mathematicians talk about logic but then commenced with their utter bafflement by asking them a simple question: "What is a good scale to use in order to numerically measure from Love to Hate?" And then, the simple response is that that's nice however, I don't see/agree with your scale because of it may miss subtle nuances that are specifically human i.e. "quality-based" versus being quantifiable. Something that any human would understand but not a math since it is so logical compared to the illogicality of the human whim.
Sarcasm is another item that numbers/mathematicians can't quantify. So, I agree with you that it is good to understand the mathematics that was "kinda" used to develop databases, however, you have to take into account that at the bottom of it all, semantics has a hard time being quantified and textual data still has to be stored somewhere. So I sing PRAISES for the ntext field to capture those thoughts.... 😎
Other than that, awesome post and enjoyed it.
Tom
January 19, 2021 at 5:00 pm
"No one will drive us from the paradise which Cantor created for us"
David Hilbert
1925
Cantor's work in set theory was a stunning development, but so was mathematical logic.
Did you know that there are *countable* models of set theory [1]? Think about it.
And let's not forget how Abraham Robinson used logic in the 1960s to formalize infinitesimals, solidifying Isaac Newton's intuitive use of them. He was an Engineer, by the way.
The recent applications of mathematics to computing science is remarkable (homomorphic encryption [2], for example).
My advice to students is to ignore computer science altogether and study pure mathematics.
It's far easier to go from mathematics to programming than the other way around.
[1] https://en.wikipedia.org/wiki/Skolem%27s_paradox
R Glen Cooper
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply