0% found this document useful (0 votes)
12 views

Introduction To Database

A database is an organized collection of structured data stored electronically. It is designed to efficiently store, manage, and retrieve data for various purposes. A database management system (DBMS) enables users to interact with databases by performing functions like storing, retrieving, updating, and managing structured data. There are different types of databases including centralized, distributed, personal, and relational databases. A relational database organizes data into tables with rows and columns and links tables through common fields to allow structured and efficient data access.

Uploaded by

Ayush D
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Introduction To Database

A database is an organized collection of structured data stored electronically. It is designed to efficiently store, manage, and retrieve data for various purposes. A database management system (DBMS) enables users to interact with databases by performing functions like storing, retrieving, updating, and managing structured data. There are different types of databases including centralized, distributed, personal, and relational databases. A relational database organizes data into tables with rows and columns and links tables through common fields to allow structured and efficient data access.

Uploaded by

Ayush D
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Introduction to database

- organized collection of structured information or data, typically stored electronically in a


computer system
- it is designed to efficiently manage, store, retrieve, and manipulate data according to
specific requirements and for various purposes.

Data and information


- data

o raw facts, figures, and statistics collected, stored, and processed for various
purposes.
o It can take many forms, including text, numbers, images, audio, and video. Data
can be structured, semi-structured, or unstructured.

- Information

o data that has been processed, organized, or structured in a meaningful way to


convey knowledge or meaning.
o information is the result of processing and interpreting that data to make it useful
and understandable.

Database mgt system

- software suite that enables users to interact with databases


- primary functions of a DBMS include storing, retrieving, updating, and managing data in
a structured format.
Types of databases:
- Centralized database:

o refers to a type of database architecture where all data is stored and managed in
a single location or server.

o users from different locations or departments access the data through a


centralized system, often referred to as a Database Management System (DBMS)

A common example of a centralized database is a traditional Enterprise Resource


Planning (ERP) system used by large organizations. In an ERP system, various modules
such as finance, human resources, supply chain management, and customer relationship
management are integrated into a single centralized database.

- Distributed database
o database that consists of multiple interconnected databases that are spread
across different locations or nodes in a network.

o , data is stored in multiple physical locations but appears to the user as a single,
centralized database

Let's consider an example of a distributed database system used by a large retail


chain with stores located across different regions.

In this scenario, the retail chain utilizes a distributed database to manage its
inventory, sales, and customer information. The distributed database system
consists of multiple nodes, with each node located in a different region where the
retail stores are located.

- Personal database:
o database system designed to be used by an individual to manage and organize
personal data, information, and resources.
o It can serve various purposes, ranging from organizing personal contacts and
schedules to tracking personal finances or storing personal documents.
z

- End user database:

o database system designed to be used directly by individuals without requiring


extensive technical knowledge or programming skills.

o databases are typically user-friendly and provide simple interfaces for data entry,
retrieval, and manipulation

o a data storage and processing environment that provides


users with direct access to data, eliminating the need for
traditional IT processes and complex data modeling

- commercial database
o database system that is developed, marketed, and sold by a software company
for profit.

o typically designed to meet the needs of businesses, organizations, and


enterprises for managing large volumes of data efficiently and securely.

o offer advanced features, robust performance, scalability, and professional support


services.

Relational database

A relational database is a type of database that organizes data into tables,


where each table consists of rows and columns. The relationship between
tables is established through common fields (attributes), allowing data to
be linked and accessed in a structured and efficient manner. Relational
databases are based on the principles of the relational model, which was
proposed by Edgar F. Codd in the 1970s.

Tables have many rows of data. Rows are often called records
Tables have many columns. They are labeled with a descriptive
name and have a specific data type.
Sure, let's consider a simple example of a relational database for a library.

In this example, we'll have two tables:

1. Books: This table will store information about the books available in the library.
 Attributes:
2. Users: This table will store information about the library users.
 Attributes:
 UserID: Unique identifier for each user.
 Name: Name of the user.
 Email: Email address of the user.
 Address: Address of the user.
 Phone: Phone number of the user.

These tables are related through a concept called foreign keys. In our example, we
might have another table, let's call it Borrowings, which tracks which users have
borrowed which books.

 Attributes:
 BorrowID: Unique identifier for each borrowing.
 UserID: Foreign key referencing the UserID in the Users table.
 BookID: Foreign key referencing the BookID in the Books table.
 BorrowDate: Date the book was borrowed.
 ReturnDate: Date the book was returned.
Here's how these tables might look:

Books Table:

BookID Title Author Genre Year ISBN


1 To Kill a Mockingbird Harper Lee Fiction 1960 9780061120084
2 1984 George Orwell Dystopian 1949 9780451524935
3 The Great Gatsby F. Scott Fitzgerald Fiction 1925 9780743273565

Users Table:

UserID Name Email Address Phone


101 John Smith [email protected] 123 Main St, Anytown 555-1234
102 Jane Doe [email protected] 456 Elm St, Otherville 555-5678

Borrowings Table:

BorrowID UserID BookID BorrowDate ReturnDate


201 101 1 2024-03-01 2024-03-15
202 102 2 2024-03-05 2024-03-20
203 101 3 2024-03-10

In this example, we have a relational database consisting of three tables: Books, Users,
and Borrowings. These tables are related to each other through common keys (BookID,
UserID) which allow us to establish connections and retrieve related information as
needed.
Primary key
 A primary key is a unique identifier for each record (or row) in a table. It ensures
that each row in the table can be uniquely identified. Primary keys must satisfy
the following conditions:
o They must contain unique values within the table.
o They cannot contain NULL values.

Foreign key

 A foreign key is a field (or combination of fields) in one table that


refers to the primary key in another table. It establishes a relationship
between two tables by linking the data in one table to the data in
another table.
Books Table:

BookID Title Author Genre Year ISBN


1 To Kill a Mockingbird Harper Lee Fiction 1960 9780061120084
2 1984 George Orwell Dystopian 1949 9780451524935
3 The Great Gatsby F. Scott Fitzgerald Fiction 1925 9780743273565

In this table:

 BookIDis the primary key, as it uniquely identifies each book in the table.
 Each value in the BookID column is unique, and it cannot contain NULL
values.

Users Table:

UserID Name Email Address Phone


101 John Smith [email protected] 123 Main St, Anytown 555-1234
102 Jane Doe [email protected] 456 Elm St, Otherville 555-5678

In this table:

 UserIDis the primary key, uniquely identifying each user in the table.
 Each value in the UserID column is unique, and it cannot contain NULL
values.

Borrowings Table:

BorrowID UserID BookID BorrowDate ReturnDate


201 101 1 2024-03-01 2024-03-15
202 102 2 2024-03-05 2024-03-20
203 101 3 2024-03-10

In this table:

 BorrowID is the primary key, uniquely identifying each borrowing record.


 UserID and BookID are foreign keys. They reference the primary keys ( UserID
and BookID) in the Users and Books tables, respectively. They establish a
relationship between the Borrowings table and the Users and Books
tables.
 Each UserID value in the Borrowings table must correspond to a valid
UserID in the Users table, ensuring referential integrity.
 Similarly, each BookID value in the Borrowings table must correspond to a
valid BookID in the Books table, ensuring referential integrity.

In summary, primary keys uniquely identify records within a table, while


foreign keys establish relationships between tables by referencing primary
keys from other tables. They ensure data integrity and consistency across the
database.

You might also like