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

Databasefinal

The document introduces the concepts of databases and database management systems. It discusses the advantages and disadvantages of file-based systems compared to DBMS. A file-based system is best for small, personal data but has issues like data redundancy, inconsistency, isolation and lack of security. DBMS can handle large amounts of structured data centralized and provides features like security, backups, data analysis and improved decision making. It then covers database normalization concepts like 1NF, 2NF and 3NF and provides an example mapping books to categories in tables to illustrate normalization. Finally, it outlines some business rules that could apply to a bookstore database.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Databasefinal

The document introduces the concepts of databases and database management systems. It discusses the advantages and disadvantages of file-based systems compared to DBMS. A file-based system is best for small, personal data but has issues like data redundancy, inconsistency, isolation and lack of security. DBMS can handle large amounts of structured data centralized and provides features like security, backups, data analysis and improved decision making. It then covers database normalization concepts like 1NF, 2NF and 3NF and provides an example mapping books to categories in tables to illustrate normalization. Finally, it outlines some business rules that could apply to a bookstore database.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Introduction to Database.

Module Code : CT042-3-1-IDB


Introduction to Databases
Intake Code : NPT1F2309IT
Lecturer Name : Sushil bhattarai
Hand in date : 1 MARCH 2024
Student ID Student Name
NP069755 Saroj Khadka
NP069751 Sangam Humagai
NP069679 Kapil Bhattarai
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

Table of Contents
1.0 Database and Database Management System.........................................................................3

2.0 Business Rule and Normalization............................................................................................6

2.1 Normalization.......................................................................................................................6

UNF & 1NF................................................................................................................................6

2NF..............................................................................................................................................6

3NF..............................................................................................................................................6

Category Book Mapping:..........................................................................................................7

2.2 Business Rule........................................................................................................................7

3.0 Entity Relationship Diagram...................................................................................................8

4.0 Database Schema......................................................................................................................9

5.0 Data definition language(DDL).............................................................................................10

5.1 Create tables with queries.................................................................................................10

5.2 Inserting data in the table................................................................................................13

5.3 Tables with insert value.....................................................................................................16

6.0Data manipulation language..................................................................................................19

7.0 Conclusion..............................................................................................................................22

8.0 Workload Matrix....................................................................................................................23

9.0 References...............................................................................................................................24

2|Page
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

1.0 Database and Database Management System

Everyone at Tribhuvan University (TU) has a problem with the library despite having a large
collection of books and accessing the e-book library is so harsh in this condition. Students are
limited with their small campus library, causing limited resources, and students are being forced
to search for books in shops near the area but now TU is planning to create an e-bookstore to
solve these problems. The e-bookstore will solve the problem of students buying books and other
course materials from many genres, improving the learning and research outcomes of students
and Teachers. To books is choosing a database. A database is a collection of logically connected
information arranged so that it may be readily accessed, maintained, and updated. (Taylor, n.d.) .
There are two types of Databases they are,
1. File-based system.
2. Database Management System (DBMS)

File-based system.

A file system is a program that facilitates the retrieval and maintains small size of data. It is
found in an operating system and is responsible for saving and manipulating information that is
in the memory of the computer, such as a Solid-state drive or flash drive. File systems function
as electronic forms of hardcopy filing systems that handle a wider variety of file types. (Norton,
2021).

Advantages of file-based system.

The advantage of file-based system area:


 It is user-friendly for people. Many file systems are based on GUI which makes it easy
for beginners.
 It is best for managing small office work and personal information.
 It is fast and less consuming.
 Most file-based systems are free and cheap.

Disadvantages of file-based system.

File-based systems have So many advantages and it is very famous for storing information, but
they also have disadvantages. The various disadvantages of the file-based system are:
1. Data redundancy refers to the duplication of data. For example, if we are handling data
for a library and a student and student is borrowing two or more books then his record

3|Page
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

will be stored individually, and it will take higher storage need and cause inconsistency
of data.
2. Data inconsistency: Data redundancy makes data inconsistency. For example, if the
availability status of a bookstore in different file locations and not updated daily, it will
lead to inconsistent information about the book and whether it is available for borrowing
or not.
3. Data Isolation: Data spread in different, and files can be in different formats, so making
new application programs to find the proper data will be tough.
4. Atomicity problem: Atomicity refers to the operation where either all operations must be
successful or none. For example, if a student wants to borrow two books either two books
should be borrowed or neither of them.
5. Data Security is crucial in the library to keep student details and transaction history.
(SINGH, n.d.)

Database management system (DBMS)

DBMS can manipulate large amounts of data. It has many features such as Security to prevent
breaches and threats, it can backup data in case data gets lost which is not possible in file file-
based system but it is very difficult to operate and requires skilled manpower to manipulate data
which becomes expensive. (Norton, 2021)

Advantages of DBMS

Database management systems (DBMS) have many advantages over file-based systems. DBMS
enhances data handling by storing it in a centralized location, making it easy for users to access
and manipulate data. So, it minimizes data access issues by improving efficiency and reducing
the time taken to access data. DBMS provides a user-friendly and secure environment for storing
and manipulating information. This enhances security by implementing privacy and security
policies to prevent unauthorized access and information abuse. Security is a top priority for
companies, leading them to invest significantly in safeguarding their data. DBMS consolidates a
wide range of data into a single set, providing insights into business operations and offering a
comprehensive view of the overall business process, including relationships and outcomes across
different sections. DBMS improves decision-making by offering accurate, comprehensive, and
easily accessible data. DBMS provides tools for analysis and reporting, empowering users to
make informed decisions, thereby enhancing business decision-making processes and increasing
profitability. Database management systems (DBMS) enable efficient data retrieval, search, and
manipulation, simplify database maintenance, and use, and provide instant access to stock

4|Page
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

availability information. DBMS enhances end-user productivity by transforming raw data into
usable information, enabling swift and educated decision-making. Adopting a DBMS allows for
efficient data access and analysis, leading to higher productivity and enhanced decision-making
skills in the competitive global market. DBMS delivers a straightforward logical representation
of data. Tasks such as inserting, deleting, or creating files or data are easily done in a DBMS.
Databases are meant to give a simple and clear picture of data to consumers, covering the inner
mechanics of data administration. Developers use advanced methods to improve database
efficiency, whereas users access data through simpler interfaces. (Advantages of Database
Management System, n.d.)

5|Page
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

2.0 Business Rule and Normalization

2.1 Normalization

UNF & 1NF

BookCategoryID BookID

1 1001

2 1002

3 1003

The above-given table is of the Book category. The table is in Unnormalized and also is in 1NF
it is in 1NF because all the values are automatic and there is no repetition of the data.

2NF

BookCategoryID BookID CategoryID

1 1001 101

2 1002 102

3 1003 101

The above-given table is in 2NF cause there is the implementation of 1NF and there is transitive
functional dependency
3NF

BookCategoryID BookID

1 1001

2 1002

3 1003

6|Page
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

In the above-given table, it is about 3NF for 3NF there should be 2NF implemented and all non-
prime attributes are non-transitively dependent on the primary key.

Category Book Mapping:

BookID CategoryID

1001 101

1002 102

1003 101

In the above-given table, it is about 3NF for 3NF there should be 2NF implemented and all non-
prime attributes are non-transitively dependent on the primary key.

2.2 Business Rule

 A publisher can publish many books, but a book is published by only one publisher.
 A customer can become a member, but a member is associated with only one customer.
 A customer can buy many books, and a book can be bought by many customers.
 A member manages their shopping cart.
 A member provides feedback for one or multiple books.
 A book can be included in many orders, but each order consists of only one book.
 An order generates one invoice, but an invoice can be generated from multiple orders.
 A book can belong to many categories, but each category can contain many books.

7|Page
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

3.0 Entity Relationship Diagram

An ER-Diagram (Entity Relationship Diagram) is a diagram that represents or shows the


relationships between tables or the entities

The Entity relation diagrams three components are:

• Entities

• Attributes

• Relationships

There are also different types of relations in the ER diagram

• One to One

• One to Many

• Many to Many

8|Page
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

4.0 Database Schema

9|Page
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

5.0 Data definition language(DDL)

5.1 Create tables with queries

publishers

Book table

Order table

10 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

Customers Table

Members table

Shopping cart table

11 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

Invoices table

Feedback table

Categories table

Book Categories table

12 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

5.2 Inserting data in the table

13 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

14 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

15 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

5.3 Tables with insert value

16 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

17 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

18 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

6.0Data manipulation language

Question 1

The query chooses only defined columns of the Books database (book ID, title, author, genre,
price, quantity available) and combines them with the Publisher’s dataset to add the publisher
name.

Question 2

This SQL query is to alter the `PublisherID` column of the `Books` table when `BookID` equals
1001 by setting it to 9. The inclusion of a `WHERE` clause makes sure that just that one record
is altered, thereby assuring that other entries in the table will not be unintentionally affected.

Question 3

The “PublisherName” field from the Publishers dataset and the “Title” column from the Books
table are obtained by this SQL query. A match on the PublisherID field between two tables is
what it relies on. All rows of the Publishers table and only matching rows of the Books table are
included since it employs a RIGHT JOIN. For the Title column, if there is no match in the Books
database then null values will be returned

19 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

Question 4

This query pairs material from the 'Books' and 'Publishers' columns using a FULL JOIN on the
'PublisherID' column. It obtains the title of each book and the name of its publisher, presenting
all books and publishers, even if there are no matches.

20 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

Question 5

This obtains the `Title` from the `Books` and `OrderID` from the `Orders`. It joins them using a
`LEFT JOIN`. This displays all `Books` and just matches `Orders` based on `BookID`. If a book
has no matching orders, `OrderID` displays NULL.

21 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

7.0 Conclusion

In conclusion, the introduction of an e-bookstore at Tribhuvan University (TU) could reduce the
present limitations and obstacles experienced by students and staff in terms of access to various
books and learning materials. The e-bookstore will enable quick purchasing of books as well as
feedback about them while comparing various items; therefore, increasing the learning and
research experience at TU. The database system will guarantee that information regarding books,
stock levels, customer details, and orders is handled properly to optimize bookshop operations
which in turn increases customers’ pleasure. Moreover, customer feedback coupled with ratings
would make the bookshop more interactive, consequently offering a nice purchasing experience
to every consumer. Overall, the establishment of an e-bookshop should be a win-win scenario for
the TU community hence creating a way for dynamic and productive venues for study.

Assignment Component Saroj Sangam Kapil Total


Khadka Humagain Bhatrai

22 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

Database and Database Management 30% 50% 20% 100%


System

Business Rules & Normalization 40% 30% 30% 100%

Entity Relationship Diagram 40% 40% 20% 100%

Database Schema 25% 50% 25% 100%

Data Definition Language 40% 40% 20% 100%

Data Manipulation Language 35% 40% 25% 100%

8.0 Workload Matrix

23 | P a g e
CT042-3-1-IDB Introduction to Databases NPT1F2309IT

9.0 References

Advantages of Database Management System. (n.d.). From GeeksforGeeks:


https://www.geeksforgeeks.org/advantages-of-database-management-system/

Norton, K. (2021, may 24). File-Based Data Management System. From Webopedia:
https://www.webopedia.com/definitions/file-management-system/#:~:text=A%20file%2Dbased
%20data%20management%20system%20(also%20called%20a%20file,hard%20disk%20or
%20flash%20drive.

SINGH, C. (n.d.). Advantages and Disadvantages of DBMS: DBMS vs file System. From beginnersbook:
https://beginnersbook.com/2015/04/dbms-vs-file-system/

Taylor, S. (n.d.). Database. From corporatefinanceinstitute:


https://corporatefinanceinstitute.com/resources/data-science/database/

24 | P a g e

You might also like