Database & SQL for beginners — Part(1)
“Databases are like big swimming pools. If you don’t have to maintain them, then you can’t appreciate the challenges of keeping them clean and clear.” — Zack Urlocker, former executive at MySQL and Oracle.
A quick introduction:
The first thing we would like to know is the history of data recording (Data Storage). In fact, since a long time ago, Human has known to record data and information. Examples of these are ancient civilizations such as the Sumerian civilization, the Egyptian civilization, the Greek, Roman, and Chinese civilizations.
They were for the purpose of documenting historical and administrative events in the country, writing manuscripts and texts, and recording commercial and economic transactions.
Data was recorded in various forms, such as using hieroglyphics, clay tablets, or other ways that were available at that time…. Since this time, data recording techniques have developed significantly, and today we have modern means such as database management systems and information technology that enable us to record Storing and processing huge amounts of data in an efficient way and in a short time.
What are databases?
They are a group of data that is logically organized and linked to each other according to a specific data model known as a table. Databases include a group of tables that carry data and are known as fields or columns or attribute, and records or rows or tuple that hold individual records.
Let us understand with some illustrations.
This explains the element name:
Data is stored in a table.
Table (Entity):
A visual structure, consisting of individual rows (data) and columns (attributes and properties). It is easy to understand and is used to organize data related to the same entity to facilitate query and analysis operations when working with data in the database.
Each table has a name that represents the name of the entity.
The entity can be the student, the teacher, the course, the required courses, but it cannot be the name of the organization, such as the university or the company, but if you mean the name of the branch, then this is correct.
column(field or attribute):
It determines what type of data should be present in the table.
It is worth noting that there are three types of coulms, such as
→ “simple”, which indicates that the row carries a single value.
→“Composite”*indicates that the value consists of several parts, such as name, which consists of the first name, the middle name, and the last name.*
Note: any Composite attribute will be divided into separate simple attributes, which will explain more in normalization. , mapping.
→”Multi-value” indicates that the cell holds more than one value, such as a person with two mobile phone numbers.
Note Multi-valued attributes will be extracted into another table,which will explain more in normalization. , mapping.
row ( record or tuple):
holds the actual data on which you will perform operations such as deleting, restoring… etc.
Storage methods:
Overall
Database consists of tables that carry data, and there are relationships between the tables, some of which may be (one-to-one, one-to-many, or many-to-many) are constraints that specify the maximum participation between tables.
Each table has a primary key, an essential element that is not repeated to distinguish between rows and not repeat values; its most famous characteristic is
#unique.
#Not null.
#abstract.
#short and numeric.
The most famous example →Id, code, Ssn.
It is necessary for each table to have a primary key, and if you do not find it, enter one of your own, such as code or serial (autonum).
, and a foreign key to link the tables. With each other, it refers to the values of the original table that are related to the relationship with the other table.
The Goal:
1- Data analysis: Databases enable data to be extracted and analyzed to assist in decision-making, strategic planning, or performance tracking to evaluate the performance of operations and individuals, identify strengths and weaknesses, and thus ensure quality.
2- Supporting applications and services: Databases are considered an essential part of software applications, making them essential to the operation of many modern systems and services.
3- Providing security and protection: Databases provide mechanisms to protect and secure data from unauthorized access.
4- Documentation and proof: Databases are an important document for activities, operations and transactions and can be used in cases of dispute or legal claims.
5- The main and most important goal is to store data. This data can be text, numbers, dates, files, sound, pictures, or videos.
This is not only the goal or importance of databases. There are many more, for example, providing communication, collaboration, compliance, reporting, planning, organization, research and development.
Database Management Systems (DBMS):
A tool that is used to manage and use databases. The DBMS provides an interface for entering, editing, reviewing, and querying data in the database. It also allows deleting, adding, modifying, organizing, and performing operations on data effectively and securely.
Classification of (DBMS):
They are divided into two types:
- relational database management systems (RDBMS).
Data is organized in the form of tables. Each table contains a set of rows and columns, and the data is linked to each other through primary and foreign keys.
- non-relational database management systems (NoSQL or Non-SQL).
Data is organized in the form of key-value pairs, documents, graphs, or on a column basis. It is widely used in web applications, social networks, big data analysis, and heavy-load systems.
RDBMS examples: Oracle, MySQL, SQL Server, SQLite, DB2, …etc.
Wrapping up
I think I now know the difference between a database and a database management system, what are database, its goals, and the types of database management systems. Let us continue with Relationship & SQL in another story.