0% found this document useful (0 votes)
1K views14 pages

DBMS Notes Part 1 - 2024-25

Uploaded by

pushkararyan08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views14 pages

DBMS Notes Part 1 - 2024-25

Uploaded by

pushkararyan08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Introduction to Database Management System

Database Management System using LibreOffice Base


Management of data is of prime importance for any organisation. The ease of entering
data, its efficient storage, accurate and fast retrieval is the primary objective of any
database management system.
A database is a collection of logically related data items stored in an organised manner. The
information being stored in a database can be added, modified, deleted or displayed
according to the requirements of the user. The software that is used to create, update and
retrieve data is known as database management system (DBMS).
Example:- MS Access, Open Office or LibreOffice Base, Oracle, Ingress, MySQL.
Data and Information: The raw facts constitutes data. The facts may be related to any
person, place, activity or things. It may be stored in the form of text, graphics, audio or
video.
Information is the processed or organized form of data. If data is not correct or accurate,
the information obtained by processing such data may not be correct.
Advantages of DBMS:
Organised Storage – The data in the database is stored in an organised manner, so that
retrieval of the required data is fast and accurate.
Data Analysis – A database helps in analysis of data based on certain criteria. It is easy to
find out maximum or minimum value, average or mean using a database.
Data Sharing – If the same data set is required for different applications then the database
can be shared with other applications. Hence using a database means making once and
using it repeatedly for multiple applications
Minimal Data Redundancy – In the event of requiring the same data field in several tables
the data field might get repeated in number of tables. This is called as data redundancy.
This can be reduced by using DBMS tools.
Data Consistency – By minimising data redundancy, chances of inconsistent data being
stored is reduced. For example, it should not happen that the name of the student is
changed in one table and not in another. Such inconsistency is reduced by using a DBMS.
Increases Efficiency – Since database tables are properly organised, saving, reading and
searching data can be carried out efficiently.
Increases Accuracy – Since data redundancy and inconsistency can be minimised in a
database, the data is retrieved accurately from the database.
Increases Validity – Properties of different data f ields can be assigned when a database is
planned. So whether or not valid data is being entered can be checked at the data entry
stage. This increases the validity of the database. For instance, we may set up a restriction
while creating the table that the amount of fees being entered should be more than 1000.
Security – Unauthorised access can be controlled by assigning passwords to the users. The
data might be translated in such a manner that unauthorised users are not able to read it.
This is known as encryption. Both these measures increase the security of the database.
Data Models: A database can be designed in different ways depending on the data being
stored. This structure of database is known as data model that describes the manner in
which data will be stored and retrieved.There are different data models such as hierarchical
data model, network data model and relational data model.
Hierarchical Data Model
In this model the data is organized into a tree like structure. The data is stored in the form
of records. A record is a collection of fields and its data values. All these records are linked
to each other at various levels, thereby forming a hierarchy. For example, in Fig. 8.1 the
data of a company is stored using a hierarchical data model.

Network Data Model: In this model, multiple records are linked to same master file. It is
also considered as an inverted tree where master is present in the bottom of the tree and
the branches contain information linked to the master.
Relational Database Model : The Relational Database Model was proposed in 1970 by E. F.
Codd. Relational database model is the most common type of database model. The data
elements are stored in different tables made up of rows and columns. The data in different
tables are related through the use of common fields. So relations are set between tables
based on common fields. That is why this model is termed as relational database model.
Relational Database Terminology: Let us get familiar with some of the common terms used
in RDBMS.
Entity – It is a real world object about which information is to be stored in a database. For
example, if we want to store information about an entity Student in a school, then we need
to have his admission number, roll number, name, father’s name, date of birth, etc. These
details associated with the entity are called attributes. Each entity is a collection of these
attributes associated with it. So roll number, name, admission number, etc., are attributes
associated with the entity student. These attributes are represented in the form of
columns.
Table – A table is a collection of logically related records. It is organised as a set of columns,
and can have any number of rows. For example, the Employee table can have columns,
namely name, designation, department and have records or rows having data of 100
employees.
Field or Columns or attributes – A field is the smallest entity in the database. A collection of
fields make a record, a collection of records make a table and a collection of tables make a
database. Fields are individual record characteristics and are presented as columns within a
table. Data values are stored in a database as fields. For example, in the Employee table the
field “Emp Name” will hold the names of employees of an organisation.
Data Values – Data values are the raw data represented in numeric, character or
alphanumeric form. Examples of data values are ‘Abhinav Bindra’, ‘26’ ‘shooting’,
“Chandigarh”, “10-12-2018”, etc.
Record or Row – The data values for all the fields related to a person or object is called a
record. It is presented as rows within a table. A record holds the data values of all the fields
for a single person or object in a table.
Primary Key: A primary key or simply a key is a field that uniquely identifies a row in a table.
The primary key is a unique identifier for the table. The column or combinations of columns
that form the primary key have unique values. At any time, no two rows in the table can
neither have same values for the primary key nor can data value for such field be left blank.
For example, in a student table, each student has a unique roll no., which forms the primary
key. If, in a table we use more than one f ields to identify a record, it is known as a
composite key. For example, we may form a composite key consisting of fields roll no. and
name.
Relational Database – A relational database is a collection of related tables. For example, in
Fig the database contains two related tables.

Foreign Key – If a field or a combination of fields of one table can be used to uniquely
identify records of another table, then that particular field is known as the foreign key. This
foreign key helps to build a relation between two tables.
Candidate Key – All the field values that are eligible to be the primary key are the candidate
keys for that table. Such fields can neither be left blank nor can have duplicate values. So in
the table Student Marks, Enrollment Number and Roll Number both are candidate keys.
Alternate Key – Out of the candidate keys, one or two are made as primary keys. The
others are the alternate keys. Hence, if Roll Number is made as the primary key, Admission
Number is the Alternate key.
Objects of an RDBMS: Various objects in a database are as discussed below: • Table – As
mentioned before, a table is the basic unit of any DBMS. The data is first stored in tables in
in row and column format. A column represents a field or an attribute while a row
represents a record.
Forms – A form is a feature of a database using which we can enter data in a table in an
easy and user friendly manner. A form consists of text boxes, labels, radio buttons, list
boxes, check boxes etc. that give a user friendly interface for entering data. The data
entered through the forms is stored in tables.
Queries – A query is used to retrieve the desired information from the database. In simple
terms, it is a question asked from the database. For example, if we want to view the names
of only those students who have scored more than 50 marks, then we post a query.
Reports – The output of a query may be displayed in the form of reports. The usual result of
the query is in the form of rows and columns. But if we want the report to be formal and in
proper layout, then we can use the Reports feature of RDBMS.

Starting with LibreOffice Base


Data Types
A data type refers to the type of data that will be stored in that particular field. The
memory size of a field varies according to its data type.
Some commonly used data types are described below. Text Data Type – The text data is a
combination of letters, numbers or special characters. No arithmetic calculations can be
performed on text data. Examples of text data type is PAN Card Number, Name, Marks, etc.
The table below lists various data types that can store textual data.
Numeric Data Type – Numeric data types consists of numbers. The numbers can be integer
or real numbers on which any type of arithmetic calculations can be performed. For
example, 10, -34.8, 90.6789 , -86 are of numeric data type.

Currency Data Type – The currency data type indicates the monetary values and can be
stored using currencies of various countries. For example $100, £ 500 or Rs. 25.50.
Date Data Type – This data type is used to indicate dates and time. For example
12/25/2019, 08:45 AM. The data and time can be stored in various formats.

Boolean – In boolean data type there can be only two values- True or False. This also can be
given in multiple formats like Yes/No, True/False, On/Off.
Binary – The Binary data type used to store digitized images and sounds that comes as long
string of zeros and ones. It is possible to store photos of the products or employees, or
sound snippets or voice messages in Base database.
Starting with LibreOffice Base
Follow the following steps to create the database.
Step 1. Start the LibreOffice Base as per the standard process of starting the application in
Windows or Linux. In Windows, click Start > LibreOffice or double click on the LibreOffice
icon on the desktop or Select Base Database option from the bottom left panel.
Step 2. A Database Wizard opens. It allows you to create a new database or open an
existing database.
Step 3. Since we want to create a new database, so click Create a new database radio
button. If any database that has already been created is to be opened, then select Open an
Existing Database option to select the database to be opened. Thereafter click Next button.
Step 4. The Next step gives the option to register our database with LibreOffice.org. If we
register the database, then our database is made public and hence can be accessed by
other people. As of now, we would not like to register, so we click and select the radio
button with option, ‘No, do not register the database’.
Step 5. This step also asks whether you want to open the database for editing or want to
create a table using the wizard. The option Open the database for editing is already
selected.
Step 6. Click Finish button to complete the database creation process. The Save As dialog
box appears.
Step 7. Browse for the drive and folder where you want to store your database.
Step 8. Type the name in the File name text box.
Step 9. Click Save button. The database in Base is saved with an extension .odb. Also note
that if no name is given to the database, then it is saved with a default name as
NewDatabse.odb.
User Interface of Libre Office Base: Once a database is created, the screen which appears is
the User Interface of Open Office Base. The various components of the Base User Interface
are discussed below:
Title Bar – The title bar displays the name of a database and an application in which it is
made. The windows buttons to maximize, minimize or close the window are located on the
right corner of the title bar.
Menu Bar – The menu bar appears below the title bar. It consists of seven menu items –
File, Edit, View, Insert, Tools, Window and Help. All these menu items contain commands
that help to perform various operations on the database.
Standard Toolbar – It is located below the menu bar. It is used to access frequently used
tools.
Status Bar – It is located at the bottom of the interface window. It displays information
about the type of view of the object in the database. LibreOffice Base is the collection of
related data objects known as Tables, Forms, Queries, Reports and application modules.
Opening a Database: To open an already created database, click File > Open. The Open
dialogue box appears
Browse for the folder where the database to be opened is stored. Select the desired
database and click on Open button.
Tip: Use the keyboard shortcut key Ctrl+O to open an already existing database.
Creating a Table:
A table in LibreOffice Base can be created using a wizard or using the Design view.
Creating a Table using a Wizard
A table can be created at the time of creating a database or after creating database. To
create a table Domestic Data entry operator – class X 162 2023-24 at the time of creating a
database in database wizard, select the radio button with option “Create tables using the
table wizard”, then click on the Finish button.
Since our database is already open, so we will select and click If the database is opened we
can select Use Wizard to create a table option from the Tasks Pane. The Table Wizard dialog
box will open.
Follow the instructions in the wizard to create the table with desired fields. The Table
Wizard of Base consists of ready-made tables. Click the Sample tables list box and select
select any one table, say Customer from the drop down list.
After selecting the Customer table, various fields appears under Available Fields. The
required fields from Available f ields box can be shifted one by one to Selected fields box
using > button

You can select all the fields from Available fields to Selected fields in one stroke by clicking
on >> button. Click on Next button. It will move you to step 2. Set types and formats. Then
click on Next button.

It will move you to step 3. Set primary key. Let us set the CustomerID field to primary key.
Click on Next button, that will take you to the complete the process of creating table using
wizard.
Click on the Finish button to complete the process of creating the table and using wizard.

The next screen will allow to enter the data as per the selected fields. The data sheet view
interface as will open that allow to enter the data in the Customer table.
Creating Table in Design View
Creating the table using wizard restricts us to use the same fields in the per-designed
tables. It may not solve the purpose in real scenario, as we may require to create a table
with the different fields for our purpose. Creating tables using Design View gives us more
flexibility to do our work.
To create table using Design View, in main Database window, click on the option Create
Table in Design View in the Tasks Pane and Table Design Window will be opened.
The screen is broadly divided into two sections or horizontal panes. The upper half consists
of a grid structure with three columns Field Name, Field Type and Description.
Field Name – It is the name of the field assigned at the time of creation of table.
Field Type – It allows to assign a data type to the field.
Description – It allows to describe the purpose of the field.
The Field Properties pane is located at the bottom half of the window. It displays the field
properties assigned by the database designer.
Follow the following steps to Create Table in Design view.
Step 1. Type the first field name in the Field Name column. Press Tab key. The cursor moves
to the second column i.e. Field Type.
Step 2. The Field Type column contains a list box. As you click on the down arrow, it appears
and we can select the desired data type from the list box. Select the datatype (Varchar).
Step 3. Observe that certain properties appear in the Field Properties Pane as the data type
is selected. Some of the properties are Entry required, Length, Default value, Fig. 9.14:
Selecting data type for field Format example. Set the desired properties for the entered
field.
Step 4. Press Tab key to move to the next column. Add any description if you want in the
third column.
Step 5. Once the properties for the field are set, press Tab key to move to next row. Step 6.
Enter the next field by repeating steps 1,2 and 3. Repeat the process for adding all fields in
the table.
Setting the Primary Key: Every table must have a primary key that uniquely identifies a
record in the table. To make a particular field as the primary key, place the mouse pointer
before the field name, say Event Id in our above example and right click. A pop up menu
appears. Select the Primary Key option from pop up menu.

A key icon appears before the field name indicating that it is a primary key.
Saving a Table: To save the table click on the save button or follow menu option File > Save As.

Press Ctrl + S to save the table or click Save icon from the toolbar. If the table is being saved after making some
changes, simply select File-> Save option.

Entering Data in a Table: To enter data in the table, double click on the created table
Events icon in the Tables Object Area on the database screen. Alternatively, we can open
the table by right clicking on the desired table and then selecting the Open option from the
drop down menu. Start typing the data value for each field. Use Tab to move to next field.
Navigating through the Table: The black pointing arrow ( )just before the field name is the
record pointer. To navigate through various records of the table, we use the navigation box
present at the bottom of the datasheet window. It indicates a current record of the table at
any given time.

The various components of Navigation Box are as follows:


Record Selector Box – This is the text box where the currently active record number is
displayed. We may enter the record number that we want to see in this text box.
Navigation Buttons – These are used to scroll vertically in the table.
Press to move to the first record.
Press and to move to the next and previous records Press respectively.
Press to move to the last record.
Note that the record pointer is on fourth record, the Navigation Bar shows the “Record 4 of
4”.
Editing Data: To edit or modify the previously entered data simply place the cursor on the
field value that has to be edited to edit and enter the new value.
The Edit icon appears before the record that is being edited. This icon is displayed
till the table is saved after making the required changes. Press Esc key to cancel the
corrections made and restore the original contents.
Deleting Records from Table:
To delete any record from the table, open the table and select the record to be deleted.
The record can be deleted by pressing the Del key from the keyboard or selecting the
Delete Record option from the Edit menu. Alternatively a record can also be deleted by
right clicking on the record and clicking on the Delete Rows option from the pop up menu.
Attempting to delete the record will display the Confirmation box. Clicking on Yes button
will finally delete the record, while clicking on the No button will not delete the record.
Sorting Data in the Table:
Data in a table can be arranged in ascending or descending order. This process of arranging
the records in particular order on any filed is called as sorting.
Follow the following steps to sort the table.
Step 1. Open the table in datasheet view and select the field on which you want to sort.
Step 2. From the tool bar click Sort Ascending icon if the table has to be sorted in
ascending order of selected field. Alternatively select Sort Descending icon if the table
has to be sorted in descending order of selected field.
Step 3. The table will be sorted in the ascending order of points.
Sometimes we may need to sort the table based on more than one fields. In such case, click
Sort icon on the toolbar. The Sort Order dialog will be displayed. Select the appropriate field
name and field value according to which the records are to be sorted. Choose the order of
sorting ascending or descending as required from the Order drop down box. Multiple fields
may be selected in this dialog box. Click OK button once done.
Closing LibreOffice Base: To close the application window of LibreOffice Base, click on the
File > Close or click on the cross (x) button of the LibreOffice Base window.

You might also like