Notes - Unit 3 - DBMS
Notes - Unit 3 - DBMS
Features of Database:
It stores and create data in the form of tables.
It is very easy to use and understand.
It can easily handle a large number of records stored in the tables.
Data stored in a database will remain stored permanently until and unless it is deleted from the
system manually.
It allows multiple users to use the database simultaneously. or
Applications of Database:
Some of the areas where database applications are widely used to store, manage and retrieve data.
Schools: It can be used to store the student records with their personal information and parent's details.
It can also be used to keep a record of the fee and result details.
Airlines: It is used to maintain a record of details, flight schedule, reservation or cancellation status.
Hospitals: It helps to maintain a record of patient's medical history and the treatment provided for the
same.
Banks: It helps to store and retrieve customer's account information such as withdrawals, deposits,
payments and loans.
Advantages of Database Management System (DBMS):
Reduce Data Redundancy: Data redundancy refers to the occurrence of same data in two or more
places within a database. DBMS allows to prevent the input of duplicate items in the database. For e.g. -
If there are details of the same employees in two different rows, then one of the duplicate data will be
deleted.
Data Security: As the number of users increases, the data transfer also increases thus increasing the risk
of data security. A Database Management System (DBMS) provides a platform for data privacy and
security policies to improve Data Security. Only authorized users are allowed to access the database
using a username and password.
Data integrity: Data integrity refers to the overall accuracy, completeness, and reliability of data.
Database Management System arranges information in well-managed and synchronized form to make
data handling very easy thus provide data integrity.
Data Consistency: Data consistency ensures that there is no data mismatch and conflict. All data
appears the same for all the users viewing the database. Moreover, any changes made to the database are
immediately reflected to all the users and there is no data inconsistency.
Data Sharing: The data stored in the database can be shared among multiple users or application
programs.
Backup and Recovery: The DBMS provides backup and recovery sub-system that is responsible to
recover data from hardware and software failures.
Database Users:
It is the person, who needs information from the database to carry out its primary business responsibilities. The
various types of users which can access the database system are as follows:
Application Programmer/Developers: A people, who writes application programs in programming
languages to interact and manipulate the database are called application programmer/developer.
Database Administrator (DBA): A person, who is responsible for managing or establishing policies for
the maintenance and handling the overall database management system is called DBA.
End-user: A person, who interacts with the database system to perform different operations on the
database like inserting, deleting etc., through menus or forms is called end-user.
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 option Open an existing
database file. Click Next.
Database wizard with step 2 dialog box will appear.
A table can be created using the pre-defined steps and table structure(s) in Base.
The following are the steps to create a table:
Click on Tables → Use Wizard to Create Table, the window will open.
Click the Select Fields → Choose Category → Select the table.
Select the fields as per the requirements and select on buttons to add the pre-defined columns or select
to remove the fields from the Selected Fields Box. After selecting the fields click on Next Button.
Once the fields will be selected the window to set the data types will open. By default, all the fields will have
Text[VARCHAR] data type, but all of them can be selected as per the requirement.
Click the next button.
After setting the properties of the fields such as field name, type etc.
The window to set the primary will primary will open. Base automatically adds the column to be set as Primary
Key which will help the user to enter the unique values and helps in creating the relationship with the other table
to extract the data from multiple tables.
After setting the Primary Key click on Next button.
When the Primary Key will be set, then window to create the table will open. A user can either go ahead with the
same table name or can change it.
In the same window options to work with the table will be given as:
The option to insert the data immediately will be selected by default. Click on Finish to insert the data in the table.
Creating Table using Design view:
Click on Create Table in Design View……..option available under Tasks and a Table Design window will appear.
Specify the field name and data type of the field to be created by selecting the appropriate type available under
Field type dropdown list. Specify the field name and the data type for each field name.
Specify the table name. Click OK.
Date Time:
Date time data types are used for describing date and time values for the field used in the table of a database. Date
time data types in a database can be used for storing information such as date of birth, date of admission, date of
product sale etc.
The different types of date time data types available are listed here.
Session-3: Perform Operations on Tables
A Tables are used to present the data in an organize manner where data is stored in the form of rows &
columns. In Base, data is stored in the form of tables and you can perform various types of operations on these
tables such as inserting data, editing data, deleting data, sorting data, etc. You can also create relationships
between two tables.
Inserting data in the table:
Follow the given below steps to insert data in a table:
Open your database in which your table exists.
Open the table.
Now type your data. Using the tab key move to the next column.
You can add as many rows as you want.
Editing records in the table:
After inserting data in a table, you may need to edit the data in case some information has been changed. Follow
the given below steps to edit the data in a table.
1. Open your database.
2. Now open your table.
3. Click on the Edit menu and choose the Edit Data option.
4. The table will be displayed in the edit mode
5. Now edit your data. And click on the Save button to save the changes
Deleting records from the table:
There are many ways to delete the records in a table.
1. Open your table.
2. Select the record that has to be deleted. And press the Delete key
OR
Click on the Edit menu and choose the Delete option.
OR
Right Click on the record and choose the Delete Rows option.
Sorting data in the table:
Sorting refers to the arrangement of data. You can arrange the data in ascending or descending order. In base,
you can sort the data using single field and multiple fields.
Sorting data using single field
Follow the given below steps to sort the single field in a table
1. Open your table.
2. Select the column whose data needs to be sorted.
3. On the Table Data toolbar, select either Sort in Ascending Order or Sort in Descending Order as per
your requirement.
Data will be sorted as per your choice.
Sorting data using multiple field
Follow the given below steps to sort multiple fields in a table
1. Open your table.
2. Click on the Sort button on the Table Data toolbar. The Sort Order dialog box opens.
3. Select the field names and their order either ascending or descending.
4. Click on OK.
The data will be sorted according to your choice.
Referential integrity
Referential integrity is used to maintain accuracy and consistency of data in a relationship (two related tables).
In Base, data can be linked between two or more tables with the help of primary key and foreign key
constraints. Referential integrity refers to the rule that a foreign key must have a matching primary key. It
prevents to insert the duplicate records.
Referential integrity helps in the following:
Adding records to a related table if there is no associated record available in the primary key table.
Changing values in a primary key field if any dependent records are present in an associated table.
Deleting records from a primary key table if there are any matching related records available in
associated table(s).
Relationship:
A relationship in Base refers to an association between two or more tables. Relationships between tables helps
in saving time as there is no need to enter the same data in another tables. If there is a large amount of data that
you need to display in a table, in that case, you can store data in more than one table. To display the data from
more than one table as a single table, you must create relationships between the tables. Relationship can be
established by matching the fields with the same name in different tables. For example, you can create a
relationship between two tables, if one field serves as a primary key in one table and the same field serves as a
foreign key in the second table.
Types of Relationship
There are mainly three types of relationships that you can establish between two tables.
1. One to One
2. Onto to Many or Many to One 3. Many to Many
One to One: In this relationship, both the tables must have primary key columns. In this type of relationship a
record in a table can have only one matching record in another table. One- to-One relationship can be
established when two tables are related by a single row.
Example: In the given tables Customers and NewTable, ID in Customers table and ID1 in NewTable, table are
the primary keys.
One to Many: n this relationship, one of the table must have primary key column. In this relationship, one
record in one table is associated with many records in the second table. This type of relationship can be
established where one record in a table matches with many records in another table. For example, a same
employee can do multiple tasks in an organisation or a students is doing many activities in a school.
Example: In the given tables Customers and NewTable, ID in Customers table is the primary key.
Many to Many: In this relationship, no table has the primary key column It signifies that all the columns of
primary key table an associated with all the columns of associated table. In this type of relationship, many
records of a table matches with many records of another table. This type of relationship can be established when
many records in a table are associated with many records in another table.
Example: In the given tables Vacations and Fuel, there no primary key.
Creating a Relationship:
Follow the given below steps to create a relationship between two tables.
1. Open your database.
2. Select two tables.
3. Click on the Tools menu and choose the Relationship option. The Add Tables dialogue box appears.
4. Now, select a table from the dialog box and click on the Add button. The selected table is added in a
relationship.
5. Similarly, select the another table and click on the Add button.
6. Click on the close button to close the Add Tables dialog box.
7. Drag the primary key of a table and drop to the same field in the another table. The relationship is
created.
8. Click on the Save button in the File menu to save the relationship.
Field properties
In design view there are different properties of fields according to the data type set for each field.
Numeric Data Type Properties
Auto Value: if it sets 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 in
this property.
Default Value: A default value can be set for a field if user does not provide any value while entering the
values in the table.
Format example: This property is used to set the format of the data entered in the field such as 91-222-
333.
Character Data Type Properties
Entry Required: if it sets to yes then it you must enter the value in the field which means that field
cannot be left blank
Length: By default, length of the field is 10 but the size of the field can be set to maximum length in this
property.
Default Value: A default value can be set for a field if user does not provide any value while entering the
values in the table.
Format example: This property is used to set the format of the data entered in the field such as 91-222-
333.