0 ratings0% found this document useful (0 votes) 38 views28 pagesData Base For First UT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Database Management
System
are
© Data and information = Database 3
* Data Mode ‘Relational Databace Management System (RDBMS)
© Creating Databaee Using LbreOtties Base * Opening s Database
Dota Type is Doiabose * creating 2 Table
© tae able in Design View ‘= Inserting Data ina Table
* Navigating Record in Table * Deleting a Table
Renaming 3 Table + Closing Libreoffice Base
© What are Relationships? ' eferenuintesity
© What isa Query? {structured Query Languse(SQ)
© Whotisa Form? ‘© What ie Report?
‘A database is an organised collection of structured information or data, typically stored in tabular format. Its designed
to efficiently manage, retrieve, and manipulate data accorting to various criteria or requirements. Databases are widely
Used in numerous applications, ranging from simple personal record-keeping to complex enterprise-level systems.
LibreOffice Base isa free and open-source relational database management system (RDBMS) included in the LibreOffice
suite, It provides a Graphical User Interface (GUI) for useis to create, modify, and manage databases. LibreOffice Base
offers features for designing forms, creating reports, and querying data, making ita versatile tool for both individuals.
and organisation requiring database management capabilities without the need for expensive proprietary software.
Data consists of raw facts and figures. It can be in the form of text, numbers, dates, images, audios, videos, etc. Some
‘examples of data are the name, age, and address of a student and the amount and price of an item bought from the
market, This collection of related data arranged in the form of rows and columns will form structured data.
‘The structured data can be classified as:
‘Flat file: t stores data in a plain text format. The data isin the form of rows and columns, but data constraints cannot
be applied, and there are chances of data redundancy, For example: data created using tabs or commas in Word,
CSV file, Spreadsheet file, ete.
‘+ Relational file: It stores data of different data types like text, number, and date in the form of rows and columns to
form a table, These tables are linked through a common field, so there are no chances of data redundancy.
For example:
= Numbers. 2, 2,3,4,5
‘© Words: Apple, Banana, Cherry, Date, Elderberry
‘+ Temperature readings: 25°C, 28°C, 30°C, 27°C, 22°C
‘+ Time stamps: 9:00 AM, 10:00 AM, 11:00 AM, 12:00 PM, 1:00 PM.
=w Database Management SystemFor data to be useful it needs to be processed by a computer or another computing device. Information is processed,
organised, and meaningful data that provides context, relevance, and value. Itis the result of interpreting, analysing,
and synthesising data to derive insights or make decisions. f data is not corrector accurate, the information obtained by
processing such data may not be correct. For example, ina library database, information could be the availability status
of a book, its location in the library, and the borrower's deiails. Other forms of information are pay-slips, schedules,
worksheet, bar charts, invoices, account returns ete,
For example:
«© Fruits: Apple, Banana, Cherry, Date, Elderberry
‘© The temperature increased from 25°C to 30°C between 9:00 AM and 11:00 AM.
‘© At 12:00 noon, the temperature was 27°C.
md oaranase
Adatabase
2 callection of logically ralated data items stoved 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. We are using
2 database in almost every field. It is used by the schoo! to store information about students and books in the library.
when we go shopping then the shopping complex uses a database to maintain the details of stock and customers,
Companies use databases to keep track of their employees’ information. in almost every field, we are directly or
indirectly using a database.
The software is used to create, update, and retrieve data in.a database is known as a Database Management System
(DBM). It facilitates planning and maintenance of the database for the user. Some of the commonly used Database
software are as follows:
# Oracle + dRase
© Microsoft Access + MongoDs
= Myson + OpenOffice Base
© Ingress «+ Libreoffice Base
# SQL Server
Libreoffice Base is an open source RDBMS. In this unit, we will earn Database concepts using LibreOfice Base.
Features of Database
The main features of a database are as follows:
‘© There can bé fore than one table in a database. For example, in a school, in the Students’ database, there can be
one table for saving personal details about the student, Arother table may be for storing marks and progress of the
student. Other tables may include fee details, library books issued, etc. all related to the student,
‘© The information stored ina table in a database relates to one specific topic. So, all the related information on a topic
can be viewed in one single table,
«© Ina database, data can be simultaneously accessed by meny users. So, it saves storage space by storing one table at
one place from where every authorised user can access it
«© Database offers data protection and features lke recovery and backup for easy recording and retrieval of data.
‘© Database allows the users to view data in different views with the required information only.
+ Data stored in a databace remains permanently stored tll the time itis manually deleted from the system/ server.
If the database table has a unique field, then there are minimum chances of duplication of data which avoids
confusion at a later stage.Advantages of Database
Some advantages ofthe database areas follows:
'* Organised storage: Databases employ structured formats and indexing mechanisms to organise data efficiently,
which allows fast and accurate retrieval of information. This organisation typically follows a predefined schema,
ensuring data integrity and facilitating query operators.
+ Data analysis: DBMS systems provide powerful querying capabilites that enable users to perform various analyses
onthe stored data. Aggregate functions, sorting, tering, and prouping operations make it eo3y to understand such
as maximum, minimum, average, or other statistical measures from the data
+ Reduces data redundancy: Data Redundancy means keeping multiple copies ofthe same data in a System, Using
DBMS, the data in tables are interlinked through a cormon column to avoid duplicate entries. Data constraints are
applied to store data based on diferent criteria,
«Sharing of data: It means data can be accessed by multiple users tthe same time. biferen users can have fferent
rights and privileges to access data. Some may have the right to only view the data. Some may have permission to
modify the data atahaca arminleteatore manage te rights and privileges for sharing’data through a centralised
system,
‘© Data consistency: It ensures that data remains accura‘e, reliable, and uniform across the database. 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: By organising data in a structured manner and optimising storage and retrieval mechanisms,
databases enhance overall system efficiency. Indexing, caching, and query optimisation techniques ensure that
operations like data insertion, retrieval, and modification are performed quickly and with minimal resource
utilisation,
‘+ Increases accuracy: The centralised nature of databases and the enforcement of data integrity constraints ensure
that the information stored is accurate and réliable. Redundancy reduction and normalisation techniques mitigate
the risk of errors caused by duplicate or inconsistent data.
‘= Increases validity: Database systems allaw the specification of data validation rules and constraints at the schema
level. These rules enforce the integrity and validity of data at the point of entry, preventing the insertion of invalid
or inappropriate data values. This ensures that the database maintains a high level of data quality and reliability.
‘+ Data security: DBMS provides data security so that chly authorised users can have access to the database. For
security reasons, different users have different privileges. Also, users have assigned user IDs and passwords for
authorised access to the centralised database.
JAMS provides data backup and recovery features. Users can maintain data backup on
‘= Data backup and recover
weekly or fortnightly so that if data loss occurs due to system failure the data recovery process can be easily carried
out.
mmmSioara moves
‘A data model in database management systems (DBMS) is a conceptual representation of how data is organised and
structured within the database. It defines the relationships between different types of data, the constraints that apply
to the data, and the operations that can be performed or the data
Hierarchical Data Model
‘The Hierarchical Data Model organises data lke a family tree. At the top isa single parent, and underneath are children,
‘who can have children oftheir own, The data is stored in the form of records. A record isa collection of fields and their
data values, All these records are linked to each other at various levels, thereby forming a hierarchy. Think of it like files,
and folders on a computer, where each folder can contain multiple files or subfolders.
=
eA Database Management SystemWhile simple to understand and navigate, this model can be rigid and challenging to adapt when data relationships
change.
‘The hierarchical data model encompasses the following elements
‘+ It comprises nodes linked by branches.
‘+ The highest node is known as the root node.
‘+ When multiple nodes exist at the highest level, they are termed root segments.
‘+ Every node possesses precisely one parent.
+ Asingle parent can have numerous children.
‘The following figure shows the hierarchical data model:
In the figure, “Electronics” is the main category, lke the trunk of a tree. It has two main branches: “Televisions” and
“Portable Electronics.” Each of these branches then further divides into, more specific types, like "Tube," “LCD,” and
“Plasma” under “Televisions.” This setup shows how one category can have several subcategories, ike a family tree.
Network Data Model
‘The Network Data Model has multiple records linked to the same master file. 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. This
‘model offers more flexibility in organising data, but t can be harder to manage compared to simpler models.
‘The following figure shows the network data model:
further branches, while “Project 2” has two, Together, they comprise five branches: “Department A,” “Department B/
—
ae ___—dRelational Data Model
‘This data model is based on the principle of setting relationships between two or more tables of the same database.
Itis the most used database model. The relational databese model was proposed by Edgar F. Codd in 1970, Relational
database model is the most common type of database model. In the relational database model, data is organised
into tables, with each table consisting of rows and colurmns. Each row represents a record or entity, and each column
represents a specific attribute or field of that entity. The data in different tables are related with common fields. So,
relations are set between tables based on common fields. That is why this model is termed as relational database
‘model. These relationships enable the database to maintain data integrity and enforce constraints such as referential
integrity
By storing related data in separate tables and establishing relationships between them, the relational model allows for
efficient data organisation, retrieval, and manipulation. This moder's flexibility and scalability make it one of the most
‘widely used and versatile database models in various industries and applications.
The difference among hierarchical, network, and relational data models is shown in the following table:
S.No. | Hierarchical Data Model Network Data Model Relational Data Model
1 | Datais organised in a treesike | Like the hierarchical model but|Data is represented in tables
structure, with parent-child | with more flexible relationships, | consisting of rows and columns.
telationships.
2 [Each child node has exactly WS based on mathematical set
‘one parent node. ‘nodes, allowing for more complex| theory and predicate logic.
connections.
3 |IUs primarily used in older|it uses poirters to represent | Relationships between tables are
database systems, relationships between records. | established using keys, primarily
primary and foreign keys.
4 | Itisrigidin structure andis not | Developedasanimprovement over | Offers flexibility and scalability,
suitable for applications with | the hierarchical mode! but still has] making it widely adopted in modern
evolving data structures or ferms of complexity | database systems.
complex relationships. and scalability.
5 | Querying hierarchical data can | Querying in the network data| Querying is simplified with SQL
bbe complex due to. its rigid| model cane more complex] (Structured Query Language) which
structure. compared to the relational model. | provides a standardised way to
retrieve and manipulate data
RDBMS is an advanced form of Database Management System and is based on a Relational Model. in this model, a
relational database has a set of related tables that are interlinked to each other based on a common field. Its a very
cefficlent way of representing data and allows data in a table to be represented in a two-dimensional form and is known
‘as a Relation, A row in a relation is called Tuple or Record. Its a collection of related data fields. Each tuple uniquely
identifies a record based on a unique key-known as Primary key. Data from different relations can be easily extracted
as they are interlinked based on a Primary key. A columa in 2 relation Is called an Attribute or Field. It store similar
data type value
Structured Query Language (SQL) isthe standard language for managing relational databases and performing various
‘operations on the data inthe tables. It would enable us to store, retrieve, and manipulate data in the tables.
sy
eA Database Management SystemDomain
tere __ oonsomos
mrimory gap NAME Posts salary
er | Rahul cterk 30000 .
Rows io Kapil Manager 90000 i
records
eros 5
8
is Mukesh Peon 20000 | y
T
Depo (Wo of Cc) =@ ata elve
Basic Terminologies of RDBMS
Some of the important terms of RDBMS are as follows:
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, oll number, name, admission number, etc., are attributes
associated with the entity student. These attributes are represented in the form of columns,
‘+ Tables: Tables are the basic structure of a database where data is stored. A table isa collection of logically related
records. Its organised as a set of columns and can have any number of rows. Each row represents a record, while
each column represents afield or attribute of that record
‘+ Data Values: Data values are the raw data represented in numeric, character or alphanumeric form,
‘+ Fields/Columns: Fields or columns are the individual pieces of data stored within a table, Each field has a data type
associated with it, such as text, number, date, etc. A fields the smallest entity in the database. A collection of fields,
makes a record, a collection of records makes.a table, and a collection of tables make a database.
“+ Records/Rows: Records oF rows are individual entries within a table, The data values for all the fields related to a
person or object is called a record. Each row represents 2 single instance of data, with each colurn containing a
specific attribute of value for that instance.
‘+ Keys: A key sa field or combination of fields that uniquely dentify a record (row) in a table. Keysare essential for data
integrity and for establishing relationships between tables in a relational database management system (RDBMS).
“* Relationships: Relationships define how tables within 2 database are related to each other. Common types of
relationships include one-to-one, one-to-many, and many-to-many. These relationships are established using foreign
keys, which are fields in one table that reference the prirrary key of another table.
‘+ Constraints: Constraints are rules that enforce data integrity within a database. They define the conditions that
‘must be met for data to be inserted, updated, or deleted in a table. Common types of constraints include primary
key constraints, foreign key constraints, unique constraints, and check constraints.
* Queries: Queries are commands or statements used to retrieve, manipulate, or analyse data within a database,
They allow users to perform tasks such as selecting specific records, calculating aggregate values, updating data,
and joining multiple tables together.
+ Degree: This refers to the number of attributes or columns in a table. For example, if a table has five columns
(attributes), then the degree of the table is 5,
‘+ Cardinality: This refers to the number of tuples or rows 1a table, For example, if a table has 100 rows, then the
cardinality of the table is 100,Different Types of Keys in a Relation
‘When the data is stored in the form of records, there are chances that the data values are repeated. For example, in a
lass of forty students if table is created with - Name, Acdress, City, Date of Birth, and Phone number then there may
be two or more students with the same name. There are also chances when twins staying in the same house will have
the same address, Date of Birth and phone numbers. Two or more classmates may have different addresses or phone
‘numbers but share the same birth date. So, with so many similarities and so many repetitions of values in different
columns, we may face the following issues:
‘+ If specific information is needed in a database, then searching will become difficult, For example, ifwe see the above
‘able where there are two students with the same name- Smith. Ifa teacher wants to call the parents of Smith
‘who lives in Defence Colony because he has been absent for 2 long time without any information, then it becomes
dificult to search unless both records are uniquely identified.
+ Searching might not give you the correct information.
+ There are chances of storing duplicate and unwanted/ erroneous values inthe table
«+ tf aata ic neerdod fem nun ar mate tables, then inking of multiple tables cannot be done unless there fsa common
and unique column,
key oF an attribute solves all the above problems. It stores data values of a similar type. Different kinds of keys can
be created in a table for the efficient retrieval ofthe data, These keys are as follows:
+ Primary key: A primary key uniquely identifies each record (row) in a table. If mst contain unique values and
cannot contain NULL values (empty / nothing). At anytime, no two rows in the table can neither have same values
for the primary key nor can data value for such fleld be lef blank. Inthe given table DEPT, the primary key isthe
DDCODE column as it uniquely identifies each record. We ean have only one primary key ina table.
Table: Dept
cope DEPARTMENT. cry
pot Nedia DELHI
oz Marketing DELHI
o3 INFRASTRUCTURE | MUMBAI
05 Finance KOLKATA
Primary Cadidate Key Alternate
Key Key
‘Candidate key: An attribute or a set of attributes that can uniquely identify a record and is capable of being a
primary key is called a candidate key. n the table DEPT, DCODE and DEPARTMENT are the candidate keys as they
have chances of unique values. We can have atleast one candidate key in a table.
«Alternate key: A remaining candidate key which is not selected as the primary key is called an alternate key. in the
table DEPT, the primary key is DCODE, and the alternate key is DEPARTMENT.
‘+ Composite key: Sometimes a single attribute cannot beused asa primary key then in that case two or more attributes
in combination will form a unique set of values which can be used as a primary key. Such a set of combinations of
attributes is known as a Composite key. In the table DEPT, DEPARTMENT, CITY together are the composite keys as
they have chances of unique values.
‘+ Foreign key: Itis an attribute or a set of attributes whase values match the primary key of another table. A primary
key of one table when used in another table is called foreign Key. 4 relationship between two tables matches the
primary key of one table with the foreign key of another table,
=
eA Database Management System‘Table: PRODUCT
PID PRODUCTNAME | MANUFACTURER PRICE EXPIRYDATE
Pot Talcum Powder lak 40 2011-06-26
Fwos, Face Wash ABC 45 2010-12-01
Sot Bath Soap ‘ABC 35 2010-09-10
HOG shampoo iz 120 2012-08-08
Fwa2 Face Wash XZ 95 2010-08-15
Table: CLIENT
10 ‘CLIENTNAME cry PID
1 ‘Cosmetic Shop Delhi wos
6 Total Health Mumbai 8501
77 tive ute Delhi SHOB
15 Pretty One Delhi FWOS:
16 Dreams Bengaluru POL
14 Expressions Delhi NULL
Primary Key: PRODUCT: PID
CUENT CID
PID isa foreign key in the CLIENT table
In the above table PRODUCT, the primary key is PID. In table CENT, the primary key is CID. The relationship between
jek! PID. 34 PUD in Pri
PRODUCT and CLIENT is made because of the presence of a cot
and a Foreign key in table CLIENT.
1 KNOW <-
Which of the following statements about a primary key in a relational database is correct?
hey i lable PRODUCT
» team contain duplicate values.
» iteanbe NULL,
> ‘tuniquely identifies each record in a table:
0000 ¥
> tcisused to define relationships between tables.
Find on Google
Whats an actibute or a set of attributes whose values match the primary key of another table? §, Q.
a
(SESS CREATING A DATABASE USING LIBREOFFICE BASE
Following the given steps to create a database using Libreoffice Base:
Step 1: Click on the Start button. The Start menu will appear
Step 2: Select the LibreOffice folder from the Start menu,
Step 3: Click on the LibreOtfice Base option.‘The Database Wizard with two steps will appear as explained below:
1. Select database: This will help you create a new database, open an existing database file or connect to a database
stored on a server. So, you can select:
‘+ Create a new database: To create a new database.
‘© Open an existing database file: It helps you open an existing file displayed when clicking on the drop-down list
‘= Connect to an existing database: This can be usedif the database is stored on a server,
Step 4: Select the Cre
‘Step 5: Click on the Next button.
new database radio button,
Database pane
2. Save and proceed: This step will help you create a new database, sav
Step 6: Click on the Yes, register the database for me radio button.
‘Step7: Click on the Open the database for editing check box.
‘Step 8: Click on the Finish button.
Sa
— Cenger secant
EEE (hc cementation
Domenie trating
Toes teatThe Save As dialog box opens.
Navigate the location where you want to save the database.
Step 10: Enter the desired name of the database in the Flla Name text box. In this case, we have entered School.
Step 11: Click on the Save button.
Note that an LibreOffice database is saved with an extension of db.
‘Anew database with the name - School.odb is created with the objects Tables, Queries, Forms, and Reports and
LibreOffice Base interface opens as shown in the picture below:
Tile bar
Menu bar
¢LCrasks pane
Tables/Queries/
Forms/Reports
ane
‘Status bar
User Interface of LibreOffice Base
‘The user interface of LibreOffice Base is structured to provite users with easy access to database management tools,
and functionalities, Here’s an overview of its main components:
{+ Title bar:Title bar displays the name of the database beingaccessed and the name of the LibreOtfice Base application,
also typically contains the window control buttons for minimising, maximising, and closing the
ae «dS
dow.‘+ Menu bar: Menu bar contains various menus such as Fle, Edit, View, Insert, Tools, Window, and Help. These menus
offer a wide range of commands and options for managing databases, designing forms, creating queries, generating
reports, and more.
‘+ Standard toolbar: Standard toolbar is located below the Menu bar. It contains a set of commonly used tools and
commands, offering quick access to essential functions. The icon on the Standard Toolbar allows users to perform
‘tasks such as opening and saving databases, creating new objects (tables, queries, forms, reports), printing, sorting,
ete
‘+ Database pane: Database pane provides a hierarchical view of the various elements within the database project.
‘These elements typically include Tables, Queries, Forms, and Reports. Users can navigate through these components
to manage and interact with their database objects.
‘+ Task pane: The Tasks area provides several options ta select common actions based on the selected object in the
database pane.
‘+ Tables/Queries/Forms/Reports pane: The Tables/Que'ies/Forms/Reports pane, allows used to manage and access
‘various elements ot your database. By detault, this pane Is usually positioned below the “Tasks” pane, providing
easy access to different objects within your database.
‘© Status bar: Status bar is located at the bottom of the interface window. This bar displays information about the
current state of the database or the active object. It may indicate the number of records in a table, the type of view
being used, or other relevant details
Objects of a Database
Ina relational database management system, an object ina database is a strueture or a feature that is used to store,
represent or retrieve data. Infact, a database is a collection of these objects that work on multiple sets of data related
‘to each other. These objects serve various purposes and =l2y eritieal ralee in organicing, accerting, and managing the
database efficiently. These objects are displayed in Database pane when you open LibreOffice Base window. These
include:
‘© Tables: By default, Table Object is selected in the Database Pane. A table is the basic unit of any DBMS.
It is a structured collection of data organised into rows and columns, forming a grid-like structure. Each row
represents a single record or entry in the database, while each column represents a specific attribute or fleld
pertaining to that record, Tables provide a logical and efficient way to organise data, enabling users to store, retrieve,
and manipulate information with ease. They serve as “he primary building blocks upon which the entire database
is formed.
= Queries: Queries are powerful tools within an RDBMS that allow users to extract, manipulate, and analyse data
stored in the database. Queries allow users to obtain the precise information they need for various purposes, such
as reporting, analysis, or application development.
‘+ 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. They provide a user friendly way to facilitate the input, editing, and viewing of data within an RDBMS with
the help of graphical elements such as text boxes, drop-down menus, checkboxes, and buttons.
‘+ Reports: Reports are formatted presentations of data generated from a database. They take raw data and turn it
into a structured, easy-to-understand format. The output of a query may be displayed in the form of reports with
data arranged 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.‘Table: STATIONARY
Img SoFENING A daraase
Follow the given steps to open an already created databace:
‘Answer the following questions based on the above tables:
2. Identity the Primary Key forthe tables STATIONARY and CONSUMER
b. Identify the Alternate Key of the table CONSUMER
Identity the Candidate Keys ofthe table STATIONARY
4. Identify the Foreign Key of the table CONSUMER.
Step 1: Select the File - Open option from the Menu bar.
‘The Open dialog box open.
Step 2: Navigate the location where the database is stored,
Step 3:_ Select the desired database that you want to open.
on the Open button
co
om +
Doone «
oun +
semi
‘The selected database gets opened.
SID. SNAME ‘COMPANY, PRICE ‘STOCKDATE:
Por Pen ‘ABC 10 2011-08-31
Po Pencil XV 6 2010.01.01
EROS. Eraser 7 2010-02-14
PLoL Penil CAM 2009-01-09)
‘cron GelPen ABC 15 2009-08-19
‘Teble: CONSUMER
0 ‘CNAME "ADDRESS 3D)
o1 ‘Good Learner Delhi Plot
06 ‘Write Well Mumbai ‘aP02
2 Topper Delhi POL
15 ‘Write & Draw Deli PLO?
16 Motivation | Bengaluru PlotData types help you define the type of the data that can be stored in a field/
column. Data types in LibreOffice Base are broadly classified into five main
‘categories, which are as follows:
‘To open an already
existing database:
feu) +[o
Numeric Types
‘The numeric data types are used to store data in the form of numbers which can be integers oF real numbers with
decimals, Arithmetic operations can be performed on numeric data
&
Fy
fi
‘We can use these data types for creating fields ike RolINo, Phone number, Marks, Year of Joining, Salary, Cost, Amount.
‘or any other numeric value,
‘The list of available numeric types is:
Data Type Name Signed Description
Iiny integer TINYINT No ‘Store integer range between Oto 255
Small Integer SMALLINT Yes | Store integer range between 25 to+ 251
Integer INTEGER Yes _| Store integer range between 2! to + 2-1
Big Integer BIGINT Yes Range between 2° t0 + 2-4
Number NUMERIC Yes Unlimited
Decimal DECIMAL Yes Unlimited
Real REAL Yes xe tp 1.7940
Float, FLOAT Yes xe to 1.79108
Double DOUBLE Yes Sxe Hho 17910808
Alphanumeric/Text Data Type
It stores 2 set of numbers, alphabets or other characters No arithmetic calculations can be performed on text data
\We can use this data type for creating name, address, city, customer name, praduct name, product description, etc.
The list of avallable Alphanumeric/Text Datatype is:
Daseription
TONGVARCHAR | Store up to the max length or number indicated by user. It is used to
store some descriptive data having more than 255 characters. Memo
data type allaws to store text data up to 64000 characters. For example:
Medical description of a patient, Student achievement details in student
table.
CHAR ‘Store exactly the length specified by user. Its used to store fixed number
of characters. For example, Mabile number, Pincode, License Number,
Passport Number etc. It uses fixed number of bytes specified,
VARCHAR ‘Store up to the specified length but uses only variable length of characters
entered. The number of bytes allocated depends on the number of
characters. For example if Name in student table is VARCHAR(20) and
you cave name as “Vedika” which has 7 characters then only 7 bytes out
of 20 will be used,
VARCHAR_IGNORECASE | Store up the specified length. Comparisons are not case sensitive but
stores capitals as you type them.
=
a Database Management System
Data
‘Memo
‘Text (Fix)
Text
TextCurrency Data Type
‘The currency data type indicates the monetary values and can be stored using currencies of various countries. For
example: $100, £ 500 or %25.50
Binary Types
It stores the data in a binary format. It is used to store dats for images, audio, video or files of any other format lke
voice messages, sound snippets, employee photo etc
‘The list of the available binary types is
Data Type Name Description
Image LONGVARBINARY | Store any array of bytes (images, sounds, etc). No
validation requited.
Binary (Fi) BINARY ‘Store any array of fix bytes, No validation required,
Binary VARRINARY | Store any array of variable bytes. No_validati
required.
Date Time
It stores data in the form of date or time or both. The date and time can be stored in various formats. It can be used to
store date of joining, date of birth, time of login, time of logout, retirement date, date of admission, etc
‘The list ofthe available Date time types is:
Data Type Name Description
ate DATE store month, day, and year information
Time TIME ‘Store hour, minute, and second information
Date/Time TIMESTAMP Store date and time information
Boolean Data type
‘The Boolean data type
doesn’t have anative Boolean data typein the same way as some other database systems. Instead, ittypcally represents
Boolean values using integer values, where O usually represents false and any non-zero value represents true,
=
sé to represent logical values, typically either True or False. However, LibreOffice Base
(Bet creatine aTaBLE
‘To create’a table, select the Table option in the Database pane. In the Libreoffice Base, there are two methods that
are used to create a table, These methods are as follows:
© Create Table in Design View
© Use Wizard to Create Table
Now let us study each in detail.
Creating a Table in Design View
Design View allows you to manually specify the structure of your table by defining its fields, data types, and properties.
You have complete control over the table’s layout and can directly define attributes such as field names, data types
(e.g, text, number, date/time}, field sizes, and validation rules like crcating tables using Design View gives us more
flexibility,
Let us create a table using this Design View. The steps are as follows:
Step 1: Open the School.odb database.Step 2: Select Tables (default) option in the Database pane.
‘Step 3: Click on the Create Table In a Design View option from the Tasks pane.
‘The Table Design window opens:
Seco attire Wein =o x
Bee Ye Bok Widow dp @
BX B9-S1 WB
FeeNone | ndsipe acpi
‘Step 4: Type the field in the Field Name column,
Step 5: Select the data type in the Fleld Type column.
‘Step 6: Type the description of the field in the Description column. It allows to describe the purpose of the field. Ibis
not the part of database table, but itis meant fo" the user to understand the purpose of the field. We may or
may not enter field description
(setae itt Tesi ar)
BeBe Yew Bek Wrdow te ®
@- x oplo-> (bo
Faunime | tyes | Leite
[P)pana— Nente INNER] Fewnete Una humee ake 7
-_ >Step 7: Repeat Step 5 to 7 to add more fields in the table.
Cinna tie tieiaaetanee SSSCSCS*~*~SCia
Ele bm Yew Bor eae @
a. 9 ID+C BID
loot) ‘Wom 2, Fema
‘The green arrow key before the cell shows the currently active field. Move this arrow key to the first column
created - Adm No. field
Step 8:
Right-click on the arrow to display the context menu.
Select Primary Key from the context menu as shown below:
‘Akey like symbol appears in front of Adm No. indicating that the column will now act lke a primary key where only
Unique values are allowed, and no value can be left blank.
Note that to set a composite key, ie. a primary key consisting of two fields, keep the Ctrl key pressed and then click on
multiple fields to select them. Thereafter right click on selected fields and choose Primary Key option from the pop-up‘The Field Properties pane is located at the bottom half of the window. It displays the field properties assigned by the
database designer. These properties can also be changed as per the requirement and are used to control and validate
the data that isto be entered.
‘Step 10: Click on the Save button (i =) at the toolbar of the Design view.
OR
lick on
ile menu and select Save As option to save the above created table
‘The Save As dialog box appears where the default name is Tablel,
‘Step 11: Remove the default name and type the new name- STUDENT in the Table Name text box.
‘Step 12: Click on the OK button to save the table:
‘The table STUDENT appears as a table in the Table Design window as shown below:
yx wo
‘Step 13: Double-click on the table STUDENT to open Table Data View where you enter the records.
=
a Database Management SystemUse Wizard to Create Table
A wizard isa step-by-step process of doing 2 specific task through a set of dialog boxes. Creating tables using wizards
offers a convenient and efficient approach to database design, particularly for users who are less experienced or who
need to quickly prototype database structures. On the otter hand, for some users creating the table using wizard
restricts to use the same fields in the pre-designed tables. It may not solve the purpose in real scenario, ast will create
2 table with the different columns that are not matching with the user’s colurnn choice.
Following are the given steps to create a table using wizard:
Step 1; Open the Schoolodb database.
Step 2: Select Tables (default) option in the Database pane.
Step 3: Click on the Use Wizard to Create Table option from the Tasks pane,
The Table Wizard will open.
Sec io your tate
‘ena pyaar befor ou dt Af acting Ble caeny
bisa sonpn ue choose fer you wattoincce your ble You en nee
Fer wow mr an one te
This wizard contains four steps, Let us read about those steps,
1. Select fields: You havea choice of two categories of suggested tables: Susinessand Personal Each category contains
its own Suggested tables from which you can choose any Each table ha alist of available fields,
Step 4: Select the Personal option from the Category section
Step S: Select the desired option form the Sample tables ciop-down menu. In this case, we have selected the Library
option,
The fields related tothe Library table shown in the Available field list box.
step 6: Select the BookID option from the Available fields lst box and click onthe! > button to move the selected
field to the Selected fields list box.
ble fields list box to Selected fields
Similarly, move the Publisher, Title, and Authorl0 fields from the Ave
listbox.‘The single arrow forward [= button helps you select one field ata time while double arrow forward =] button helps
Shift all the availabe fields together in one go into the Selected fields list box.
You can also click on single arrow backward] « button toremove the field from the Selected fields list box and moves
back to the Available fields list box or you can also click on the double arrow backward | == button to remove al fields
{rom the Selected fel list box and moves back to the Available fields listbox.
‘Step 7:_ Click on Next button to move to the next step.
2. Set types and formats: the selected fields can now be modified inthis step. You can change the Field name, Feld
‘ype, Entry required and Length
‘step 8: Do the changes in all the above selected four fields as shown below:
Skype rms
— t=]
| [mae
ES & |
leah beratope
ommend yi
sce eect fle ——_antonatn
caeStep 9: After modifying the four fields click on the Next button to move to the next step.
3. Set primary key: In this step, you have a choice of either creating a new Primary key or using an existing field as a
mary key.
‘Step 10: Select the Use an existing field as a primary key radio button.
‘Step 11: Select the desired field from the Fleldname list box. In this case, we have selected the BookID field
‘Step 12: Click on the Next button to move to the next step.
seprimzyy
seer eon niin marin tai Fe ete
asanpanatomt, —[S eaenleod opm tn cfc ceae
= we
lence pie ey
4. Create table: Thisis the final step of creating table.
‘Step 13: Enter the name of the table in the What do you want to name your table? text box.
‘Step 14: Select the desired radio button in the What do you want to do next? as Insert data immediately.
‘Step 15: Click on the Finish button to end the process of creating a table through a wizard,
=
Ss
ae
=, anne
een
Sarees
ees
=] = |
‘As, we have selected Insert data immediately so the Books Issued table will open in the Table Data View window that
allows you to input new records.
=
+" Database Management SystemField Properties
Field properties provide extra functionality tothe felds created ina table, You can set the field properties using the
given diferent methods
At the time of designing the structure of the table inthe design view you Gam Sie by side change the field
properties
on
Perform the following steps to modify the field property:
Step 1: Select the table,
Step 2: Right-click on table and select the Edit option from the context menu,
The table opens in the Table Design window. You can edit the structure along with the field properties.
The list of the field properties available for Numeric data types are:
‘© AutoValue: It auto increment numeric unique value that is automatically inserted in the field when a new record is
added into a table. In most of the cases it’ the primary key of the table. The user cannot enter data in the field that
is assigned as AutoValue. It has the drop-down that contains “Yes”
‘© Length: It defines the maximum length a field can have to hold a value. This option is not allowed to modify when
the Auto Value property is set to “Yes” For example, the field “Section” should be only single alphabet, the Length
of the field can be “1”
“© Default Value: It’s the default value that can be assigned in the field. While data entry user can make a change in it.
For example, the field “Marks”, can be assigned a default value 30. This option will not be available, when the Auto
Value property is "Yes”
‘+ Decimal Places: It specifies the number of decimal places in a numeric field. For example, if you fix decimal places
as? for salary then you are allowed to enter salary as 3456.78,
‘+ Format Example: It allows the user to change how the dala in a field will be displayed in the Table Data View.
The list of the field properties available for Character Data types are
+ Entry Required: The field with Entry Required as “Yes” means that the field cannot be left blank. The user needs to
enter data in this field, it contains a drop-down “Yes"/ “Nc”. The default value for this property is “NO” which means
the fleld if let blank will contain a NULL{nothing) value.
* Length: It defines the maximum length a field can have to hold a value. For example, the field “Section” should be
only single alphabet, the Length of the field can be "1"
* Default Value: It's the default value that can be assigned in the field, This value gets automatically added ina field at
the time of adding a record in a table, The user, if wants can make a change in it. For example, the field “Title”, can
be assigned a default value Ms.”
+ Format Exampl
allows the user to change how the data in a field will be displayed in the Table Data View.22; video based question
Creating a Database in LibreOffice Base. https://youtu.be/QivV7D9_nOO?si-_SGVysMEeDak1zi0
> How does the video demonstrate creating tables within LibreOffice Bose?
a
LEELNEDTTARLEN Desion view
In Lbreoffice Base, you can modify the structure of a table, such as adding new field, deleting exis
Une Hane, and Wala lype UF properties uf the Fel
Follow the given steps to edit the structure of a table in design view:
Stop: Select the table STUDENT in Table pane.
‘Step 2: Right-click on table and select the Edit option from the context menu.
‘The table opens in the Table Design window.
‘Step 3: Modify the structure of the table according to your requirement.
Stop 4: Click on the Save button after making the desited changes in the table,
After the structure of the table is created the data can be inserted by using the given steps:
Step 1:_ Select the desired table in which you want to insert data as STUDENT table.
Step 2: Double-click on table to open it in the Table Data View also known as Datasheet View.
OR
Right-click on the table and click on Open optior from the context menu:
fe ede rm ee |
Aho S/o. BoB
ing field, changing‘The STUDENT table opens in the Table Data View window. This view displays the table created with the field names as.
the top row. These fields are displayed in the same order as they were added while creating the table. If the number of
fields are more and cannot fit in the single row, you can use the horizontal scroll bar to view all the fields. The cursor
will be blinking in the second row.
If the records are already added earlier, then, those records will also be displayed and you can add more, modify or
delete the existing records.
Step
Start typing the value where the cursor is blinking.
Step 4: Press Tab key to move to next field. Once all the data values are entered for a single record, the cursor moves
to the next record. This process is called data entry.
Step S: Repeat Step 3 and 4 add more data in the fields ofthe table.
= =
8D Xf 9) 910 -/ENSL aL ne
Es
Click on the Save current récord button to add the record in the table.
lick on the Clase button to close the Table Data View window.
‘There isa pointing arrow p> in a table, known as record pointer, hat is used to specify the current position or selection,
within a table, Itindieates which record is currently active o” being operated in the table. To navigate through various
records of the table, we use the navigation bex present at the bottom of the Table Data View window. The Navigation
box js made up of two components:
‘+ Record Selector text box: This text box displays the currently active record number. You can input the desired record
‘number into this box to select and make it an active record in the Datasheet View.
‘+ Navigation Buttons: You can click on these buttons to navigate through the records. The These buttons allow you
to move in a table as given below:
+ The [H] button is used to move to the first record in the table.
+ The[#] button is used to move to the previous record based on the currently selected recording the table
+ The button is used to move to the next record based on the currently selected record in the table.
+ The ft] button is used to move to the last record in the table.Subject: Navigating Record
‘You can also navigate to the record by directly clicking the row head of a particular row in the table.
Editing Record in the Table
‘The records once entered can be edited anytime in a table. Follow the given steps to edit the records:
Step 1: Double-click on the table (STUDENT table) whose record you want to edit
‘The STUDENT table opens in the Table Data View window.
‘Step 2: Select the call that you want to modity.
‘Stop 2: Make the required changes in the cell. In our ease, we have modified the addfess from KABIR NAGAR to,
SANT NAGAR of the student whose admission number is 105.
Step 4:_ Click on the Save current record button to save the modification.
Step 5:_ Click on the Close button to close the Table Dats View window.
Deleting the Record from the Table,
Any record if not needed €an be permanently removed from the table by deleting it. Follow the given steps to delete
{the record from the table:
Step 1: Select the STUDENT table, The STUDENT table o2ens in the Table Data View
Step 2: Select the record you wish to delete.
‘Step 3:_ Click on Edit -> Delete Record option from the Menu bar.
oR
Right-click the selected record and select the Delete Rows option from the context menu,
[BSc tacts =a
See san en a
DX % LOIN EVIE
at [re [Ms — [| | oe‘The Confirmation dialog box opens.
Step 4: Click on the Yes button in the Confirmation dialog box to proceed with deleting the record
You may select multiple records by using the Shift key (For records that are arranged adjacent to each other
to form a consecutive list) or Ctl key (for records scattered at different places in a table) and then select the
Edit > Delete Record option from the Menu bar to delete multiple records at a time.
Sorting the Data in the Table
Sorting means rearrangement of the data either in the ascending order (smaller value to bigger value) or in the
descending order (bigger value to smaller value) The recorcs willbe rearranged with respect to the sorted field.
The steps to sort the table ae as follows:
Step 1: Select the STUDENT table.
‘The STUDENT table opens in the Table Data View vindow
Click on the column header based on which you want sort the data. Let us sort the data based on the Name
column. So, click on the column header of the Name column, you will see the whole column is selected by
shading it with blue.
Step 2:
Tr stent sone tmereroe eben =e
ix a & PID + 341 We
ra “iss — |r| Peat
Click on the Sort Ascending button ( 21) to sort data in ascending order. All the records will be rearranged in
the ascending order of the Name.
(wen Seve LartecbeaeDea er =o
XBle)o SOBA UT
airs — [Cr | Pen: | ascrn[
oR
Click on the Sort Descending button (1) to sort data in descending order. All the records will be rearranged
in the descending order of the Name.(Ds Sameer ten
“ e
ma (CR) Oh OID -1B S
‘The Sort Ascending and Sort Descending button sorts the data by one criterion only. LibreOffice Base allows you to
‘combine several criteria by selecting Sort icon on the toolbar. The Sort Order dialog can be used to do the required
‘changes, perform the following step for the same:
‘Step 2:_ Click on the Sort icon ([}) on the toolbar
‘The Sort Order dialog box opens, as shown below:
Step 2:_ Select the Field name and Order from the drop-down list.
‘Step3:_ Glick on the OK button.
Iyou wish to sort one field within another field, then use Sort Order -Then
For example, ifthe Name is stored as Name and Address, then we can sort Address within Name by specifying:
Sort Order- Field Name = Name, Orde
scending
‘Then - Fleld Name = Phone No., Order = Descending
1 Your heighbourer-Amit has 2 “ower shop. He maintained the details of his customers
personal information, order details and stock details manually. Now he wants to maintain
(Quiz Bee —_theminacomputer using a darabase. Help him create a Database with the appropriate 3
tables.
+ Give a name to the database,
+ Design the fields and ther cata types of al the three tables-customers personal
formation, order details and stock details.
+ Name the primary keys of al the three tables,
2. Save the above created table without creating aPrimary key Doubleclick the STUDENT
table tab and ty to enter a few records. Are you able to create records without making 2
primary key? Also if you wish to make Adm No now as a primary key are you able to edit
‘ the already created table structure? Give steps to do 50.Follow the given steps to delete a table:
Step 1: Select the table that you want to delete.
Step 2: Select the Edit > Delete option from the Menu ba
oR
Press the Delete key from the keyboard,
oR
Right-click the table and select the Delate option from the context menu.
i-m-R- SOM eo RES ES
‘The UibreOffice Base dialog box opens for confirming the deletion.
: Click on the Yes button to confirm the deletion.
‘The selected table will be deleted from the database.
st ReNAMINE A TaDLe
Follow the given steps to rename a table:
Step
‘step 2+ Right cliekan the table name in the Table aroa and select Rename option from the pop-up menu,
Select the table that you wish to rename.
A cursor will appear.
step 3:
‘Type the new name and press the Enter key.