0% found this document useful (0 votes)
7 views13 pages

Database Management System

The document provides comprehensive notes on Database Management Systems (DBMS) for Class 10 students, covering definitions, types of databases, advantages, data models, and key concepts such as primary and foreign keys. It outlines practical steps for creating tables, queries, forms, and reports using software like LibreOffice Base, along with SQL commands. Additionally, it explains relationships between tables and the importance of data integrity, security, and consistency in database management.

Uploaded by

jkirthanmmj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views13 pages

Database Management System

The document provides comprehensive notes on Database Management Systems (DBMS) for Class 10 students, covering definitions, types of databases, advantages, data models, and key concepts such as primary and foreign keys. It outlines practical steps for creating tables, queries, forms, and reports using software like LibreOffice Base, along with SQL commands. Additionally, it explains relationships between tables and the importance of data integrity, security, and consistency in database management.

Uploaded by

jkirthanmmj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

SHRI RAM SENIOR SECONDARY SCHOOL,

OMANDHUR, TINDIVANAM.
CLASS 10
DATABASE MANAGEMENT SYSTEM NOTES
SESSION 1
Definition of Data & Database:
Data is nothing but collection of facts. Singular form of data is datum. When the data is
processed, data is transformed into information.
A database is an organized collection of data. A database contains information about one
particular enterprise. It maintains any information that may be necessary to the decision-making
processed involved in the management of that organization.
Database Management System:
A database management system is a software package with computer programs that controls the
creation, maintenance, and use of a database. It allows organizations to conveniently develop
databases for various applications. A database is an integrated collection of data records, files,
and other objects. A DBMS allows different user application programs to concurrently access the
same database.
Well known DBMSs include Oracle, IBM DB2, Microsoft SQL Server, Microsoft Access,
PostgreSQL, MySQL, FoxPro, and SQLite.
Types of DBMS:
Data can be organized into two types:
• Flat File: Data is stored in a single table. Usually suitable for less amount of data.
• Relational: Data is stored in multiple tables and the tables are linked using a common field.
Relational is suitable for medium to large amount of data.
Database servers:
Database servers are dedicated computers that hold the actual databases and run only the DBMS
and related software.
Advantages of Database:
Reduces Data Redundancy: no chance of encountering duplicate data
Sharing of Data: The users of the database can share the data among themselves.
Data Integrity: Data integrity means that the data is accurate and consistent in the database.
Data Security: Only authorized users are allowed to access the database and their identity is
authenticated using a username and password.
Privacy: The privacy rule in a database states that only the authorized users can access a
database according to its privacy constraints.
Backup and Recovery: Database Management System automatically takes care of backup and
recovery.
Data Consistency: Data Consistency means there should be multiple mismatching copies of the
same data.
Confidentiality: DBMS software ensures different views for the different users which makes the
data confidential. It is highly securable also by assigning a lock to it by using keys.
DATA MODELS
A database can be designed in different ways depending on the data being stored. This structure
of database is knows as data model that describes the manner in which data will be stored and
retrieved.
A data model consists of components for describing on the data, relationships among them and
the constraints that hold data. There are different data models such as hierarchical data model,
network data model and relational data model.
HIERARCHICAL DATA MODEL
In this model the data is organized into a tree like structure. The data is stored in the form of
records. A record is a collection of fields and its data values. All these records are linked to each
other at various levels thereby forming a hierarchy.
NETWORK DATA MODEL
In this model, multiple records are linked to same master file. It 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.
RELATIONAL DATA MODEL
This data model is based on the principle of setting relationships between two or more tables of
the same data base.
DATABASE OBJECTS (Field, Record and Table);
Tables:
A table is a set of data elements (values) that is organized using a model of vertical columns
(which are identified by their name) and horizontal rows.
Columns or Fields or Attributes:
A column is a set of data values of a particular simple type, one for each row of the table.
Rows or Records or Tuples:
A row also called a Record or Tuple represents a single, data item in a table.

Fields

Name FatherName City Age


Smith John 3 24
Howard Shemp 4 28 RECORDS
Doe Jane 1 27

TYPES OF KEYS IN A TABLE:


PRIMARY KEY:
A Primary key is a field that uniquely identifies the records in a table. In a database, a field
which stores a unique value for each record and hence can uniquely identify a row/record is
called a Primary key.
COMPOSITE PRIMARY KEY:
Sometimes a combination of field-values is unique in a table. In those cases, that group of fields
or attributes makes a primary key of the table. The primary key that consists of a combination of
two or more fields or attributes is knows as Composite key or Composite primary key.
ALTERNATE KEY:
The keys that have the unique values for each record but are not selected as the primary keys are
called alternate keys.
FOREIGN KEY:
A non-primary key field/attribute in a table is called a foreign key if it is a primary key in
another table.
DIFFERENCE BETWEEN PRIMARY KEY AND FOREIGN KEY
FOREIGN KEY PRIMARY KEY
A field or group of fields in a relational A special relational database table field or
database table that provides an association combination of multiple fields that allows to
between data in two tables. uniquely identify all table records
Table can have multiple foreign keys Table can have only one primary key
SESSION 2
CREATE A TABLE USING TABLE WIZARD
A table is the basic unit of any DBMS. The data is first stored in tables in row and
column format. A column represent a field or an attribute while a row represents a
record.
DATATYPES IN BASES
A field type(datatype) determines what types of data can be stored in a field and
how it can be processed. Various field types in Base are given below.
NUMBER DATATYPES
1. INTEGER DATA TYPES: It stores non-fractional, i.e. integer values only
a. TINYINT
b. SMALLINT
c. INTEGER
d. BIGINT
2. REAL NUMBER DATA TYPES: It stores fractional, i.e. real numbers.
a. NUMBERIC OR DECIMAL
b. REAL or FLOAT or DOUBLE
TEXT DATATYPES
These data types store text values. It can store letters, special characters and
numbers too but all these are treated as text only.
LONGVARCHAR,CHAR,VARCHAR
DATE DATATYPES
These datatype store dates
DATE
TIME DATATYPES
TIME
DATA/TIME DATATYPES
TIMESTAMP
BOOLEAN DATATYPES
BOOLEAN(stores 0 or 1)
CREATING TABLES:
The following are the steps:
1. Open LibreOffice 6.2 software.
2. Click on File > New > Database option. Database Wizard window appears
3. To create a new database, click on Create a new database option
4. Click on Next button. Another Database Wizard window appears
5. Click on the required options.
6. Click on the Finish button. The LibreOffice Base window appears
7. In the screen that opens, click on Use Wizard to create table
8. Another Table Wizard window appears. Choose the table type, select the
field names, and click on Next
9. Enter the data types and format for the fields selected. Press Next > from
screen. Another wizard window appears
10.Set the primary key. Press Next > Another Table wizard window appears
11.Enter the name of the table and enter whether the data to be inserted
immediately.
12.Click on Finish in above screen. The Table Data view is launched. Enter the
data into the table one by one row
SESSION 3
PERFORMING OPERATIONS ON TABLE
1. Delete a record:
Right click on the row/tuple and click on Delete rows. The selected
tuple gets deleted. A prompt opens to confirm whether you want to
delete the row or not. Click on Yes, to delete.
2. Sorting Data in the Table
Open the table in the data view. There are sort options from a to z and
z to a. Keep the cursor on the column where the sorting should take place.
Click on Sort Descending. The table gets sorted.
RELATIONSHIPS IN TABLE
What are Relationships?
In a database, relationships are defined links that associate two tables through a
common field. A relationship effectively joins two tables to virtually form one
large table.
Types of Relationships:
There are three types of relationships that can be formed in a databse.
a. One to one
b. One to Many
c. Many to many
Note: For explaining these relationships assume that the relationship being
explained link two tables namely A and B
One to One:
Each record in Table A can have only one matching record in Table B and each
record in Table B can have only one matching record in Table A
One to Many:
It is the most common type of relationship. A record in Table A can have many
matching records in Table B, but a record in Table B has only one matching record
in Table A
Many to Many:
A record in Table A can have many matching records in Table B and a recod in
Table B can have many matching records in Table B. This type of relationship is
only possible by defining a third table called junction table whose primary key
consists of two fields – the foreign keys from both Tables A and B
CREATING RELATIONSHIPS:
1. Go to the opening screen of Base and click on Tools > Relationships. The
Relation Design window opens.
2. Click on Add Tables from the window. The Add tables dialog box appears
3. Select the 1st table and click on Add button
4. Select the 2nd table and click on Add button. The design view of both the
tables will appear
5. Click on Close button to exit the Add tables dialog box
6. Drag the field from frist table and drop it onto the 2nd table to draw a
relationship between the two tables.
FIELD PROPERTIES
In the Design view of a table, you may see the format of the table and
individual properties for each of the fields of the table also.
a. Entry required
b. Length
c. Default value
d. Format example
SESSION 4
RETRIEVE DATA USING QUERY
A Query is used to retrieve the desired information from the data base. In simple
terms, it is a question asked from the database.
Query Creation using wizard
1. Click on Queries button on the left pane of the opening screen. A screen
with different options opens.
2. Click on Use wizard to create query. The query wizard dialog box
appears.
3. The first step is Field Selection. Choose the fields to be in the query
4. Then select the sorting order of the tuples output by the query.
5. Click on Next> button. The 2nd step is sorting order. It will be selected.
6. Click on the respective fields for sort by. You have further choices for
sorting by other fields once there is a tie.
7. Click on Next button. Search conditions step comes up
8. Enter the criteria by which to search the table
9. Press Next button. The Detail or summary step comes up
10.Detailed query would show each tuple of the table Summarized query
would only show results for the aggregate functions
11.Press Next >button. The Aliases step comes up
12.Instead of showing their real names, the names can be renamed. That is
called as alias. Click on Next button.
13.Final step of the query wizard shows the properties of the query as
selected. Click on Finish to end the process
14. Query will output on the screen.

Creation of Query with a Design view


1. Click on the Queries button on the pane of the opening screen.
2. Click on Create Query in Design view option
3. Add table or query dialog box appears
4. Select the first table and click on Add button
5. Click on Close button to close the Add table or query dialog box
6. In the Design grid for query, choose the fields of the tables, whether the
field is to be visible or not.
7. Click on the Run query or press F5 key
SESSION 5
CREATE FORMS AND REPORTS USING WIZARD
A form is a feature of a database using which we can enter data in a table in
an easy and user friendly manner. A form consists of text boxes, labels,
radio buttons, list boxes, check boxes etc. that give a user friendly interface
for entering data. The data entered through the forms is stored in tables.
1. Click on Form view from the left pane
2. Click on Use wizard to create form. The form wizard dialog box
opens up
3. First step is Field selection. Chose the Table or Query from the first
screen.
4. After the choice of fields is made, click on Next > button. The second
step Set up a subform gets selected
5. Click on Next > button without selecting any option if you do not
want a subform.
6. The next step Arrange controls will get selected. Choose your
arrangement of the mail from.
7. Click on Next button. The next step Set data entry will be selected
8. Select the data entry mode
9. Click on Next button. The next step Apply styles gets selected
10.Select the style of the form and its field border
11.Click on Next button. The last step Set name gets selected.
12.In the last stage, you chose the name of the form.
13.Click on Finish button and the form will appear.
Options to enter or remove data from forms:
1. Open the form that is created.
2. Click on > from status bar. The fields of the form comes as empty for next
record.
3. Enter the input fields. Press Ctrl + S to save the record
Partial Deletion of records:
1. Choose the record to delete by clicking on the Next or Previous buttons
2. Delete all the field values as visible above. Save and close the form.
Searching record using form:
In the status bar of the form, there is an icon to search for the string within the
form.
Modifying form:
1. Open the database view. Click on Forms tab. The list of forms part of the
database opens up
2. Right click on the form you want to modify. Choose Edit from the context
menu.
3. From the form design toolbar, choose the select tool. Click on the form
element you want selected. Right click on any form element and click on
Control from Context menu.

Changing label in form:


1. Choose the Select tool from Form Design toolbar
2. Choose the form element whose label you want to modify
3. Right click on the selected form element. Choose Ungroup from context
menu. This separates the label from the text box.
4. Right click on the label and choose Control from context menu. Properties
Label field name dialog box appears.
5. Close the dialog box. Check whether the label has changed in the form.
Changing Background in form:
Right click on an empty area of the form and choose Page option from context
menu. A page style default style dialog box opens.
Choose Format menu > Page option. The same dialog box opens. Modify the
form background from the dialog box

Concept of Report in Base


The output of a query may be displayed in the form of reports. The usual result
of the query is in the form of rows and columns.
1. Click on Reports from left pane.
2. Click on Use Wizard to Create Report. The Report Wizard opens up
3. First step - Field selection gets selected. Select the field names to be in the
report
4. Click on Next button. The 2nd step Labelling field gets selected.
5. Label the fields as you want.
6. Click on Next button. The 3rd step Grouping gets selected
7. Enter the criteria to group the fields by
8. Click on Next button. The 4th step Sort Options gets selected
9. Enter the required sort options
10.Click on Next button. The 5th step Choose layout gets selected
11.Choose the layout for the reports
12.Click on Next button. The 6th step Create report gets selected.
13.Create report by giving an appropriate title to the report
14.Click on finish button. The report is created.

SESSION 6
UNDERSTAND AND USE SQL AND DDL COMMANDS
SQL (Structured Query Language) commands are grouped into four major
categories depending on their functionality
1. DATA DEFINITION LANGUAGE(DDL): These commands enable to perform the
following tasks
CREATE
ALTER
DROP
ADD COMMENTS
2. TRANSACTION CONTROL LANGUAGE (TCL): These commands manage changes
made by DML commands. These are used for managing changes affecting the data.
COMMIT
ROLLBACK
SAVEPOINT
3. DATA CONTROL LANGUAGE: It is used to create roles, permissions and referential
Integrity. These commands are used for providing security to database objects. These
commands are GRANT and REVOKE
4. DATA MANIPULATION LANGUAGE: These SQL commands are used for storing,
retrieving, modifying and deleting data. These commands are SELECT,
INSERT,UPDATE AND DELETE

CREATE DATABASE:
SYNTAX:
CREATE DATABASE <DB_NAME>
Example:
CREATE DATABASE Test;
CREATE TABLE:
SYNTAX:
CREATE TABLE <TABLE_NAME>
(
Column_name1 datatype1,
Column_name2 datatype2,
Column_name3 datatype3,
Column_name4 datatype4);
Example:
CREATE TABLE Student(
Studentid int,
Name varchar(100),
Age int);
ALTER TABLE:
The Alter command is used for altering the table structure, such as
 To add a column to existing table
 To rename any existing column
 To change datatype of any column or to modify its size
 To drop a column from the table
To add a column to existing table
SYNTAX:
ALTER TABLE table_name ADD(
Column_name datatype):
Example:
ALTER TABLE student ADD (
Address varchar(200)
);

To rename any existing column


SYNTAX:
ALTER TABLE table_name RENAME
Oldcolumnname TO newcolumnname
Example:
ALTER TABLE Student RENAME
Address TO location

To change datatype of any column or to modify its size


SYNTAX:
ALTER TABLE table_name modify(
Column_name datatypes
);
Example:
ALTER TABLE Student MODIFY(
Address varchar(300));

To drop a column from the table

SYNTAX:
ALTER TABLE table_name DROP (column_name);
Example:
ALTER TABLE Student DROP(address);
DROP COMMAND
SYNTAX:
DROP TABLE table_name
Example:
DROP TABLE Student;

DROP DATABASE test;


The above query will drop the database with name test from the system.

INSERTING VALUES
SYNTAX:
INSERT INTO <tablename>
Values ()
Example:
INSERT INTO employee(ecode,ename,sex)
VALUES (1001,’Amit’,’M’)

UPDATING VALUES
SYNTAX:
UPDATE <tablename>
SET value
Example
UPDATE employee
SET ROLL =250 where icode =101

DISPALYING VALUES
SYNTAX
SELECT * FROM <TABLENAME) WHERE <CONDITION>
Example:
Select * from garment where size =’XL’ (* indicates displaying all the fields in the table)

DELETING DATA FROM TABLES


SYNTAX
DELETE FROM <tablename)
WHERE <CONDITION>
Example:
DELETE FROM employee where gross >1500.00

You might also like