A database is a collection of interrelated and organized data related to certain topic.
Data can be retrieved from a database when needed or subjected to other operations.
Retrieved when needed:
- This refers to the ability to search and extract specific data from the database based on user queries or program requirements.
- You can think of it like finding a specific book in a library by searching the catalog or browsing the shelves.
Subjected to other operations: - This means data in a database can be manipulated beyond just retrieval. Operations can include:
- Inserting, adding new data entries.
- Updating, modifying existing data.
- Deleting, removing unwanted data.
- Sorting and filtering, organizing and refining data based on specific criteria.
- Performing calculations and analyses, deriving insights and trends from the data.
Examples of database
1. a book containing the details of students studying in a school,
2. a telephone directory,
3. a voters’ list,
4. a contact list
Types of databases
There are two main types of databases: manual databases and electronic databases.
- Manual databases are stored on paper or other physical media.
- Electronic databases are stored on computers.
Advantages of electronic databases
Electronic databases have many advantages over manual databases, including:
- They are easier to search and update.
- They can be accessed from anywhere with an internet connection.
- They can be shared with multiple users.
Database Management System (DBMS)
A database management system (DBMS) is a application software that helps users create, manage, and access databases.
DBMS functions
A DBMS performs a variety of tasks, including:
- Creating and managing database tables
- Adding, deleting, and modifying data
- Retrieving data from the database
- Creating reports and queries
- Providing security and backup
Examples of DBMS software
Some popular DBMS software programs include:
- Microsoft Access
- Open Office Base
- Libre Office base
- Oracle
- MySQL
- SQL Server
- dbase III+
- Mongo db
Database objects
A database is made up of four main tools called objects. The following tools are tools are common in all DBMS software
- Tables
- Queries
- Forms
- Reports
- Tables
A table is the basic structure of a database.
It is a collection of related data organized into rows and columns.
Rows
A row in a table is a single record of data.
Columns
A column in a table is a single field of data.
Primary key
A primary key is a field that uniquely identifies each record in a table.
Primary key prevents the user from entering the same data in a table.
Foreign key
If a field that acts as a primary key in one table is used as a normal field in another table, it is called a foreign key.
A foreign key is a field that links a table to another table.
Composite Key
Sometimes two fields are joined together and defined as a primary key. They are called composite keys.
Data types
Data types are used to define the type of data that can be stored in a field.
Example: Text, Memo, Number, Currency, Date / Time, yes/No
Data duplication
Data duplication occurs when the same data is stored in multiple places in a single table
Data redundancy
Data redundancy is the unnecessary duplication of data in several tables
2. Queries
A query is a tool used to request data from a database.
Queries filter unwanted data.
3. Forms
A form is a user interface that allows users to enter and view data.
4. Reports
A report is a document that summarizes data from a database.
Relationships
A relationship is a link between two tables.
Types of relationships
There are three main types of relationships:
- One-to-one
- One-to-many
- Many-to-many
- One-to-one relationship
A one-to-one relationship is a relationship in which each record in one table is related to only one record in another table.
Example : Every citizen can have a passport. Each passport belongs to each individual.
One-to-One relationship cannot be considered as an ideal mode of communication. Because those two tables can be combined into one table.
2. One-to-many relationship
A one-to-many relationship is a relationship in which each record in one table is related to multiple records in another table.
Example1 : Customer and SIM cards
one can have five SIM cards. Here SIM card holder details are entered in one table and SIM card details in another table. The SIM cards belonging to one person in the first table can relate to five records in the second table. In other words, the five SIM cards in the second table are owned by only one person in the first table.
Example 2 : Author and Books
An author can write many books, but each book has only one author (in most cases).
A one-to-many relationship is mostly used.
3. Many-to-many relationship
A many-to-many relationship is a relationship in which each record in one table is related to multiple records in another table, and vice versa.
Example 1 : Each teacher in a school teaches many students. Also many teachers can teach each student.
Example 2 : Student and Courses:
Multiple students can enroll in multiple courses and multiple students can enroll in each course.
Linking table
A linking table is used to create a many-to-many relationship between two tables.
Conclusion
Databases are a powerful tool for storing and managing data.
A DBMS can help you create, manage, and access databases efficiently.