10th Class DATABASE Notes
10th Class DATABASE Notes
What is Database Management System? It ensures each record is unique in a table.
It is also indexed in database, making it faster to search for records
It is application software that can be used to create and manage database efficiently. A table can have only primary key
it enable user or application to create, store, update, delete and retrieve data from Primary key cannot have NULL values
database itself. Composite Primary Key
Examples of DBMS are MySQL, Oracle, MongoDB, MS Access, MS SQL Server,
FoxPro, SQLite etc.
When Primary key constraint is applied on or more columns then it is known as Composite
What is database?
primary key.
Database is an organized collection of interrelated data that has been recorded, organized and
Foreign Key
made available for searching is called Database.
The field which is Primary key in another related table.
Advantages of Database Foreign key is used to establish relation between two tables.
A table can have more than Foreign key
Reduced Data Redundancy: As different type of data are stored in different tables within a What is RDBMS?
single database, chances of repetition of data reduced to zero.
RDBMS stands for Relational Database Management System. It was developed by E.F. Codd at
Data Integrity: Data integrity ensures that data stored in database is valid, accurate and IBM 1970. It is used to organize collection of data as a relation where relation corresponds to a
consistent in database. There are many data constraints present in database that implements data table of values. Often, data in a relational database is organized into tables.
integrity.
SESSION 2: Create and Edit Table using Wizard & SQL Commands
Data Consistency: it refers to same appearance of data across the database and for all the users
viewing the database. Moreover, any changes made to data are instantly reflected to all its Database Objects
associated tables within a database and there is no data inconsistency.
Tables:
Data Privacy: there are data security rules that when applied can ensure the accessibility scope
of data at different levels to authentic users only. 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.
Backup and Recovery: there is provision of automatic data backup that helps to restore A table has a defined number of columns, but can have any number of rows.
database in case of system failure or crash and keep data safe and available. Each row is identified by the values appearing in a particular column identified as a
unique key index or the key field
Features of Database Columns or Fields or Attributes
A database can have more than one table. A column is a set of data values of a particular type, one for each row of the table.
Each table in a database contains information about one type of item. The columns provide the structure according to which the rows are composed.
Every record must be unique in a table. For example, Itemcode, Itemname are fields in a row
Every table should have one or more fields designated as key. Rows or Records or Tuples
Sequence of Columns (fields) of table can be in any order
Keys in Database A row also called a Record or Tuple represents a single, data item in a table.
Creating database in Open Office 5. After entering all fieldname, select a field name and right click at left most side
6. Select ‘Primary Key’ from pop up
1. Start Open Office 7. After specifying all, save the table by clicking File → Save
2. Select the option Database 8. Specify table name and click OK
3. In database Wizard dialog, select ‘Create a new database’ and click Next and then click Data Types
on Finish (with no change)
4. In Save As dialog, specify name for the database and click save Data types are used to determine which type of data we are going to store in the database.
5. Database Window will be opened
What is Table? Following tables shows different data types used in Open Office Base
Tables are the basic building blocks of a database which is used to store data in the database.
Adding records to a related table if there is no associated record available in the primary How many ways we can create query in Open Office Base?
key table.
Changing values in a primary if any dependent records are present in associated table(s). We can create query in 3 ways in Open Office Base as given below:
Deleting records from a primary key table if there are any matching related records
available in associated table(s). 1. Create query using Wizard
Relationships between Tables 2. Create query in design view
3. Create query using SQL
A relationship refers to an association or connection between two or more tables. When you Create query using Wizard
relate two tables, you don’t need to enter the same data in separate tables.
1. Open your database
Relationships between tables help to: 2. Select query → create ‘Create Query using Wizard’
3. Select table from ‘tables’ drop down
Save time as there is no need to enter the same data in separate tables. 4. Add fields from ‘Available fields’ list by clicking ‘>’ to ‘Fields in the Query’ list
Reduce data-entry errors. 5. Click on finish
Summarize data from related tables. Create Query using Design View
Types of relationships
1. Open your database
ONE to ONE: In this relationship, both the tables must have primary key columns. 2. Select Query → create query in design view
ONE to MANY or MANY to ONE: In this relationship, one of the table must have 3. Select the table from show table box and add it in query
primary key column 4. Now double click all the fields you want to display in query result
MANY to MANY: In this relationship, no table has the primary key column 5. Set the condition at ‘criteria’ row for the field to be searched
Creating Relationship between tables 6. Save and run query
What is SQL?
1. Open your database
2. Select Relationship option from Tools Menu SQL is Structured Query language (pronounced as ‘sequel’) is computer language used to create
3. Select the table and click on add button to Add the tables in amongst which you want to manage database. We can create queries SQL to view or retrieve specific records from database.
create relationship
4. Close show table box SELECT statement
5. Now place the mouse over the common field which is primary in a table
6. Hold down the mouse button and drag it over same common field of another field SELECT statement in SQL is used to retrieve records from one or more tables of a database. It
7. Release the mouse button. You will see a line appears between linked tables now. is one of the most commonly used DML (data manipulation Language) command.
How to use Select statement to retrieve data from table Display items which rate is less than 100rs
SELECT * FROM <table name>; Display name, department and salary of all employees after incrementing salary by 1000.
To view specific fields: SELECT ename, dept, salary + 1000 FROM employee;
SELECT <field(s)> FROM <table name>; Display records of those salesman who lives in Delhi and Mumbai from salesman table.
We can use WHERE clause with SELECT statement to create query. WHERE clause is used to Display students details from student table in ascending order of rollno.
set criteria for the data to be retrieved from table.
SELECT * FROM student ORDER BY rollno;
Syntax:
Display all item details of patanjali brand which rate is 100.
SELECT <field name(s)> FROM <table name>
SELECT * FROM item WHERE brand = ‘patanjali’ AND rate = 100;
WHERE <criteria>;
UPDATE statement
ORDER by clause
Update statement is used for modifying records in a database.
It is used to arrange or sort data in ascending or descending order in resultset. It can be used
with SELECT statement as given below: The general syntax of the update statement is as follows:
Display iname and its price from item table. Will update location to Bhubneshwar of student havng rollno 14.
SELECT iname, price FROM item; SESSION 5: Creating Forms and Reports Using Wizard
A report is an object of Open Office Base used for generating printout of records in
organized manner.
Report can group and generate summary of available data in clear format.
CREATING Form using Wizard