0% found this document useful (0 votes)
409 views

Class 10 Database Management Notes

Hi

Uploaded by

sahuarsh320
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
409 views

Class 10 Database Management Notes

Hi

Uploaded by

sahuarsh320
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Database Management System

Data and Information


Data are simply facts or figures and
when data are processed, organized,
structured or presented so as to make
them meaningful or useful, they are
called information.

Database
A database is an organized collection
of data, so that it can be easily
accessed, managed and updated. It is
mainly stored in electronic form and
controlled by database management
System (DBMS).
Example of Database – Oracle,
OpenOffice Base and Microsoft
Access.

Types of Databases
Flat Database – Information is stored
as a single file in a tabular format.
(Electronic Spreadsheet).

Distributed Database- It is a type of


database that has contributions from
the common database and information
captured by local computers.

Relational Database – Data is stored


in tables (Row and Column form).
(MySQL, Oracle, and Microsoft SQL
Server database).

Advantages of Databases
• Easy Searching and Updating.
• Large of Data can be easily
managed.
• Reduction of Data Redundancy.
• Controlled Inconsistency.
• Data Sharing.
• Data Security and Backup.
• Printing Reports.

Features of Database
• Stores data in one central location.
• Allows data to be shared by many
users.
• Provides user interfaces to work
with the data.
• Creates backups.
• Controls who can access and edit
the data.

1. What is database?
2. Give two examples of Database.
3. What is relational database.
4. Write any four advantages of
database.
Database Management System (DBMS)
DBMS is software system used to store, retrieve
and run queries on data.

Relational Database Management System


(RDBMS)
It is a DBMS where data is stored in tabular
format.
Example MS-Access, MySql, Open office base
etc.

Relational Database Terms/Components of


Databases
Column/Attributes/Fields – This is category of
information. Example – Rollno, Name, Address
in Class register.
Row/Tuple/Record – This is collection of
different types of information about the same
object/Person.
Table/Relation – Collection of similar records.
Database – Collection of tables and relationship
between them.
Keys in Databases
Field or fields that are used to uniquely identify
each records in table.
Primary key
Fields that uniquely identifies each record in
table. It cannot be null and duplicate.
Composite Key
Two or more attributes that can uniquely a tuple
in a table.
Candidate Key
All fields that uniquely identifies the rows in a
table (Out of these one is selected as primary
key).
Foreign Key
Attribute in a table whose value match a primary
key in another table.

Questions
1. What is RDBMS?
2. What is primary key.
3. What is attribute?
4. Give two examples of RDBMS?
Creating Database
• Step 1: - Click on LibreOffice Base
• Step 2: - Select Database
• Step 3: - Create a new database option →
Next
• Step 4: - Click on Finish
• Step 5: - Name the Database and Click on
Save

• Creating Tables
• Tables also known as Relation are the
basic building blocks of a database.
• We can create a table in a database.
• Create table in Design View.
• Use Wizard to Create Table.
• Create table in Design View
• Step 1: Click on Tables → Create Table in
Design View.
• Step 2: Select Field names.
• Step 3: Specify the data Types.
• Step 4: Set he Field Properties like Entry
Required, Length, Decimal places, Default
values etc.
• Step 5: Right click on the left side of field
to assign it as Primary Key.
• Step 6: Specify the Table Name and Click
on Save.


• Use Wizard to Create Table
• Step 1: Click on Tables → Use Wizard to
Create Table.
• Step 2: Select Fields (Choose from
Business or Personal).
• Step 3: Select from Available Fields,
Click on > or < to Select a Field.
• Step 4: Set types and Formats.
• Step 5: Set Primary key.
• Step 6: Save and Proceed.



• Note: We can Rename, Delete table,
Change field properties from Tables
Section from Main Window. Right Click
on table → Edit.

• Data Types
• Data Types are used to identify which type
of Data (value) we can store in tables of
database.
• Five Main Categories of Data Types
• Categorie • Sub • Examples
s categories
• Alphanu • Char • “Hello123”
meric • Varchar • “Delhi, India 100”
• Memo • “Delhi, India 100”
• Numeric • Integer • 45456567
• Smallint • 53
• Bigint • 56456473456
• Float • 12.45
• Boolean • Yes/No
• Binary • Image • Image
• Binary • Binary
• Date/ • Date • 12/24/2007
Time • Time • 11:45:20
• Other • Other • Other
Data
Types


• Questions
• What is Primary key.
• What is difference between Alphanumeric
and Numeric data Types.
• Write Steps to create a table using Wizard.
Performing Operations on Table
We can insert, Modify/Update and delete
data from a Table.

Entering Data in the Table


Step 1: Double-Click the table name in
the Database Window.
Step 2: Enter the Field values while using
Tab key to navigate from one field to
another.

Editing Records in the Table


Step 1: Double-Click the table name in
the Database Window.
Step 2: Click in the field of the particular
record, whose value is to be modified.
Step 3: Click on Save Button.

Deleting a Record
Step 1: Open the table in data sheet view.
Step 2: Click on the row header area to
select the record to be deleted.
Step 3: Right Click and Select the
Record(s).
Step 4: Click on Yes Button to
permanently delete the records.

Relationship
Relationships are links that associate a
filed in one table with a field in another
table.
Advantages of Relationships
• Save time as there is no need to enter
the same data in separate tables.
• Reduce data – entry errors.
• Summarize data from related tables.

Creating Relationship
Step 1: Create two tables for building
relationship.
Step 2: Click on Relationship options in
the Tools menu. Add table dialog box will
appear.
Step 3: Select the tables and click on Add
button.
Step 4: Open the Relation Design window.
Step 5: Click on New Relation option in
the Insert menu.
Step 6: Select the tables under table
involved if they are not already selected.
Step 7: Select the field.
Select the primary key from one table and
drag it on same field in the second table.

Types of Relationship
One to One – Both tables can have one
record on either side of the relationship.
One to many/Many to one – Any single
rows of the first table can be related to one
or more rows of the second table, but the
rows of second tables can only related to
the only row in the first table.
Many to Many – This relationship that
create a relationship between two tables.
Each record of the first table can relate to
any records in the second table. Similarly,
each record of the second table can aslo
relate to more than one record of the first
table.

Remove the Relationships


The relationship applied on the tables can
be removed. Right click on the
relationship thread (line) and select delete
option.

Questions
• What is Relationship.
• What is one to many type of
relationship.
• Write steps to insert data in a table.
Retrieve Data Using Query
A query is a request for data or information from a database Table
or combination of Tables.
We can query with one of the following ways
• Create a query in Design View.
• Use wizard to create a query.
• Create a query in SQL view.

Creating a Query using Design View

Step 1: Open the database.


Step 2: In the left pane of the database window, click on Queries
icon.
The Query Design window will appear.
Step 3: Select the table from which the information is to be
extracted and click on Add button to show the table in selected
query window.
The query window is divided into two parts – Upper and Lower
with option like field, table, sort, visible and or.
Step 4: Choose the fields from the drop down list.
When you type two criteria on the same line it is and condition
and when we type criteria on or row it is called or condition.
Step 5: Specify the condition in the Criterion option.
Step 6: Now, to see the result of the query, click on Run Query
option in the edit menu (F5).
Step 7: Save the Query.

Creating Query using Wizard

Step 1: Open the database file where you want to create the new
query.
Step 2: In the left pane of the database window, click on Queries
icon.
Step 3: Click on Use wizard to create Query option. There are
eight steps in this Query Wizard.
Step 4: Field selection, Select the table and fields for query and
click on the next button.
Step 5: Sorting order. It specifies the sorting order for the data
records in your query.
Step 6: Search Conditions.
Step 7: Detail or Summary – Aggregate Functions.
Step 8: Grouping, Grouping Conditions and aliases name.
Step 9: Overview – Name of Query, Display, modify and
overview.
Click on finish button.
Step 10: Save the query.

Questions
• What is Query.
• What are Aggregate Functions.
• Short cut keys to run a query.
• Steps to perform query using wizard.
Creating Queries using SQL Commands
A query is a request for data or information from database table or
tables.
Basic Syntax/Structure of SQL commands
Select (Column1, column 2, column 3, ...) from table_name
[Where condition] [order by] [group by column]

Steps to create queries using SQL commands


Step 1: Open the database and click on Queries icon.
Step 2: Click on Create Query in SQL view option.
Step 3: Type the query for example, if you want to display all the
data in the marksheet table, then the select statement will be
Select * from marksheet;
Step 4: To execute the query press F5 or click on Run query icon
in the toolbar.

Sample Table – We will use this table to queries.


Students
Rollno Name Marks City
1 Karan 78 Delhi
2 Diya 70 Mumbai
3 Priyanka 68 Jaipur
4 Mahesh 100 Delhi
5 Siya 50 Mumbai
6 Rakesh 85 Delhi
7 Raj 69 Pune
8 Simran 88 Jaipur

Performing Calculations like ( + , -, *, /)


Select name, marks + 2 from Students;
Result
Name Marks
Karan 80
Diya 72
Priyanka 70
Mahesh 102
Siya 52
Rakesh 87
Raj 71
Simran 90

Where clause
It is used to filter data according to specified conditions.
Select * from students where marks>90;

Students
Rollno Name Marks City
4 Mahesh 100 Delhi

Order by Clause
Order by clause is used to sort the data in ascending (asc) or
descending (desc) order, based on one or more columns.
Select * from students order by Name desc;

Students
Rollno Name Marks City
2 Diya 70 Mumbai
1 Karan 78 Delhi
4 Mahesh 100 Delhi
3 Priyanka 68 Jaipur
7 Raj 69 Pune
6 Rakesh 85 Delhi
8 Simran 88 Jaipur
5 Siya 50 Mumbai

Group by
The Group by clause in a SQL commands that is used to group
rows that have the same values.
Select city from students group by city;
Delhi
Mumbai
Jaipur
Pune

Aggregate Functions
We can also use aggregate function like count, sum, min, max and
avg on the grouped column.
Select city, count(*) from students group by city;
City Count (*)
Delhi 3
Mumbai 2
Jaipur 2
Pune 1

Count(), sum(), min(), max() and avg() functions


select count(*), sum(marks), min(marks), max(marks), avg(marks)
from students;
Count(*) sum(marks) min(marks) max(marks) avg(marks)
8 608 50 100 76
Other SQL commands
Update Statement – Use to update a record.
Update student set marks =100
where name = ‘ karan’;
Insert Statement - Use to insert a new record.
insert into students values(10, ‘Priyanshu’, ‘Mumbai’);
Delete Statement –Use to delete a record.
delete from students where name= ‘karan’;

Questions
• What is query?
• Write steps to create a query.
• What is select commands.
• Write a sql commands to represent data in ascending order of
names.
• What is syntax of insert command.
Creating Forms
Base provides an easy and organized way to enter
data in individual or multiple tables using forms.
Forms are used for entering, modifying and
viewing records you likely to have.

Steps to create form using wizard


Step 1: Double click use wizard to create form to
open the wizard.
Step 2: Field selection – Select the table or query
than field that will be displayed on the form.
Step 3: Set up a subform. (A Subform is a form
that is inserted in another form.)
Step 4: Add subforms fields.
Step 5: Get joined fields.
Step 6: Arrange Controls.
Step 7: Set data entry.
Step 8: Apply styles
Step 9: Set name

Questions
• What is use of forms.
• What are sub forms.
• Write steps to create a forms.
Designing Reports
• Reports are used to represent data in printable
format.
• Reports can be generated from single or
multiple data sources showing information in
a systematic and summarized manner.

Creating Report using Report Wizard


Step 1: Click on Reports icon from the left-pane
of the database window.
Step 2: Click on Use Wizard to create report
option.
Step 3: Select the fields from table or reports.
Step 4: Labelling Fields – Rename the labels in
the Report.
Step 5: Grouping – We can crop data according
to common data in fields.
Step 6: Sort option – We can sort data.
Step 7: Choose Layout of the Report.
Step 8: Create Report by clicking on Finish.

Questions
• What are Reports.
• Why are Reports are useful.
• Write steps to create a report.

You might also like