This has explained the human memory process. Since human tends to forget, and can't live forever, a new approach is created to enhance storing information using Database technology.Memory is the ability to take in information, store it, and recall it at a later time. In psychology, memory is broken into three stages: encoding, storage, and retrieval. Stages of memory: The three stages of memory: encoding, storage, and retrieval. Problems can occur at any stage of the process. ~lumen
Credit: CC0 Public Domain
Introduction:
![](https://blogs.bmc.com/wp-content/uploads/2016/06/database-blue.png)
Contents:
The database uses tables for storing data. We can create tables as many as we need, but generally, tables are designed in a pattern that suits the information that is to be stored. Nevertheless, Tables are also designed to call each other through a calling reference. For example, I am staying in Dubai, and my friend stays as well in Dubai. so we create a table to hold countries' names and then reference people's tables to the country of residency. Didn't get it yet? hang on a more detailed example is explained below.This is how Wikipedia defined Database:
A database is an organized collection of data, generally stored and accessed electronically from a computer system. ~Wiki
Example on Queries
Let's have a practical example of how we can use a Database to call for data.I will be using SQLite studio you can download from here
and I will use this pre-structured Database for the purpose of this post. Download from here.
![]() |
First look when you open a database file |
You can see, there are two Tables "Level" and "Room". This database is extracted from Revit and simplified for the purpose of this post.
Double click on Level Table, and then select Data Tab from the browsing area.
Any table is a collection of fields (Pattern) where you can fill in Data. Fields have extra properties, such as Primary Key, Uniq, Not Null...etc, which we will not discuss in this overview tutorial.
You will see the structure of "Level" is as follow:
Elevation,
ElementId,
Name,
Code,
GUID
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn8Z3bGpuUcYchs_rh9HsxKZhOLBAhdPYmhN6tOMHq0ppWtBuHcBYtCX2MYA1dgA8UM2Wu5ZSr71gsVNsWT1lwhsPJRZm905tB253i93r01d4oTdKJwm-DBW_awEKlgvQ54RjmXHlSwzg/s320/02-Levels.png)
see this snapshot of how data looks like after being filled in the Level table
Now, let's open the Room Table. You can see there is no much difference in the concept. The room's table is also another table that holds fields that shape the pattern of the Room Table.
If you look closely, you will find there is a field called "FKey_Level". Can you guess what is this field used for?. Well, since a room is a part of a level, tables need to know that. Tables need to have a calling reference to another data in another table. Let's rephrase this, but first, you need to know that the Database doesn't care about the data value you fill in a table, but it cares about the structure of the table. With that said, each table must have a Unique Field. This Unique Field is used to uniquely define each row. Let's illustrate this in this example.
Look to the first row in the Room Table, and copy the FKey_Level value, you would get this "c6422095-3e7a-45ff-bbc8-15e2c2942d27" This is a calling reference to information stored in Level Table. Now open Level Table and look in the GUID field for this number... It will take too long to find this information, isn't it? or even if not, it would be a bit silly, to search for something while the computer and Database are meant to do this for you. so let's start writing our first Query.
But wait for a second, Why I should be looking in the GUID field in the Level table for this value? this is because these 2 tables are designed to talk to each other through these Unique Fields. (GUID in Level Table Vs FKey_Level in Room Table) you can read more about FOREIGN KEY
From Menu Bar Select Tools--> Open Editor, or Click Alt + E
![]() |
Opening SQL Editor |
Now We need to ask the Database the following:
I need all the fields from Table Level, but only where Field GuId has this value "c6422095-3e7a-45ff-bbc8-15e2c2942d27"
Translating that to SQL language would be like this
```Select * from Level where GuId = 'c6422095-3e7a-45ff-bbc8-15e2c2942d27'
```
![]() |
Writing my First Query |
So basically * (asterisks) here means all the fields in a row. SQL by then will search in each row for the value "c6422095-3e7a-45ff-bbc8-15e2c2942d27" under the column GuId, and the result will show at the bottom window.
Of course, you can make this more advanced for example I need to select only Fields "Name" and "Elevation"
```Select [Name],[Elevation] from Level where GuId= 'c6422095-3e7a-45ff-bbc8-15e2c2942d27'
```
You can also show the table in Descending order of elevation
```Select * from Level Order by Elevation Desc
```
![]() |
Descended order of Level |
All in all, a Database is the core of any Computer Application. It helps Storing, Recalling information on the hard drive instead of computer Memory, which greatly improves the speed of the application, without affecting the performance of the CPU.
That's all for now, see you in the next post.