Class-X DBMS (Tables, Forms, Reports) - Notes
Class-X DBMS (Tables, Forms, Reports) - Notes
Advantages of Database
Reduces Data Redundancy: no chance of encountering duplicatedata
Sharing of Data: the users of the database can share the dataamong themselves.
Data Integrity: Data integrity means that the data is accurate andconsistent in the
database.
Data Security: Only authorised users are allowed to access the database and their
identity is authenticated using a username andpassword.
Privacy: The privacy rule in a database states that only the authorized users can access
a database according to its privacyconstraints.
Backup and Recovery: Database Management Systemautomatically takes care of
backup and recovery.
Data Consistency Data Consistency means there should be multiple mismatching
copies of the same data.
1
RDBMS: A relational database management system (RDBMS) is a database management
system that is based on the relational model. In the relational model of a database,
all data is represented in terms of tuples (rows), grouped into relations (tables). A
database organized in terms the relational model is a relational database.
Database Concepts: Database contains objects that are used for storing and managing
information.
1. Item: Item is about which information is stored in thedatabase.
2. Field: Each question that we ask about our item is a Field.
3. Record: Record is a set of information (made up of fields)stored in your
database about one of the items.
4. Value: Value is the actual text or numerical amount or datethat you put in
while adding information to your database.
For example, Database: Employee
Emp_Code Emp_Name Emp_Address Emp_Designation Emp_ContactNo Emp_Salary
5. Key Field: Key Field is a value in a Field that uniquely identifies the
record. Eg. E001 which is unique to every employee.
2
COLUMNS OR FIELD: A column is a set of data values of a particular simple type,
one for each row of the table. For eg. Emp_Code, Emp_Name, etc.
DATA TYPES: Data types are used to identify the type of datawe are going to
store in the database.
NUMERIC TYPES: They are used for describing numeric valueslike mobile
number, age, etc.
The different types of numeric data types available are-
1. Boolean (Yes / No) 6. Numeric
2. TinyInt (Tiny Integer) 7. Decimal
3. SmallInt (Small Integer) 8. Real
4. Integer 9. Float
5. BigInt (Big Integer) 10. Double
ALPHANUMERIC TYPES:
The list of different data types available in alphanumeric typesare:
1. LongVarChar (Memo) (Long Text)
2. Char (Text-fix) (Small Text)
3. VarChar (Text) (Text of specified Length)
4. VarChar_IgnoreCase (Text) (Comparisions are not casesensitive)
BINARY TYPES:
Binary types are used for storing data in binary formats. It can be used for storing
photos, music files or (in general file of any format) etc.
The list of different datatypes available in Binary types are:
1. LongVarBinary (Image)
2. Binary (Binary fix)
3. VarBinary (Binary)
3
DATE TIME:
Date time data types are used for describing date and time values for the field used in
the table of a database. It can be used for storing information such as date of birth,
date of admission etc.
The list of different data types available in Date Time type are:
1. Date (Stores month, day and year information)
2. Time (Store hour , minute and second information)
3. Timestamp (Stores date and time information)
PRIMARY KEY: A primary key is a unique value that identifies a row in a table. These
keys are also indexed in the database, making it faster for the database to search a
record.
FOREIGN KEY: The foreign key identifies a column or set of columns in one
(referencing) table that refers to a column or set of columns in another (referenced)
table.
4
Select the option database to open the base application.
Click Start>Programs>OpenOffice.org 4>OpenOffice.org Base.
You can create a new database by selecting the option Create a new database.
You can also open an existing database file that you have already created by selecting the
option Open an existing database file.
Click Next.
5
Click Finish. The Save As dialog box appears as shown below.
Specify a name for the database in the File name: field and click Save. A window similar
to the one displayed below.
Click Finish. The Save As dialog box appears.
Specify a name for the database in the File name: field and click Save.
6
Steps To Create A Table Using Table Wizard
Tables are the basic building blocks of a database. You store the data in the database in
the form of tables.
7
Click the Select Fields > Choose Category > Select the table > Click on Next Button.
Select the fields as per the requirements and click on > button to add the selected
column or select to remove the fields from the Selected Fields Box.
After selectingthe fields click on Next Button.
8
The window to set the data types will open, By default all the fields will have
Text[VARCHAR] data type which can be changed and other properties can be
selected as per the requirement.
Click on Next.
After setting the properties, the window to set the primary will open. Select the
column to be set as Primary Key.
Click on Next.
9
The window to rename the table will open. A user can either use the same table name or
can change it.
The option to insert the data immediately will be selected by default. Click on Finish to
insert the data in the table.
Specify the field name and data type of the field to be created, by selecting the
appropriate type available under Field type drop down list.
Specify the field name and the data type for each field name.
After specifying the field name and the datatype, save the table by clicking on
File > Save option.
10
Specify the table name. The default name is Table1. Click OK.
A dialog box appears, where you are asked to set a primary key for the table created.
You can select the appropriate option to set the primary key or leave the table without
a primary key.
11
Data Types:
Datatypes are used to identify which type of data (value) we are going to store in the
database.
Fields themselves can be of different types depending on the data they contain. Data types
in OpenOffice base are broadly classified into five categories listed below.
• Numeric Types
• Alphanumeric Types
• Binary Types
• Date time
• Other Variable types
Numeric Types:
Numeric data types are used for describing numeric values for the field used in the table
of a database.
The different types of numeric data types available are listed here.
12
Alphanumeric Types:
Binary Types:
Binary data types are used for storing data in binary formats. Binary data types in a
database can be using for storing photos, music files, etc. In general, files of any format
can be stored using the binary data type.
The different types of binary data types availableare listed here.
13
Inserting Data in the Table
To insert the data in the table, follow the steps:
Select the table > Double click on it.
The table will open in Datasheet View in which data new data can be inserted and
existing data can be updated or removed.
14
Deleting Records From The Table
Field Properties
To set the field properties:
Select the table > Right click > Select Edit > Table Design View window will open.
Some commonly used properties are:
AutoValue – If set to yes then field will get the auto numeric values.
Length – By default length of the field is 10 but the size of the field can be
set to maximum length.
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.
Format example – This property helps to set the format of the data entered in the
field.
Entry Required – if set to yes then it will be must to insert the value in the
field which means that field cannot be left blank.
FORMS
A form provides the user a systematic way of storing information into the
database. It is an interface in a user specified layout that lets users to view,
enter, and change data directly in database objects such as tables.
15
Creating Form Using Wizard
To create a form, Click on Forms option located under Database section.
You can select fields to be sent onto the form by selecting the field name and
clicking > button. You can select individual fields in a database or all fields in a
database.To use all the fields in the table in a form, click the >> button.
Click Next.
16
You see the Set up a sub form step dialog box of the wizard.
You can select the option Add Subform, if you need to insert the contents in the table
in a separate form. Click Next.
Now you need to arrange selected fields in a form. You can use different styles
from the list displayed.
17
A dialog box appears wherein you can select the data entry model. Click Next.
You should see a dialog box wherein you can specify the styles to be used in the
form. Click Next.
18
You see a dialog box where you can specify the name of the form. Click Finish.
A form window appears. The records in the table will be displayed automatically
within the form created.
19
Enter Data from Form
You can add new records to the table using the form by clicking the symbol.
Reports
A report helps to display the data in a summarized manner. It is used to generate the
overall work outcome in a clear format. You can create reports in the database.
Now we can generate the report for the table created earlier.
Click on Use Wizard to Create Report… option available under Tasks.
20
You have to select all the table fields by selecting the >> button
You can redefine the label of the fields in the reports or else you can set the default
name. Click Next.
21
You can define grouping for the fields of the table. Click Next.
To sort the field variables in the report, select the appropriate field and sorting method.
Click Next.
22
You can select the layout of the report by selecting the appropriate option available
under the Layout of data list and you can also select the orientation of the report.
Click Next.
23