Elements of Database
1. Data:- Data in a DBMS package is generally kept in a tabular
format and is organized by fields.
2. Field:- A field represents one related part of a table. ex- age
,name, address etc.
3. Table:- A table is a collection of logically related records. The
multiple records of a database are arranged together in a tabular
structure to make a [Link] is made of rows and columns.
4. Record:- A record is a collection of multiple data which is stored in
related fields that can be treated as a single unit.
What is RDBMS?
A database management system that is based on the relational model is
called an RDBMS (Relation Database Management System). Tables are
used to organise data in relational databases. A relational database
management system (RDBMS) is used to store, manage, query, and
retrieve data.
Database Objects
Tables
Data is arranged into rows and columns in a table, which is a type of data
structure. It can be applied to both the storage and presentation of
structured data.
Columns or Fields or Attributes
Data is arranged vertically from top to bottom in columns. Each row of
the table has one column, which is a collection of data values of a
specific basic type. The structure by which the rows are put together is
provided by the columns.
Rows or Records or Tuples
A row, also known as a Record or Tuple, in a table represents a single
data item. A database table can be represented graphically as being
made up of rows and columns, or fields. Every row in a table has the
same structure and represents a group of connected data.
Primary Key, Composite Primary Key and Foreign
Key in a Database
In the RDBMS data can be integrated using keys. These are Primary Key,
Composite Primary Key, and Foreign Key, Key are used to make the
relationship between the tables.
1. Primary Key – This unique field is called the Primary Key (PK). A
primary key is a column in a table or a group of columns that aids
in uniquely identifying each record in that table. In a table, there
can only be one primary Key.
2. Composite Primary Key – Composite primary key is the term used
when the primary key constraint is applied to one or more
columns.
3. Foreign Key – To create connections between two tables, foreign
keys are used. Each value in a column or collection of columns
containing a foreign key must match the Primary Key of the
referential table. Data and referential integrity are preserved with
the use of foreign keys.
How to create a database using Open Office
Step 1 : Click on Start > Programs > OpenOffice > OpenOffice Base
Step 2 : Click on Create a new database
Step 3 : In the Database Wizard, Click on Finish
Step 4 : Specify a the Name of database and click on Save
How to create a database using Open Office
Step 1 : Click on Start > Programs > OpenOffice > OpenOffice Base
Step 2 : Click on Create a new database
Step 3 : In the Database Wizard, Click on Finish
Step 4 : Specify a the Name of database and click on Save
Create Table in Design View
Step 1 : Click on Create Table in Design View
Step 2 : Select Field name and suitable datatype
Step 3 : Set the Primary Key
Step 4 : Change the table name
Step 5 : Save the table
Use Wizard to Create Table
Step 1 : Click on Table > Use Wizard to Create table
Step 2 : Click the Select Fields > Choose Category > Select the table >
Click on Next Button
Step 3 : Select data types from the given field
Step 4 : Set the Primary Key
Step 5 : Rename the table and Click on Finish
Data Types
The type of data (value) that will be stored in the database is defined by
its datatype. Important to know the different types of data helps to
ensure that each property’s value is as expected and that data is
collected in the correct format.
Data types in OpenOffice base are broadly classified into five categories
listed below.
Numeric Types
Alphanumeric Types
Binary Types
Date time
Other Variable types
Insert Data in the Table
Step 1 : Select the table > Double click on it
Step 2 : The table will open in Datasheet View
Step 3 : Now you can Insert Number of records in Datasheet View
Editing Records in the Table
Step 1 : Select the table > Double click on it.
Step 2 : The table will open in Datasheet View
Step 3 : Edit the record as per the requirement
Deleting Record From the Table
Step 1 : Select the table > Double click on it.
Step 2 : The table will open in Datasheet View
Step 3 : Right click on data and select delete option
Field Properties
To modify the field’s attributes It is necessary to modify the table
structure in design view. The following actions will be taken to set the
field’s properties:
Select the table > Right click > Select the option Edit > the table Design
View window will open
1. AutoValue – if set to yes then field will get the auto numeric values.
2. Length – By default length of the field is 10 but the size of the field can
be set to maximum length.
3. Default Value – A default value can be set for a field if user don’t
provide any value while entering the values in the table.
4. Format example – This property helps to set the format of the data
entered in the field such as 91-222-333.
Sorting Data
Sorting means to arrange the data in either ascending order of
descending order. Sorting is the process of putting data into a
meaningful order so you can evaluate it more efficiently.
Referential Integrity
The relationship between tables is referred to as referential integrity.
Referential integrity is used to maintain accuracy and consistency of data
in a relationship. In Base, data can be linked between two or more tables
with the help of primary key and foreign key constraints.
Referential integrity helps to avoid:
1. Adding records to a related table if there is no associated record
available in the primary key table.
2. Changing values in a primary if any dependent records are present in
associated table(s).
3. Deleting records from a primary key table if there are any matching
related records available in associated table(s).
Creating and Editing Relationships between Tables
An association or link between two or more tables is referred to as a
relationship. You don’t have to enter the same data again in different
tables when you relate two tables.
Relationships between tables helps to
1. Save time as there is no need to enter the same data in separate
tables.
2. Reduce data-entry errors.
3. Summarize data from related tables.
Type of Relationships in Database
There are three types of relationships which can be created in tables:
1. ONE to ONE
2. ONE to MANY OR MANY to ONE
3. MANY to MANY
ONE to ONE
In this relationship, both the tables must have primary key columns.
ONE to MANY OR MANY to ONE
In this relationship, one of the table must have primary key column. It
signifies that one column of primary key table is associated with all the
columns of associated table.
MANY to MANY
In this relationship, no table has the primary key column. It signifies that
all the columns of primary key table are associated with all the columns
of associated table.
Remove the Relationships
With the use of the Delete option, the relationships that have been
applied to the tables can also be deleted.
When you right-click a relationship thread, the Delete option will appear.