0% found this document useful (0 votes)
34 views36 pages

Database Micheal

The document provides information about databases, database management systems, data organization, database servers, advantages of databases, database features, keys in databases, and relational database management system class notes. The key points are: 1) A database is an organized collection of data stored and accessed electronically. A database management system (DBMS) allows users to create, access, manage and control databases. 2) Data can be organized in flat files or relationally in multiple tables linked by common fields. Database servers hold databases and run DBMS software to allow access through interfaces. 3) Relational database management system class notes cover creating and editing tables, performing operations on tables, retrieving data using queries, and more

Uploaded by

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

Database Micheal

The document provides information about databases, database management systems, data organization, database servers, advantages of databases, database features, keys in databases, and relational database management system class notes. The key points are: 1) A database is an organized collection of data stored and accessed electronically. A database management system (DBMS) allows users to create, access, manage and control databases. 2) Data can be organized in flat files or relationally in multiple tables linked by common fields. Database servers hold databases and run DBMS software to allow access through interfaces. 3) Relational database management system class notes cover creating and editing tables, performing operations on tables, retrieving data using queries, and more

Uploaded by

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

Database: A Database is an organized collection of data, it can be visualized

as a container of information.

Database Management System: DBMS is a software package with computer


programs that control the creation, maintenance, and use of a database. A
database is a collection of data and DBMS allows different user application
programs to concurrently access the same database. Examples of DBMS –
Oracle, MySQL, FoxPro, IBM DB2, Microsoft SQL Server, OpenOffice.org
Base, and Microsoft Access.

Organization of Data: Data can be organized in two ways –

1. Flat File: Data is stored in a single table. This is usually suitable for less
amount of data.
2. Relational: Data is stored in multiples tables which are linked by a
common field. This is suitable for medium to large amount of data.
Database Servers: These are dedicated computer systems that hold the
databases and run only the DBMS and related software. Databases are
available on database servers and are usually accessed through a command
line or Graphic User Interface tools [called Frontend].

Advantages of Database:

1) Reduces Data Redundancy: Database reduces data redundancy.


Database reduces Duplication of data, in fact, there is no chance to encounter
duplicate data in a database.

2) Sharing of Data: The users of the database can share the data among
themselves.

3) Data Integrity: Data integrity means that the data in the database is
accurate and consistent.

4) Data Security: Database provides data security as only authorized users


are allowed to access the database and their identities are authenticated by
using a username and password.

5) Privacy: Only authorized users can access a database according to the


database privacy constraints.
6) Backup and Recovery: DBMS automatically takes care of backup and
recovery. In case of a crash or system failure, it gets restored to its previous
condition.

Features of Database:

 The database has one or more tables.


 Each table has information about one type of item.
 Every table in a database has a key field that makes sure that there are
unique values throughout the database.
Keys in a Database:

1) Primary Key: A primary key is a unique value that identifies a row in a


table. Primary Key helps the database to quickly search for a record.

2) Composite Primary Key: When a primary key constraint is applied on one


or more columns then it is known as Composite Primary Key.

3) 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.

So here we have completed the first session of Relational Database


Management System Class 10 Notes. Let’s now move to the second session.

Read This – Entrepreneurial Skills Class 10 Notes

Relational Database Management System Class 10 Notes Session 2 -:

SESSION-2 : CREATE AND EDIT TABLES USING WIZARD & SQL


COMMANDS

Database Objects:

1) Table: It is a collection of data elements (values). It consists of vertical


columns and horizontal rows where we put the required information.

2) Columns or Fields or Attributes: It is a set of data values of a particularly


simple type, one for each row of the table.
3) Rows or Records or Tuples: It represents a single data item in a table.
Every row in the table has the same structure.

This session is majorly practical. Database Management System Class 10


Notes for term 2. The Detailed Practical for RDBMS is given below [Must
Watch NOW] –

Data Types: These are used to identify which type of data we are going to
store in the database. Data types in the OpenOffice base are broadly
classified into five categories.

1. Numeric Types
2. Alphanumeric Types
3. Binary Types
4. Date time
5. Other Variable types
Numeric Types: Used for storing information such as mobile number, roll
number, door number, etc.

Alphanumeric Types: Used to store information that has alphabets as well


as numbers for example address, book summary field, etc.

Binary Types: Used for storing data in binary formats. This can be used for
storing photos, music files, etc.

DATE TIME: Used for storing information such as date of birth, date of
admission, date of product sale, etc.

Relational Database Management System Class 10 Notes Session 3 -:

SESSION 3: PERFORM OPERATIONS ON TABLE

In the OpenOffice Base, we store data in tables that can be inserted, modified,
and removed using suitable options.

Inserting Data In The Table:

Steps to insert data in a table –

1) Select the table, Double click on it.


2) The table will open in Datasheet View.

3) Insert the required number of records in Datasheet View.

Editing Records In The Table:

Steps to Edit Records in the table –

1) Select the table, Double click on it.

2) The table will open in Datasheet View.

3) Edit the required record in Datasheet View.

Deleting Records From The Table

Steps to remove data from the table –

1) Select the table, Double click on it.

2) The table will open in Datasheet View.

3) Select the data > right click on selected data > select the Delete option

Field Properties :

Steps to set field properties –

1. Select the table > Right-click > Select the option Edit > the table will
open in Design View.
There are various properties of fields according to the data type set for each
field in the design view.

The properties of numeric type data are given below :

1) AutoValue – if set to yes then the field will get the auto numeric values.

2) AutoValue – if set to no then the field will not get the auto numeric values.
3) Length – By default length of the field is 10 but the size of the field can be
set to maximum length.

4) Default Value – A default value can be set for a field if the user doesn’t
provide any value while entering the values in the table.

5) Format – This property helps to set the format of the data entered in the
field such as 91-222-333.

Database Management System Class 10 Notes for term 2.

The properties of character type data are shown below :

1) Entry Required – if set to yes then it will be a must to insert the value in the
field.

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 the user doesn’t
provide any value while entering the values in the table.

4) Format – This property helps to set the format of the data entered in the
field such as 91-222-333.

Sorting Data :

Sorting means arranging the data in either ascending order or descending


order.

Referential Integrity :

Referential integrity is used to maintain the accuracy and consistency of data


in a relationship. In OpenOffice Base, data can be linked between two or more
tables with the help of primary key and foreign key

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 the


associated table(s).

3) Deleting records from a primary key table if there are any matching related
records available in the associated table(s).

Creating and Editing Relationships between Tables :

A relationship refers to an association or connection between two or more


tables. Relationships between tables help 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.
You can create a relationship between any two tables by selecting the
Relationships option from the Tools menu.

There are three types of relationships that can be created in tables:

1) ONE to ONE Relationship: In this relationship, both the tables must have
primary key columns.

2) One to Many Relationship: In this relationship, one of the tables must


have a primary key column.

3) Many to Many Relationship: In this relationship, no tables have the


primary key column.

Remove the Relationships

The relationships applied on the tables can be removed also with the help of
the Delete option. Right, Click on the relationship thread and select the Delete
option.

Relational Database Management System Class 10 Notes Session 4 -:


SESSION 4: RETRIEVE DATA USING QUER

Queries are commands that are used to define the data structure and also to
manipulate the data in the database. A query helps us join information from
different tables and filter that information

There are two types of languages:-

1. DDL (Data Definition Language)


2. DML (Data Manipulation Language)
Common DDL Statements are:-

1. Create :- This satement is used to create database or tables.


2. Alter :- This satement is used to modify structure of table.
3. Drop :- This satement is used to delete database objects.
Common DML Statements are:-

1. SELECT :- This satement is used to retrieves information from the


database.
2. INSERT :- This satement is used to insert new record into the database.
3. DELETE :- This satement is used for deletion of information in the
database.
4. UPDATE :- This satement is used for modification of information in the
database
Select Statement :

A SELECT statement retrieves zero or more rows from one or more


tables. SELECT is the most commonly used Data Manipulation
Language(DML) command. To retrieve all the columns in a table the syntax
is SELECT * FROM <Table Name>;

For example, if you want to display all the data from table emp (short form of
employee), the command is

Select * from emp;

The SELECT statement has many optional clauses:

1. WHERE specifies which rows to retrieve.


2. ORDER BY specifies an order in which to return the rows.
for example Select * from emp where name = “Neha”;

The above query will show the result of a particular employee named “Neha”.

Select * from emp order by Salary;

The above query will show all the records of table emp according to
ascending order of column Salary.

Enjoying these Database Management System Class 10 Notes for term 2?


Please share them with your friends.

Performing calculations :

In Base, simple calculations can be done on the data using arithmetic


operators. Example:

1) To display the salary of all the employees after incrementing by 1000 then
the following SQL command will be executed in Base. (Fields of table
Employee are EmployeeID, FirstName, Salary)

Select “EmployeeID”, “FirstName”, “Salary” +1000 from “Employee”;

2) To display the salary of all the employees after decreasing by 10000 then
the SQL command will be:

Select “EmployeeID”, “FirstName”, “Salary” – 10000 from “Employee”;

3) To display the salary of all the employees after incrementing it as twice the
amount of present salary, then the SQL command will be.

Select “EmployeeID”, “FirstName”, “Salary” * 2 from “Employee”

Update Statement :

Update statement is used for modifying records in a database. The general


syntax of the update statement is as follows:
UPDATE <table name> SET <Column name > = value [WHERE
<Condition>];
for example :

1) To increase(update) the salary of employee “Neha” by Rs 2000 (in table


Employee)then the SQL command will be:

Update Employee set Salary = Salary + 2000 Where FirstName = “Neha”;

Relational Database Management System Class 10 Notes Session 5 -:

SESSION 5: CREATE FORMS AND REPORTS USING WIZARD

FORM: A form provides the user with a systematic way of storing information
in the database. It is an interface in a user-specified layout that lets users
view, enter, and change data directly in database objects such as tables.

Creating Form Using Wizard: Steps To Create Form Using Wizard are :

1) Click Use Wizard to Create Form option under Tasks group. The Form
Wizard dialog box appears.

2) Select selective fields to be sent onto the form by selecting the field name
and clicking the > button and clicking Next.

3) Select the option Add Subform if you need to insert the contents in the table
in a separate form and click Next.

4) Arrange selected fields in a form and click Next.

5) Select the data entry mode and click Next.

6) Specify the styles to be used in the form and click Next.

7) Specify the name of the form. Click Finish.

REPORT: A report helps to display the data in a summarized manner. It is


used to generate the overall work outcome in a clear format.

Creating Reports using the wizard: Steps To Create Report Using Wizard
are :
1) Click on Use Wizard to Create Report… option available under Tasks.

2) Select all the table fields by selecting the >> button.

3) Redefine the label of the fields in the reports or else you can set the default
name and click Next.

4) Define grouping for the fields of the table if required and click Next

5) Sort the field in the report by selecting the appropriate field name and
sorting method(if required) and click Next.

6) Select the layout of the report and click Next.

7) Define a name for the report and click Finish.

What is Database?
An organised group of data that is kept and accessible electronically is
referred to as a database. It is a digital repository that enables the effective
management, storage, and retrieval of both organised and unorganised data.
Information like client records, financial data, inventory listings, and much more
can be stored in databases. Example of database are – Microsoft Access,
OpenOffice Base, Oracle, MySQL and PostgreSQL etc.

What is a Database Management System?

Data is stored, retrieved, and analyzed using software called database


management systems (DBMS). Users can create, read, update, and remove data
in databases using a Database Management System, which acts as an interface
between them and the databases. Example of database Management System
are – Microsoft Access, OpenOffice Base, Oracle, MySQL and PostgreSQL
etc.

Data can be organized into two types:

 Flat File: Data is stored in a single table. Usually suitable for less amount
of data. basically for small-scale organization where data does not need to
be strucutred in a complex way. Example of database software are
Microsoft Excel or Google Sheets.
 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. Example of database software are MySQL, Microsoft SQL
Server, and Oracle Database..
What is Database Server?

Database servers are dedicated computers that are designed to store data
and provide database services to other computers. We use a database to
store, organize, manage and retrieve data efficiently and effectively. The
database servers run only database and database related software.

Advantages of Database

Reduces Data Redundancy

Data redundancy means when same data is stored more than one places,
which increased complexity and wasted of storage space, so, database helps to
reduce data redundacy.

Sharing of Data

A database allows its users to exchange data among themselves. The data
can only be shared with users who have received the appropriate degrees of
authorization because there are different levels of access to the data.

Data Integrity

Data integrity refers to the accuracy and consistency of data stored in a


database management system (DBMS). Database ensures that the data is
reliable and can be trusted for decision making and other critical business
processes.
Data Security

A database’s concept of data security is important. The database should only


be accessible to authorised users, whose identities must be verified using a
username and password.

Privacy

The privacy rule in a database ensures that only authorized users can access
the database and view data according to the specific privacy constraints.
To maintain data security, access levels are set in the database so that a user
can only view data that they are not allowed to modify if the permission is not
given.

For example, in social networking sites, different accounts have different access
constraints, and users are only allowed to view the other account data that is
permitted for their specific account.

Backup and Recovery

Database Management System automaticlly take backup and recovery


processes to ensure the protection and availability of data. This means that
the DBMS automatically creates and manages backups of the database at
regular intervals, and also provides tools to recover data in the event of a
failure or data loss.

Data Consistency

Data consistency refers to the accuracy and reliability of data stored in a


database or other data storage system. It means that the data is consistent and
valid across all instances where it is stored or accessed.

For example, if a customer’s name and address are stored in multiple tables
within a database, the data must be consistent across all table.

Database Management System Class 10 Notes

Features of Database
There are some key features of a database:

1. One or more tables can be added in the database.


2. Decreased storage costs and space requirements
3. Users can use query languages in a database.
4. Multiple users can access the data from the database .
5. Unique keys aid in preventing errors caused by human or technological
mishaps.
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). primary
key is a field or a set of fields that uniquely identify each record in a table.
A primary key must be unique and cannot contain null values.
2. Composite Primary Key – A composite primary key is a primary key that
consists of two or more fields that together uniquely identify each record in
a table.
3. Foreign Key – A composite primary key is a primary key that consists of
two or more fields that together uniquely identify each record in a table.
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

a. 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.

b. 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.

c. 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.

Difference between DBMS and RDBMS

Aspect DBMS RDBMS

Data is stored in various formats such as flat Data is stored in tables that are related to each other
Data structure
files or hierarchical structures. a relational model.

DBMS systems may or may not enforce strict RDBMS systems enforce strict data integrity rules tha
Data integrity
data integrity rules. ensure data consistency and accuracy.

Data DBMS systems may or may not follow RDBMS systems follow normalization rules to minimi
normalization normalization rules. data redundancy and improve data integrity.

Typically, DBMS systems use proprietary


Query language RDBMS systems use standard query language like SQ
query languages.
Aspect DBMS RDBMS

DBMS systems may not be scalable to handle RDBMS systems are highly scalable to handle large
Scalability
large amounts of data. amounts of data.

DBMS systems are generally less expensive RDBMS systems are generally more expensive than D
Cost
than RDBMS systems. systems.

Database Management System Class 10 Notes

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 table in Database
The database’s tables are used to store data. In the database, In OpenOffice
Base the tables can be created in two different ways.

1. Create Table in Design View


2. Use Wizard to Create Table
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
Database Management System Class 10 Notes

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
Numeric Types

Numerical data types are data types that store numeric values in a database.
Numeric data types can be further divided into several subtypes, including:

Alphanumeric Types

Data that has both letters and numbers is referred to as alphanumeric type.
Binary Types

For storing data in binary formats, binary data types are utilised. In a database,
binary data types can be used to store things like music and image files. The
binary data type can generally be used to store files in any format.

Date Time

When specifying date and time values for a column used in a database table,
date time data types are used. Information like dates of birth, admissions,
product sales, and other dates can be stored in databases using date and time
data types.
Other Data Types

Database Management System Class 10 Notes

Session 3 : Perform Operations on Table


In Base, data is kept in tables that may be added to, changed, or deleted by
using the proper options.

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
Following are some properties of data of the numeric type:

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.
Following are some properties of data of the character type:

1. 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.
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.

Note Removing 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.
Session 4 : Retrieve Data using Query
In order to describe the data structure and to modify the data in the database,
queries are used as instructions. A query enables the joining and filtering of data
from various tables.

Database Languages having two type:

1. DDL (Data Definition Language)


2. DML (Data Manipulation Language)
DDL Statements:

 Create: Using this statement, a database or set of tables can be created.


 Alternate: This statement is used to change the table’s structure.
 Drop: This statement is used to remove database objects from the system.
DML statements:

 SELECT: The statement “SELECT” is used to get data from the database.
 INSERT: The statement “INSERT” is used to add a new record to the
database.
 DELETE: The database can be cleaned out by using the statement
DELETE.
 UPDATE: This statement is used to modify the database’s information.
Database Query
Query is a computer languages. In order to describe the data structure and to
modify the data in the database, queries are used as instructions. Query can
extract particular data from a database. We can filter and join data from various
tables with the help of a query. By using the criteria you supply query will filter the
data.

Select Statement

A select query is a language in a database that displays data in Datasheet view.


Data from tables is displayed by a query rather than being stored by it. A query
may display data from one or more tables, from other queries, or from both of
these sources simultaneously.
The SELECT statement has many optional clauses:


WHERE specifies which rows to retrieve.
 ORDER BY specifies an order in which to return the rows.
Syntax of Select Statement is –

SELECT * FROM <TABLENAME>;

Query related to Simple Select Statement –

Table Name – product

Product_No Product_Name Price Quantity

25 Soap 40 80

31 Powder 80 30

45 Shampoo 250 25

52 Soap Box 120 100

Database Management System Class 10 Notes

Question – Write a Query to display all record from the table;

Select * from product;

Output –

Product_No Product_Name Price Quantity


25 Soap 40 80

31 Powder 80 30

45 Shampoo 250 25

52 Soap Box 120 100

Database Management System Class 10 Notes

Question – Write a Query to display product name from the table;

Select Product_Name from product;

Output –

Product_Name

Soap

Powder

Shampoo

Soap Box

Database Management System Class 10 Notes


Question – Write a Query to display Product_Name and Price from the
table;

Select Product_Name, Price from product;

Output –

Product_Name Price

Soap 40

Powder 80

Shampoo 300

Soap Box 120

Database Management System Class 10 Notes

Query related to Select Statement with Mathematical function –

Table Name – product

Product_No Product_Name Price Quantity

25 Soap 40 80

31 Powder 80 30

45 Shampoo 250 25
52 Soap Box 120 100

Database Management System Class 10 Notes

Question – Write a Query to find the total no of quantity available in


table;

Select sum(quantity) from product;

Output – 235

Question – Display the total amount of each item. The amount must be
calculated as the price multiplied by quantity for each item.

Select Product_No, Product_Name, Price * Quantity from product;

Output –

Product_No Product_Name Price*Quantity

25 Soap 3200

31 Powder 2400

45 Shampoo 6250

52 Soap Box 12000

Database Management System Class 10 Notes


Question – Write a query to find the average price of the total product;

Select avg(Quantity) from product;

Output – 58.75

Query related to Select Statement with Where clause


Table Name – product

Product_No Product_Name Price Quantity

25 Soap 40 80

31 Powder 80 30

45 Shampoo 250 25

52 Soap Box 120 100

Question – Write a Query to display the product whose price is less than
90

Select * from product where price < 90;

Output –

Product_No Product_Nam Price Quantity

25 Soap 40 80
31 Powder 80 30

Database Management System Class 10 Notes

Question – Write a Query to find the total amount of the Shampoo


product;

Select Price*Quantity from product where Product_Name = ‘Shampoo’;

Output – 6250

Or

Select Product_No, Product_Name, Price*Quantity from product where


Product_Name = 'Shampoo';

Output –

Product_No Product_Nam Price*Quantity

45 Shampoo 6250

Question – Write a Query to display the data whose quantity is


equal to 80.

Select * from product where quantity = 80;

Output –

Product_No Product_Nam Price Quantity

25 Soap 40 80

Database Management System Class 10 Notes


Question – Write a Query to display a list of Products whose Price
between 40 to 120.

Select * from product where Price >= 40 and Price <= 120;

Output –

Product_No Product_Nam Price Quantity

25 Soap 40 80

31 Powder 80 30

52 Soap Box 120 100

Query related to Select Statement with Order by


Table Name – product

Product_No Product_Name Price Quantity

25 Soap 40 80

31 Powder 80 30

45 Shampoo 250 25

52 Soap Box 120 100


Question – Write a Query to display the list of Product_Name in
alphabetical order.

Select * from product order by Product_Name ASC;

Or

Select * from product order by Product_Name;

Output –

Product_No Product_Nam Price Quantity

31 Powder 80 30

45 Shampoo 250 25

25 Soap 40 80

52 Soap Box 120 100

Database Management System Class 10 Notes

Question – Write a Query to display the list of Price in ascending order.

Select * from product order by Price ASC;

Or

Select * from product order by Price;

Output –
Product_No Product_Nam Price Quantity

25 Soap 40 80

31 Powder 80 30

52 Soap Box 120 100

45 Shampoo 250 25

Question – Write a Query to display the list of Price in descending order.

Select * from product order by Price DESC;

Output –

Product_No Product_Nam Price Quantity

45 Shampoo 250 25

52 Soap Box 120 100

31 Powder 80 30

25 Soap 40 80

UPDATE statement

To edit or update already-existing records in a table, use the UPDATE statement.


Using the WHERE clause, you can either define a specific subset of entries to
edit or use it to update everything at once.
Syntax of Update Statement –

UPDATE <table name> SET = value [, column_name = value ...] [WHERE


];

Table Name – product

Product_No Product_Name Price Quantity

25 Soap 40 80

31 Powder 80 30

45 Shampoo 250 25

52 Soap Box 120 100

Database Management System Class 10 Notes

Question – Write a Query to update the price of Shampoo in the product


table.

Update product Set Price = 300 where Price = 250;

Output –

Product_No Product_Name Price Quantity

25 Soap 40 80

31 Powder 80 30
45 Shampoo 300 25

52 Soap Box 120 100

Question – Write a Query to update the Quantity of Powder in the


product table.

Update product Set Quantity = 50 where Product_Name = ‘Powder’;

Output –

Product_No Product_Name Price Quantity

25 Soap 40 80

31 Powder 80 50

45 Shampoo 250 25

52 Soap Box 120 100

Database Management System Class 10 Notes

Create Table

To create a new table in the database you can use Create Table Command.

Syntax of Create Table –

CREATE TABLE table_name ( column1 datatype, column2


datatype, column3 datatype);
Question – Write a Query to create the following table in the database;

Table Name – product

Field DataType

Product_No Integer

Product_Name Varchar(20)

Price Integer

Quantity Integer

Database Management System Class 10 Notes

Create table product ( Product_No Int, Product_Name Varchar(20),


Price Int, Quantity Int);

Output –

Product_No Product_Name Price Quantity

Database Management System Class 10 Notes

Insert Table

Insert statement is primarily used to add a single or more rows to the target table.

Syntax of Insert Table –

INSERT INTO table_name (column1, column2, column3, ...) VALUES


(value1, value2, value3, ...);

Or
INSERT INTO table_name VALUES (value1, value2, value3, ...);

Table Name – product

Product_No Product_Name Price Quantity

25 Soap 40 80

31 Powder 80 30

45 Shampoo 250 25

52 Soap Box 120 100

Question – Write a Query to add a new row with the following details

(72, “Hair Conditioner‟, 350, 60)

Insert into product (Product_No, Product_Name, Price, Quantity)


values(72, “Hair Conditioner‟, 350, 60);

Or

Insert into product values(72, “Hair Conditioner‟, 350, 60);

Output –

Product_No Product_Name Price Quantity

25 Soap 40 80

31 Powder 80 30
45 Shampoo 300 25

52 Soap Box 120 100

72 Hair Conditioner 350 60

Database Management System Class 10 Notes

Session 5 : Create Forms and Reports using Wizard

Forms
The Form allows you greater control over your outcomes. The form allows you to
customize various parts of the form’s design and then generates a form based on
your instructions.

Steps To Create Form Using Wizard

 Step 1 : Click Use Wizard to Create Form


 Step 2 : Select the selective Fields using Arrow button
 Step 3 : Click Next
 Step 4 : Add Subform if you need to insert
 Step 5 : Click Next
 Step 6 : Arrange selected field in a form
 Step 7 : Click Next
 Step 8 : Click Finish
Reports

A report helps in the presentation of data in a summarized format. It is utilized to


create a clear format for the entire work product. In the database, you can build
reports.

Steps To Create Report Using Wizard

 Step 1 : Click on Use Wizard to Create Report


 Step 2 : Select the selective Fields using Arrow button
 Step 3 : Click Next
 Step 4 : Redefine the label of the fields in the reports or else you can set
the default name
 Step 5 : You can define grouping for the fields of the table
 Step 6 : Click on Next
 Step 7 : Click Finish

You might also like