Understanding Relational Databases

(RDBMS)

Posted by: Aubrey W Love on August 24, 2021
Introduction

Most aspects of the computer world, especially programming languages, evolve based on need and current trends. Programming languages that are not based on strong foundations will almost certainly fail or they will change often due to very rapid technological changes and trends. T-SQL is one of the long-haul programming languages that has stood the test of time. Mainly because it has strong foundations – mathematics. You certainly don’t need to be a mathematician to write good SQL code (although it does help), but if you understand the key principles of SQL foundations, the better you will understand the SQL language. Without understanding these foundation principles, you can still write T-SQL code, but not quite as efficiently or effectively.

Evolution of T-SQL

As mentioned in the “Overview”, T-SQL is based on a mathematical foundation. Learning just a few of the key principles will help you understand programming in T-SQL. At that point, you will be able to code in T-SQL rather than writing T-SQL in a procedural method. Yes, there is a difference. Later, as you progress as a DBA, you will start to see the difference more clearly. The image below outlines the building blocks of T-SQL.

T-SQL is the primary language used to manipulate and manage data in Microsoft’s relational database management system (RDBMS), whether that’s on premises or in the cloud (Microsoft Windows Azure SQL Database). T-SQL is referred to as a dialect of standard SQL. SQL is a standard registered on both the International Organization for Standards (ISO) and the American National Standards Institute (ANSI). Both standards for SQL are basically the same. However, the SQL standard continues to evolve over time as new trends and needs progress.


History of T-SQL

History or SQL standards (as of this publication)

  • SQL-86
  • SQL-89
  • SQL-92
  • SQL-1999
  • SQL-2003
  • SQL-2006
  • SQL-2008
  • SQL-2011
  • SQL-2016
  • SQL-2019
It is important to note that all database vendors, that is SQL programming languages, implement a dialect or form of SQL as their foundation. Relatively speaking, all vendors such as Microsoft SQL Server, Oracle, MySQL, etc. begin with the SQL foundation. However, each of the vendors decides which features of SQL standard to implement, and which features they want to leave out. Each vendor implements additional extensions where they feel that a feature is not covered by the SQL standard.

Often, you will find that when you write SQL code, although you are writing in the T-SQL dialect, you may come across instances where there is a SQL standard and a T-SQL variant of the same command. One such example would be if you are wanting to set a value as “not equal to”. The T-SQL command is != and the SQL standard would be <>. When in doubt, always use the SQL standard unless there is an important benefit that is not covered by the SQL standard.


Set Theory

So, what is a set within a set theory? This was best described by Georg Cantor in his article “Algebraic Numbers” that was first published in 1874.

“By a “set” we mean any collection M into a whole of definite, distinct objects m (which are called the “elements” of M) of our perception or of our thought.”
--- Georg Cantor, in “Georg Cantor by Joseph W. Dauben (Princeton University Press, 1990)
Set theory is a fundamental concept in the world of databases and plays a crucial role in the functioning of a relational database management system (RDBMS). It provides the foundation for organizing and manipulating data within tables.

In simple terms, set theory deals with collections of objects or elements. In the context of RDBMS, these objects are represented as rows in tables. Sets can be combined using operations such as union, intersection, and difference to perform various data operations.

One key aspect of set theory is that it allows for efficient retrieval and manipulation of data. By representing data as sets, RDBMS can quickly search for specific information based on certain conditions or criteria.

Additionally, set theory enables consistency and integrity within the database by enforcing constraints such as unique values or referential integrity between related tables.

Understanding set theory is essential for anyone working with relational databases. It forms the basis for designing efficient database structures and performing complex queries to extract meaningful insights from vast amounts of data stored in an RDBMS. So next time you work with an RDBMS, remember that behind its functionality lies the power of set theory!


Predicate Logic

Predicate Logic is a fundamental concept in the world of Relational Database Management Systems (RDBMS). At its core, Predicate Logic involves using logical statements or predicates to describe relationships between different entities within a database.

In RDBMS, Predicate Logic helps define the conditions that must be met for data retrieval and manipulation. These conditions are expressed through various operators such as equality, inequality, greater than, less than, and so on. By using predicate logic in queries and commands, users can specify precisely what data they want to retrieve or modify from the database.

One important aspect of Predicate Logic is that it allows for complex expressions by combining multiple predicates with logical operators like AND and OR. This flexibility enables users to create sophisticated queries that can extract specific information based on various criteria.

For example, let's say we have a relational database containing information about employees. Using Predicate Logic, we can construct a query to retrieve all employees who have a salary greater than $50,000 and work in the sales department. The query would combine two predicates - one for salary comparison and another for department identification - using an AND operator.

Understanding Predicate Logic is crucial when working with RDBMS because it provides the foundation for expressing precise conditions and extracting relevant data from databases efficiently. It empowers users to make complex queries while ensuring accuracy in retrieving desired results without unnecessary clutter.

Wrap Up

Now that we have the basics of this somewhat understood, let's move onto the next article - "Step 5 SQL Server Data Types". Data types are something that is at the fundamental level, and you really need to grasp that before you can create good tables, views, etc.



Want to start your own blog or maybe
dip your toes into the world of writting?

Click on the following links.

Qries
HubSpot Website Design Services