Where do the similarities between SQL and "Mathematical Reasoning" begin and end?

277 Views Asked by At

While working in the industry I became pretty familiar with MySQL and TFS doing different jobs as a tester and a sysadmin. I had to write a lot of queries to create reports that showed computers or work items with certain attributes or deficiencies. Now I am taking a class called "The Foundations of Mathematics" and I am noticing some similarities between those experiences and this logic.

For example: A = {1,2,3,4,5}

Consider the statement: $1 \in A$

To me, this is maybe similar to writing a query on a table called A with a column called 'nums' and the records 1,2,3,4 and 5. The query would maybe say something like:

SELECT * FROM 'A' WHERE 'A.nums'=1;

Why are there so many similarities between SQL and logic? Better yet, where does the overlap stop working?

Thanks for your help! I don't want to bog myself down by getting caught up in the similarities between the two, but if they really are the same then I'd like to continue to use SQL to understand this math.

3

There are 3 best solutions below

0
On

SQL in its various dialects is built to query what is knows as Relational Data Base Management Systems. The "Relational" concepts stems from Relational Algebra. As you can see, Relational Algebra is conceptually a mathematical concept, that became of interest to the computer word in the 70s. Here are some Relational Algebra - SQL implementations.

The "overlap stops working" as you put it, where the SQL dialect and the underlying database don't fully conform the relational theory. This is specialy true for the operations of Intersection and Difference.

Note: Unfortunately, Relational Algebra is not as easy to understand as SQL!

2
On

$1\in A$ is closer to the subquery EXISTS (SELECT * FROM A WHERE A.num=1);

But, yes, you can use your understanding of SQL to help grasp mathematical concepts because relational databases are basically built from maths; a theory called relational algebra to be precise.   Set operations and set constructions in particular are essential components of Structured Query Language.

0
On

OK, at least I get to provide some stable/wikipedia links:

Engineering is to ZFC / Math as IMS / DLI is to DB2 / SQL.

So, you might say the similarity is that with both math and SQL you don't get your hands too dirty with realities - employing logic is the key concern.

I found this quote here,

Electrical Engineering is a compromise between the requirement for reliability and the financial investment. The principle is quite simple: Install spare equipment only by the necessary amount and number. In fact, this principle is quite similar to that in the other fields of engineering: An increase in reliability can be only achieved at the expense of increasing the financial investment to be made.

IBM designed the IMS with Rockwell and Caterpillar starting in 1966 for the Apollo program, where it was used to inventory the very large bill of materials (BOM) for the Saturn V moon rocket and Apollo space vehicle.