0% found this document useful (0 votes)
25 views12 pages

DBMS Notes Class 10

The document provides an overview of Database Management Systems (DBMS), including definitions, types, advantages, and key concepts such as database objects, constraints, keys, and relationships. It also covers SQL commands, including Data Definition Language (DDL) and Data Manipulation Language (DML), with examples of syntax for various operations. Additionally, it includes exercises to apply SQL commands in practical scenarios.

Uploaded by

henajha33
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)
25 views12 pages

DBMS Notes Class 10

The document provides an overview of Database Management Systems (DBMS), including definitions, types, advantages, and key concepts such as database objects, constraints, keys, and relationships. It also covers SQL commands, including Data Definition Language (DDL) and Data Manipulation Language (DML), with examples of syntax for various operations. Additionally, it includes exercises to apply SQL commands in practical scenarios.

Uploaded by

henajha33
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/ 12

DBMS

Content:

1. What is a Database?
2. What is DBMS? Types of DBMS.
3. Advantages of DBMS
4. Database objects
5. Terminologies related to DBMS
a. Cardinality
b. Degree
c. Queries
d. Forms and Reports
e. Constraints
6. Types of Constraints
a. Default
b.Not null
c. Check
d.Unique
e. Keys
7. Types of Keys
a. Primary keys
b. Foreign keys
c. Alternate keys
d. Candidate keys
e. Composite keys
8. Relationship
9. Datatypes

1
10. SQL
11. Types of SQL Queries
12. DDL
a. Create
b. Alter
c. Drop
13. DML (important)
a. Select
b. Insert
c. Delete
d. Update

2
1. What is a Database?
Database is an organised collection of inter-related
data.

2. What is DBMS?
DBMS it stands for database management system, it is
an electronic book record keeping system, that is used
to store, retrieve, update and delete data digitally.

Types of DBMS:
1. Flat-file databases: it is a database that stores data in
plain text, in single table format which is easily
readable. Example: MS-Excel
2. RDBMS (Relational Database Management System):
it is a database that stores data in multiple tables and
the tables are linked using common fields. Example:
My-SQL, MS-Access etc.

Advantages of Databases:
 Reduces Redundancy
 Reduces Inconsistency
 Data Security
 Data Integrity
 Backup and Security

3
Database Objects:
Tables: table are also known as relation, it is a type of
data structure, which is used to store data in rows and
columns.

Rows/Records/Tuples: a row is also known as records


or tuples; in a table it represents a data set.

Columns/Fields/Attribute: a column is also known as


fields or records; in table it is used to store only type of
data.

Terminology:
a. Cardinality: the number of Rows/Records/Tuples in
a table is called cardinality.
b. Degree: the number of Columns/Fields/Attribute in
a table is called degree.
c. Queries: it is a question or inquiry about a set of
data, which is retrieved using SQL
d. Forms: Forms are objects in OpenOffice Base that
is used to enter data graphically in OpenOffice
Base.
e. Reports: Reports are objects in OpenOffice Base
that help generate and print the tables in
OpenOffice Base.
f. Constraints: Constraints are rules or conditions
that are applied to the data within a database to
ensure data integrity and consistency.

4
Types of constraints:
i. Default: it set a condition on the column if no
data is entered, it will accept a default value for
that field.
ii. Not null: this condition implies that no field are
left empty by the user.
iii. Check: used to ensure the validity of data in a
database and to provide data integrity
iv. Unique: this condition ensures that the value
entered in the column is not duplicate.
v. Keys: Key constraints in DBMS are set of rules
that are defined for primary key.

Types of Keys:
1. Primary keys: A primary key is a constraint which
uniquely identifies each record in a table. It can
be only one in each table.
2. Foreign keys: A foreign key establishes a
relationship between tables by referencing the
primary key of another table.
3. Alternate keys: Alternate key is also unique in
nature and is capable of identifying each record
in a table.
4. Candidate keys: a set of one or more columns
which can uniquely identify records in a table. A
table can have multiple candidate key but only
one primary key.

5
5. Composite keys: A key which contains more than
one column/field together that can uniquely
identify a row in a table is called composite key.

Relationships:
A pair of primary key and foreign key is required to
create a relationship between tables.

Types of relationships:
1. one-to-one
2. many-to-many
3. many-to-one or one-to-many

Referential integrity is a data quality concept that


ensures that when you make changes to data in one
place, those changes are reflected in other related
records.

Data Types: the type of information that is to be stored


in a table is defined by it datatype.

In OpenOffice Base, data is classified into five


categories:
1. Numeric datatypes
2. Alpha-numeric datatypes
3. Boolean datatype
4. Data time
5. Other variable datatypes

6
Numeric Datatypes: It helps store numeric values in a
database. Some of the numeric datatypes are:

Alpha-numeric Datatypes: It helps store both alphabets


and numbers in a database. Some of the alpha-numeric
datatypes are:

Binary Datatype: It is helps store data in binary format.


Binary data can store audio, video and image files.

7
Date time: when we have to specify date and time as
data in a column then date time datatype is used.

8
SQL – Structured Query Language

SQL is a standard language used to access and


manipulate databases.

Types of SQL commands:


 DDL (Data Definition Language)
 DML (Data Manipulation Language)
 TCL (Transaction Control Language)

1. DDL (data definition language): This command helps


user to create and modify structure of the database
and tables.
a. Create command: it is used to create databases
and structure of the table.
 Syntax for creating a database;
create database <name of the database>;
 Syntax for creating a table;
create table <table name>
(column1 datatype, column2 datatype);

b. Alter command: it is used to modify the structure


of the table, it can be used to add, delete column
and change their datatypes.
 Syntax to add a column in the table
Alter <table name> add column datatype;
 Syntax to delete a
Alter <table name> drop column;

9
 Syntax to change datatype of a column
Alter <table name> modify column datatype;

c. Drop command: it is used to delete the database


objects.
 Syntax to delete a table
Drop table <table name>

2. DML (data manipulation language): This command


helps user to retrieve, add, update and delete data in a
table.
a. Select command: this command is used to retrieve
data from the table.
 Syntax to select all the data in a table
Select * from <table name>;
 Syntax to select specific column
Select column1, column2 from <table name>;
Clauses used with Select command:
 Where: where clause is used to generate
complex queries.
Select * from <table name> where condition;
 Order By: order by clause is used to arrange
data in ascending or descending order based
on the column.
Select * from <table name> order by column;

b. Insert command: this command is used to insert


data in the tables.

10
 Syntax to insert data in a table
Insert into <table name> values (column1,
column2);
c. Update command: this command is used to update
data in the tables.
 Syntax to update data
Update <table name> set column value where
condition

d. Delete command: this command is used to delete


data in the tables.
 Syntax to delete data in a table
Delete from <table name> where condition;

11
Exercises:
Question 1. Artists

Id Name Music Ratings Genre


1 Akon Beautiful 80 Pop
2 Bruno Mars Grenade 87 Jazz
3 Eminem Kill shot 97 Rap
5 Imagine Dragons Bones 97 Pop
6 Linkin Park In The End 100 Pop

Write the SQL commands:

1. Display the records of artists where rating is greater than 90.


2. Update the column music = Rap god where name is Eminem.
3. Insert into table the following record (4, “Maroon5”, “Animal”, 92, “Thriller”)
4. Delete the records with the rating less than 80.

Question 2. Employee

Emp_id Name Department Age Salary


1 Ramesh Operations 30 30000
2 Suresh It 32 38000
3 Arvind Sales 35 35000
4 Shikha HR 27 35000
5 Ram Operations 28 40000
6 Ashish Admin 40 50000
7 Aatish Sale 37 42000
8 Raj It 28 35000

Write the SQL commands:

1. Display the records of all the employees where age is less than 35.
2. Update salary by 5000 where department is IT.
3. Insert a record in the table with the following information.
(9, “Rashmi” ,”HR”, 25, 28000)
4. Delete the record where department is admin.

12

You might also like