Computer Programming & Database
Table of Contents
Lesson-1 ------------------------------------------------------------------------------------------------- 3
What is a Programming Language? ---------------------------------------------------------------- 3
Some popular programming languages are: ------------------------------------------------------------ 5
How does this work?---------------------------------------------------------------------------------------- 7
Basic Concepts of Programming Language -------------------------------------------------------- 9
Definition of Programming Language -------------------------------------------------------------------- 9
Types of Programming Languages ----------------------------------------------------------------------- 11
History of Programming Languages --------------------------------------------------------------------- 14
Future of Programming Languages ---------------------------------------------------------------------- 15
Basic Concepts of Programming ------------------------------------------------------------------------- 16
Importance of Programming------------------------------------------------------------------------------ 20
Advantages, Disadvantages, and Challenges of Programming: -------------------------------------- 24
What is Python? Types of Python ----------------------------------------------------------------- 25
Types of Python Implementations: ---------------------------------------------------------------------- 29
Lesson-2 ------------------------------------------------------------------------------------------------ 30
Database ------------------------------------------------------------------------------------------------ 30
Concept of Database---------------------------------------------------------------------------------------- 30
Necessity of Database -------------------------------------------------------------------------------------- 32
Goals and Objectives of a Database ---------------------------------------------------------------------- 34
Goals of a Database --------------------------------------------------------------------------------------------------- 35
Objectives of a Database --------------------------------------------------------------------------------------------- 35
File System vs. Database System ------------------------------------------------------------------- 36
Database Design --------------------------------------------------------------------------------------- 39
1|Page
Characteristics of Good Database Design --------------------------------------------------------------- 39
Database Normalization ---------------------------------------------------------------------------------------------- 39
Relational Database Management System (RDBMS) --------------------------------------------------- 41
Features of RDBMS ----------------------------------------------------------------------------------------- 41
Advantages of RDBMS ------------------------------------------------------------------------------------------------ 42
Key in Database --------------------------------------------------------------------------------------------- 43
Primary Key ------------------------------------------------------------------------------------------------------------ 43
Foreign Key------------------------------------------------------------------------------------------------------------- 44
Popular Examples of RDBMS------------------------------------------------------------------------------ 48
Future of Databases: ---------------------------------------------------------------------------------- 48
2|Page
Lesson-1
What is a Programming Language?
A computer cannot perform any task on its own. Until a computer
is commanded, it will not do anything. The medium through which
a computer operates based on user commands is called a
"Programming Language." We use some language to talk to
someone, but that is human spoken language that people can
understand. However, computers cannot understand human
language. To perform various tasks, a computer needs a special
type of language, which we call a Programming Language. There
is software for various computer tasks, which is built using
different programming languages.
3|Page
A programming language is a type of language that tells a
computer what tasks to perform. For example, just as we speak in
Bengali, a computer understands a programming language.
When you tell a computer to do something—like display an image,
play music, or run a game—you need to give it instructions. These
instructions are written in a programming language.
That is, a Programming Language is a language through which
humans can instruct a computer to perform specific tasks. Simply
put:
A programming language is a medium of communication
between humans and computers.
With it, we tell the computer:
● What to do (e.g., perform calculations, store information,
display images)
● When to do it
● How to do it
Example
4|Page
Think of it like a cooking recipe.
● A cooking recipe has step-by-step instructions on what
ingredients are needed and when to add them.
● Similarly, a programming language contains step-by-step
instructions.
● The computer reads that recipe (instructions) and performs the
task.
Some popular programming languages are:
● Python: Known for its simple syntax and versatile use.
● JavaScript: Very important for web development.
● Java: Object-oriented and used for enterprise applications.
● C: For low-level and system programming.
● C++: Object-oriented and for performance-optimized
applications.
● R: For data science and statistics.
● SQL: For database management.
● Ruby: For web application development.
Each programming language has its own advantages and areas of
5|Page
application. The main purpose of programs is to simplify and
automate various aspects of human life, such as business,
education, healthcare, entertainment, and much more.
How Does It Work?
1. Writing Code: Programmers
write code using a
programming language
(software). This code generally
specifies a particular task or solution.
2. Compiling or Interpreting: Although the code is written for
humans, the computer cannot directly understand it. Code
written in a programming language must be converted into
machine language for the
computer. Compilers or
interpreters (which are
translators or
interpreters) translate the code into the computer's language.
The compiler or interpreter performs this task itself; the user
6|Page
generally does not see it.
3. Computer Execution:
After translation, the
computer executes those
instructions and displays
the result on the monitor.
Example:
Suppose we want to write a program
that displays "Hello, little friends!" on
the computer. We will use a
programming language called Python.
print("Hello, little friends!")
How does this work?
● Writing Code: The programmer writes this code using the
Python programming language.
7|Page
● Compile or Interpret:
The Python
interpreter reads the
code and translates it
into computer
language.
● Result: The text
"Hello, little friends!" will be displayed on the screen.
Another Simple Example:
Imagine a computer is a robot. You tell it, "Go, bring the red ball."
If the robot understands this instruction, it will perform your task.
A programming language is the language you use to tell the robot
what to do.
All types of instructions can be given to a computer using a
programming language, and the type of work a computer will do
is controlled by the programming language. Everything you see or
8|Page
do on computers, mobile phones, tablets, or other devices is
created using some programming language. Additionally, computer
languages are used to build or program apps, websites, software,
and more.
Programming language and programming are among the most
important components of modern computer science. A
programming language is a medium through which programmers
communicate with computers and provide various instructions. A
program is a collection of instructions written in a specific
programming language, used by a computer to accomplish specific
tasks.
Basic Concepts of Programming Language
A programming language is a way to talk to computers. We use
this language to give instructions to the computer—what it will
do, how it will do it, and when it will do it.
Definition of Programming Language
A programming language is a special kind of language used to tell
9|Page
a computer what tasks to perform, when to perform them, and
how to perform them.
● It includes some rules and special words (syntax).
● A programming language is a bridge between human language
and computer language.
● We write instructions in a programming language, and then
the computer executes those instructions.
A program performs three main tasks:
1. Receiving Input: It receives data from the user or another
source.
2. Processing: It processes the data or input, performing various
calculations and actions.
3. Providing Output: It displays results based on the processed
data or sends them to another system.
The main purpose of programs is to simplify and automate various
aspects of human life, such as business, education, healthcare,
entertainment, and much more.
10 | P a g e
Types of Programming Languages
Programming languages can be primarily divided into two
categories:
1. Low-level Language:
A low-level language is a programming language that works
directly with the computer's hardware. Code is written in
machine code or assembly language (a special type of
programming), which runs quickly and uses less memory.
However, it is comparatively difficult or arduous for general
users to understand and use.
○ "Low" means downwards, meaning very close to the
computer.
○ This language works directly with the computer's memory
and components.
○ This language is difficult for humans but very easy for
computers to understand.
○ It is written using 1 (one) and 0 (zero).
Low-level programming languages are early computer languages.
11 | P a g e
They do not require a compiler or interpreter to run on the
computer. Because of this, programs written in low-level
programming do not take much time to run.
Two examples of low-level languages:
1. Machine Language:
■ The computer's own language.
■ Written only with 0s and 1s.
■ Example: 10101001 11000011
■ This is very difficult for humans to understand.
2. Assembly Language:
■ A bit easier than machine language.
■ Contains small words or codes.
■ Example:
MOV A, B
ADD A, 1
■ Still considered low-level because it's very close to the
computer's language.
12 | P a g e
2. High-level Language:
A high-level language is a language that is easy for humans
to understand and write.
○ "High" means superior, because this language is closer to
human language.
○ This language is quite similar to human language. This
language is easy to write and read.
○ The computer cannot understand it directly, so a translator
(compiler or interpreter) is needed.
○ Examples: Python, Java.
13 | P a g e
High-level programming languages are not hardware-dependent.
They require a compiler or interpreter to run on the computer.
Some high-level languages are:
○ Python: A high-level language known for its simple syntax
and versatility. It is used in data science, web development,
automation, and many other fields.
○ Java: A general-purpose programming language used to
create various types of applications. It is famous for
platform independence and security.
○ C: A highly efficient language widely used in operating
systems and embedded systems.
○ Scripting Languages: Such as JavaScript, Perl, and PHP,
which are commonly used in web development and
automation scripting.
History of Programming Languages
The history of programming languages began in the 1950s. Initially,
"machine language" was used, which was in binary code. Then
came "low-level" languages, such as Assembly. In 1957, "Fortran"
14 | P a g e
marked the beginning of "high-level" languages, which were used
for scientific work. After that, languages like C, C++, and Java
emerged, making software development easier. In the 1990s,
modern languages like Python and JavaScript made programming
even more popular.
In the current era, programming languages are rapidly evolving to
meet the demands of artificial intelligence, blockchain, data
science, cloud computing, machine learning, and other
technological fields. Examples of modern languages include Rust
and Kotlin. This evolution of programming languages has opened
new horizons for solving various technological problems and
improving human life.
Future of Programming Languages
The future of programming languages is moving towards making
human-computer interaction more advanced, easier, and more
effective. With the development of technologies like artificial
15 | P a g e
intelligence, machine learning, and natural language processing,
programming languages are also becoming more intelligent,
automated, and accessible.
The concept of programs and programming languages has become
an indispensable part of our daily lives. Knowledge of
programming languages is extremely important for solving various
problems, conducting business operations, and innovating new
technologies. In the future, these technologies will make our lives
easier, more efficient, and richer.
Basic Concepts of Programming
The basic concepts of programming are a collection of various
rules, principles, and ideas that help the computer perform tasks
using programming languages. Knowing the basic concepts of
programming makes programming much easier. Let's learn about
some important basic concepts of programming:
1. Variable:
A variable is a name used to store data or a value in memory.
16 | P a g e
It is a container that can hold various information, such as
numbers, text, etc.
2. Data Type:
A data type indicates what kind of data a variable will hold.
Some common data types are:
○ Integer: Whole numbers (e.g., 5, 10, -3)
○ Float: Decimal numbers (e.g., 5.75, 3.14)
○ String: Text (e.g., "Hello", "Programming")
○ Boolean: True or False (e.g., True/False)
3. Operator:
Operators are symbols used to perform calculations,
comparisons, and logical operations. Examples of operators:
○ Arithmetic Operators: +, -, *, /, % (addition, subtraction,
multiplication, division, remainder)
○ Comparison Operators: ==, !=, >, <, >=, <= (equal to, not equal
to, greater than, less than, etc.)
○ Logical Operators: AND, OR, NOT
4. Conditional Statement:
17 | P a g e
Conditional statements (e.g., if, else) are used to perform
different tasks in a program based on conditions. For
example:
if age >= 18:
print("You are an adult")
else:
print("You are a minor")
5. Loop:
A loop is a rule that helps a program repeat. Generally, two
types of loops are used:
○ for loop: Used to run a loop for a specific number of times.
○ while loop: Used to run a loop as long as a condition is true.
6. Input and Output:
Input is the process of taking data from the user, and output
is the process of displaying the program's results.
7. Algorithm:
An algorithm is a step-by-step plan or set of steps for solving
18 | P a g e
a problem.
By thoroughly understanding and practicing these basic concepts,
programming in any programming language becomes much easier.
Example: A simple algorithm to determine if a number is even or
odd:
Step 1: Receive the number as input in a variable.
Step 2: Divide the number by 2 and find the remainder. That is,
find the remainder of the number divided by 2 using the %
operator (n % 2).
Step 3: If the remainder is 0, the number is even. If the remainder
is not 0, the number is odd.
1. Input n (number)
2. If (n % 2 == 0):
Print "Even number"
Else:
Print "Odd number"
For example:
19 | P a g e
● Input: 44 % 2 = 0 → Even number.
● Input: 77 % 2 = 1 → Odd number.
Importance of Programming
The importance of programming is currently very high because it
helps in technology development, improvement in various fields
of human life, and effective problem-solving. Programming acts as
the main driving force behind technological changes and
advancements around us. The importance of programming is
highlighted below:
1. Problem Solving:
Through programming, it is possible to create simple and
effective solutions for complex problems. For example,
programming plays an important role in solving various
problems in mathematics, science, engineering, and business.
2. Automation:
Through programming, various repetitive tasks can be
completed automatically. Automation saves time and effort and
increases efficiency. For example, the use of robots in factories,
20 | P a g e
data processing, and daily administrative tasks can be
automated.
3. Advancement in Information and Communication Technology
(ICT) Sector:
Programming is essential for creating websites, mobile
applications, and software. Programming has contributed
significantly to the increasing use of internet and application-
based services in our daily lives.
4. Data Analysis and Decision Making:
Through programming, large amounts of data can be
analyzed, and necessary information can be collected to aid
in decision-making. Data science and machine learning are
widely used in large business organizations and research
institutions.
5. Innovation and Development:
Programming helps in creating new technologies and
products through innovation. Innovations like the Internet of
Things (IoT), Artificial Intelligence (AI), and Blockchain have
21 | P a g e
primarily been made possible through programming.
6. Artificial Intelligence (AI) and Machine Learning:
Programming is essential for artificial intelligence and machine
learning. Innovations like self-driving cars, disease diagnosis,
and voice recognition have been made possible through AI.
7. High-Paying Job Opportunities:
Currently, programming skills are an extremely valuable
qualification. There are high-paying job opportunities in
professions such as Software Engineer, Data Scientist, Web
Developer, and Cybersecurity Expert.
8. Education and Research:
Programming is extremely helpful in education and research.
In various fields of science and engineering, programming is
used to perform simulations, data analysis, and determine
research results.
9. Medical and Healthcare:
Programming plays an important role in the healthcare
sector. Programming is used for disease diagnosis software,
22 | P a g e
medical record management systems, and health information
analysis.
10. Gaming and Entertainment:
The importance of programming in game development and
animation is immense. Programming is required to create
high-quality video games, Virtual Reality (VR), and
Augmented Reality (AR) applications.
In summary, programming has entered every aspect of our lives
and serves as an indispensable tool for problem-solving,
automation, innovation, and technological development.
Programming language and programming are an indispensable
part of modern computer science. Through them, we can solve
various problems and enable computers to perform specific tasks.
By gaining knowledge about different types of programming
languages and their uses, we can enhance our programming skills
and keep pace with technological advancements.
23 | P a g e
Advantages, Disadvantages, and Challenges of Programming:
A brief overview of the advantages, disadvantages, and challenges
of programming is provided below:
Advantages of Programming:
● Problem Solving: Complex tasks can be solved easily and
quickly.
● Automation: Various processes are automated, saving time and
effort.
● Creation of New Technology: Opportunities for innovation exist
through the creation of software, apps, and websites.
Disadvantages:
● Complexity: Some languages are difficult to learn and apply.
● Bugs and Errors: Mistakes in code can lead to system problems
or security risks.
● Regular Updates Required: Languages and code need to be
updated to keep pace with new technologies.
24 | P a g e
Challenges:
● Cybersecurity: Creating secure code to combat security risks.
● Learning New Technologies: New languages and frameworks
are constantly emerging.
● Logical Thinking: Applying strong logic to create effective and
accurate solutions.
What is Python? Types of Python
To make a computer work, it needs to be given instructions in a
language it understands. This is a programming language. There
are many programming languages, and new ones are constantly
being created. However, only a few languages have become popular
among programmers. Python is one such programming language.
Its creator is Guido van Rossum. He started developing Python in
December 1989 during his Christmas holiday. However, Python
became more popular in 2000 after the release of version 2.0.
Currently, Python versions 2.7 and 3.4 are in use.
A recent survey shows that Python ranks fourth in popularity
25 | P a g e
worldwide (the top three being Java, C, C++), and 69% of students
in top US universities are introduced to programming using
Python. Additionally, Python is one of the three official
programming languages of the world-renowned company Google.
What makes Python so popular? Python programmers consider the
following to be the main reasons:
1. Python code is easy to read.
2. Code is comparatively much shorter than C or Java.
3. Python can be used on various operating systems.
4. It has a vast and effective standard library.
5. Strong online community.
6. Excellent web frameworks (Django, Flask, etc.).
Python is present by default in almost all Linux distributions and
Mac operating systems; it does not need to be installed separately.
In Windows, Python needs to be installed separately, which can be
downloaded from Python's website.
Python is most widely used in developing web-based software. The
26 | P a g e
Django framework is very popular. Additionally, Python is
extensively used in building various automation software,
bioinformatics, machine learning, data analysis, natural language
processing, and web crawler development.
Python code to find if a number is even or odd:
# Taking input from the user
number = int(input("Please input a number: "))
# Checking if it's even or odd
if number % 2 == 0:
print(f"{number} is an even number ")
else:
print(f"{number} is an odd number ")
Code Explanation:
First, a number is taken as input from the user and converted to
27 | P a g e
an integer (int). Then, the number is divided by 2 using the
remainder operator (%). If the remainder is 0, the number is even;
otherwise, it is odd.
Example:
● Input: 8 → Output: 8 (8 is an even number.)
● Input: 5 → Output: 5 (5 is an odd number.)
The use of Python has also begun in Bangladesh. Several domestic
software development companies are using Python. There are
official Python tutorials for learning Python. Additionally, various
books and online courses are available online. There are also
opportunities to learn Python in Bengali online.
● [Link]
● [Link]
● [Link]
● [Link]
● [Link]
● [Link]
● [Link]
28 | P a g e
● [Link]
Useful web addresses where you can browse and learn about
Python.
Types of Python Implementations:
There are various implementations of Python used for different
environments and needs:
1. CPython: This is the official and most popular implementation
of Python, written in the C programming language. CPython
directly converts to binary code and is the default for the
standard library.
2. Jython: A Python implementation that can be run via Java. It
is particularly useful for integration with Java projects and
helps in easily using Java libraries.
3. IronPython: This is an implementation developed for use with
the .NET Framework. It provides integration facilities with C#
and other .NET languages.
4. PyPy: A high-speed Python interpreter that uses Just-In-Time
(JIT) compilation, allowing it to execute code faster than
29 | P a g e
CPython.
5. MicroPython: This is a lightweight Python implementation for
embedded systems, used for microcontrollers and small devices.
These implementations are suitable for various types of tasks, and
programmers choose among them according to their needs.
Lesson-2
Database
A database is like a large diary or cabinet where a lot of
information (Data) is neatly organized. It is an organized
information storage method where various types of information
are stored in a specific structure. This information is designed for
easy use by various applications, users, and organizations. The
main goal of a database is to store information in such a way that
it can be quickly retrieved, modified, and used.
Concept of Database
A database is a structure of data where various information is
30 | P a g e
systematically stored. In a database, information is stored in tables,
where each table has one or more columns and rows. This allows
data to be easily organized, searched, and used.
In the table in the image above, we have a total of four
columns/fields (ID, NAME, AGE, COURSE) and four rows/records.
A Database Management System (DBMS) is a software system that
allows users to create, maintain, and effectively manage databases.
It simplifies the tasks of storing, updating, deleting, and retrieving
data. A DBMS ensures the security, consistency, and integrity of
31 | P a g e
various types of data. Databases are managed using DBMS software,
such as MySQL, Oracle, and Microsoft SQL Server. A DBMS is an
essential tool for developers and organizations, making their data
management more efficient and secure.
Necessity of Database
The necessity of a database primarily stems from the need for
managing large amounts of data, quick access to information, and
secure usage. Below are some of its important necessities:
● Organized Data Storage: Data in a database is systematically
categorized and stored, which simplifies data management.
● Fast Information Retrieval: A database works in such a way
32 | P a g e
that necessary information can be retrieved quickly and
accurately.
● Multi-User Access: Database systems allow many users to access
multiple data simultaneously, which is extremely important for
large organizations.
● Data Protection: Security rules and regulations can be set for
data stored in a database. Unauthorized users cannot access
the database, which ensures the security of confidential
information.
● Maintaining Data Consistency: A database
management system helps eliminate
data duplication and
inconsistency, ensuring
accurate data storage.
● Easy Data Update and Modification:
Information can be easily updated or
modified through a database, which simplifies
operations and saves time.
33 | P a g e
● Reporting and Analysis: Various types of reports and analyses
can be easily generated from necessary data through a
database, which aids in decision-making.
Therefore, a database management system is necessary for
controlling large-scale data, quick information retrieval, and secure
usage.
Goals and Objectives of a Database
The goals and objectives of a database are to correctly store,
manage, and make information usable. It provides an easier and
more effective solution for information retrieval and analysis for
various organizations, institutions, and users. Using a database
34 | P a g e
makes data management, security, and analysis tasks easier. Here
are some of the main goals and objectives of a database:
Goals of a Database
1. Information Storage and Proper Management: One of the main
goals of a database is to systematically store data so that it is
easily manageable.
2. Fast Access and Retrieval of Information: It provides the facility
for quick information retrieval and searching for necessary
information, which increases efficiency during decision-making.
3. Ensuring Information Security: A database system includes
security measures that limit information access to authorized
users and ensure confidentiality in data storage.
4. Information Coordination and Sharing: Multiple users can use
the same database, which provides the advantage of using the
same data in multiple places.
Objectives of a Database
1. Fast and Accurate Information Delivery: The objective of a
35 | P a g e
database is to provide fast and accurate information to users.
2. Updating and Managing Information: Information can be easily
added, deleted, or updated in a database, making data
management more effective.
3. Data Analysis and Report Generation: In business and research,
data can be analyzed to easily generate reports.
4. Ease of Modification and Maintenance: Data can be easily
changed, modified, and maintained through a database.
By using a database, any organization can properly store and
analyze their data, which aids in improved management and
decision-making in the long run.
File System vs. Database System
Both file systems and database systems are methods for storing
and managing information, but they have several fundamental
differences. These differences are mainly visible in their structure,
data access methods, security measures, and usage.
File System
36 | P a g e
A file system is a primary method of data storage that is usually
part of an operating system. It stores information in files within
various folders and sub-folders.
Advantages of File System:
● Easy to use and less complex.
● Suitable for small and simple data management.
● Can be operated at a lower cost.
Database System
A database system is an advanced information storage system
where information is stored in a specific structure, such as tables,
records, and relations. A Database Management System (DBMS)
manages this database system.
Advantages of Database System:
● Large amounts of data can be retrieved easily and quickly.
● Data analysis and management become more effective.
● Multiple users can access data simultaneously.
37 | P a g e
Comparative Differences
Feature File System Database System
Structure Simple files and Tables and relations
folders
Security Limited security Advanced security
measures
Data Retrieval Slow and limited Fast and effective
Multiple Users Issues with multiple Coordinated access
access
Data Consistency Lack of consistency Ensures data
integrity and
consistency
A file system is generally simple and suitable for small data, but a
database system is more effective and secure for managing large
databases.
38 | P a g e
Database Design
Database design is the process of creating a structure necessary
for database creation, storage, and management. It is extremely
important for data classification, proper storage, and easy access.
Good database design ensures that the database remains effective,
accurate, and securely usable.
Characteristics of Good Database Design
● Data Consistency and Reliability: Ensures correct and reliable
data is stored and used.
● Minimizing Redundant Data: Reduces data duplication and
removes unnecessary data.
● Scalability: New data can be easily added and managed.
● Easy Modification and Maintenance: New changes can be
implemented easily.
● Security: Ensures data access and security.
Database Normalization
39 | P a g e
Database Normalization is a process through which data
redundancy and unnecessary data within a database are reduced,
thereby improving data quality. The main purpose of
normalization is to organize information in a database so that data
duplication is minimized and an effective solution for data storage
is provided when information changes.
Steps of Normalization:
There are various levels of normalization, but primarily the first
three levels (1NF, 2NF, and 3NF) are the most important and widely
used.
40 | P a g e
Relational Database Management System (RDBMS)
A Relational Database Management System (RDBMS) is a database
management system that operates based on the relational model.
Here, data is stored in tables, and the data is systematically
organized through the columns and rows of each table. Using an
RDBMS simplifies database management and facilitates structured
analysis by defining relationships between data.
Features of RDBMS
● Data Storage via Tables: In an RDBMS, data is stored in tables,
where each table represents a specific entity.
● Relational Integrity Rules: RDBMS maintains the consistency of
related data and establishes relationships between tables
through Primary Keys and Foreign Keys.
● Data Manipulation via SQL: Structured Query Language (SQL) is
used to store, update, delete, and retrieve data.
● ACID Properties: It adheres to Atomicity, Consistency, Isolation,
and Durability (ACID) properties, which make database
41 | P a g e
transactions secure and reliable.
● Multi-User Access: Allows multiple users to work on the same
database simultaneously, which is important for large
organizations.
● Data Consistency and Security: In an RDBMS, data consistency
is maintained, and data security is ensured by defining security
measures at various levels.
Advantages of RDBMS
● Easy Data Access and Management: Storing data in tables is
easy, and data can be easily accessed, updated, and managed
using SQL.
● Maintaining Data Consistency: Proper relationships between
tables are maintained using Primary Keys and Foreign Keys.
● Reducing Data Redundancy: Reduces data duplication and
prevents data waste.
● Reliability: Database transactions are reliable and secure due to
ACID properties.
42 | P a g e
● Multi-User Support: Provides the facility for many users to
work simultaneously on the same database.
● Data Integrity and Security: Data accuracy, security, and multi-
level permissions are ensured to protect data.
Key in Database
In a database, a Key refers to special properties or attributes that
help uniquely identify each record. Primary Key and Foreign Key
are two important keys that ensure data integrity and relationships
within a database.
Primary Key
A Primary Key is a unique key formed by one or more attributes
that uniquely identifies each record in a table. It cannot be
duplicated, and its value cannot be null (NULL).
Characteristics:
● Uniqueness: Each primary key is unique, meaning no two
records in the table can have the same primary key.
● Does not accept null values: A primary key cannot accept any
43 | P a g e
null or empty (NULL) values.
● One primary key per table: A table cannot have multiple
primary keys, but it can have a composite primary key, which
is formed by a combination of multiple columns.
Example: Suppose there is a "Student" table where each student is
uniquely identified by a "Student_ID." This "Student_ID" is the
Primary Key because it uniquely identifies each student's record.
Student_ID (Primary Name Age
Key)
101 Salma 20
102 Toufiq 22
103 Tanvir 21
Foreign Key
A Foreign Key is a key that establishes a relationship with another
table where it is defined as a Primary Key. It is used to establish
44 | P a g e
relationships between two tables, and its value must match a value
present in the Primary Key or Unique Key of the related table.
Characteristics:
● Establishes Relationships: A foreign key primarily creates a
relationship between two tables, linking data in one table to
data in another.
● Can accept null values: A foreign key can generally accept null
(NULL) values, but this depends on the table's design.
● Multiple foreign keys can exist: A table can have multiple
foreign keys, establishing relationships with different tables.
Example: Suppose there is a "Student" table and an "Enrollment"
table. In the "Enrollment" table, "Student_ID" is used as a Foreign
Key, which establishes a relationship with the "Student_ID"
Primary Key in the "Student" table.
Student Table:
Student_ID (Primary Key) Name
45 | P a g e
101 Salma
102 Toufiq
103 Tanvir
Enrollment Table:
Enrollment_ID Student_ID (Foreign Course
Key)
1 101 Math
2 102 Science
3 103 Literature
4 101 BGS
Here, "Student_ID" in the "Enrollment" table is a Foreign Key
related to the "Student_ID" Primary Key in the "Student" table.
46 | P a g e
Key Differences
Feature Primary Key Foreign Key
Purpose Uniquely identifies Establishes
each record in a relationships
table between two tables
Uniqueness Always unique Matches values in
another table's key
Null Value Cannot accept null Can accept null
values values
Number Only one per table Can have multiple
in a table
By using Primary Keys and Foreign Keys, data relationships and
accuracy can be maintained within a database. This provides an
effective solution for data management.
47 | P a g e
Popular Examples of RDBMS
● MySQL: An open-source and widely used RDBMS employed in
various applications.
● Oracle Database: A highly powerful and reliable RDBMS widely
used by large organizations and in the banking sector.
● Microsoft SQL Server: An RDBMS developed by Microsoft,
primarily used for Windows platforms.
● PostgreSQL: An open-source RDBMS known for its advanced
features and scalability.
● IBM DB2: An RDBMS developed by IBM, primarily used in large
corporate and banking sectors.
Therefore, a Relational Database Management System (RDBMS) is
a powerful, effective, and reliable database management system
suitable for managing and storing various types of data.
Future of Databases:
The future of databases is deeply connected with technological
advancements and evolving business needs. The dynamism of the
48 | P a g e
modern age and the emergence of new technologies will reshape
database concepts, technologies used, and design strategies. Below
are some important aspects of the future of databases:
1. Cloud Databases:
○ Rise of Cloud Computing: The popularity of cloud database
services is increasing, which reduces the cost of database
setup and management for businesses.
2. Neural and Artificial Intelligence (AI):
○ Data Analysis: With the help of AI and machine learning,
data analysis and forecasting from databases will be further
improved. AI will be used to automate data governance
processes, and data and database management tasks such as
data migration, backup, and troubleshooting will be
automated.
3. NoSQL and Multi-Modal Databases:
○ New Database Models: The demand for NoSQL databases is
increasing because they are suitable for unstructured and
semi-structured data.
49 | P a g e
○ Multi-Modal Databases: Various data models will be used
together, such as graph, document, and column-oriented
databases.
4. Data Security and Privacy:
○ Emphasis on Security: More advanced security technologies
and strategies will be used to enhance database security and
user privacy. More advanced systems will be needed to
comply with regular laws and regulations.
5. Blockchain Technology:
○ Blockchain in Database Systems: Blockchain technology can
be used to enhance data security and integrity, especially in
the financial and healthcare sectors.
○ Distributed Databases: Blockchain will be used as a secure
and integral method for data transfer.
6. Data Governance:
○ Data Management: Data management and policies will gain
more importance to maintain data quality and security.
7. Internet of Things (IoT):
50 | P a g e
○ IoT in Databases: Database systems will improve to handle
the massive amounts of data coming from IoT devices. New
technologies will be developed for real-time data processing
and analysis.
The future of databases is rapidly changing with technological
advancements. The advent of cloud computing, AI, NoSQL,
blockchain, and IoT will change the way databases are used.
Additionally, new challenges and technological solutions will be
needed to ensure data security and privacy. Through these
changes, databases will become more effective, secure, and useful
for users.
51 | P a g e