SlideShare a Scribd company logo
3
Most read
10
Most read
Database Management
Class XII
Computer Science/IP
What is Database?
 A database (DB)is an organized collection of data. More specifically, a
database is an electronic system that allows data to be easily accessed,
manipulated and updated.
 In other words, a database is used by an organization as a method of storing,
managing and retrieving information. Modern databases are managed using a
database management system (DBMS).
Need of database systems:
 Database systems reduce data redundancy to large extent.
 Database systems reduce data inconsistency to large extent.
 Databases facilitate sharing of data.
 Centralized databases can ensure data security.
 Integrity can be maintained through databases
Relational data Model
 A Data models define how the logical
structure of a database is modeled.
Data models define how data is
connected to each other and how they
are processed and stored inside the
system.
 Relational data Model-Relational Model
is the most widely used model. In this
model, the data is maintained in the
form of a two-dimensional table. All
the information is stored in the form of
row and columns. The basic structure
of a relational model is tables. So, the
tables are also called relations in the
relational model. Example: In this
example, we have a student table.
Terms used in Relational Model
 Attribute: Each column in a Table. Attributes are
the properties which define a relation. e.g.,
Student_Rollno, NAME,etc.
 Relation– In the Relational model the, relations
are saved in the table format. It is stored along
with its entities. A table has two properties rows
and columns. Rows represent records and
columns represent attributes.
 Tuple – It is nothing but a single row of a table,
which contains a single record.
 Degree: The total number of attributes which in
the relation is called the degree of the relation.
 Cardinality: Total number of rows present in the
Table.
Terminologies:
 Keys -help you to identify any row of data in a table. In a real-world application, a
table could contain thousands of records. Moreover, the records could be duplicated.
Keys ensure that you can uniquely identify a table record despite these challenges.
 PRIMARY KEY is a column or group of columns in a table that uniquely identify every
row in that table. The Primary Key can't be a duplicate meaning the same value can't
appear more than once in the table. A table cannot have more than one primary key
 CANDIDATE KEY is a set of attributes that uniquely identify tuples in a table.
Candidate Key is a super key with no repeated attributes. The Primary key should be
selected from the candidate keys. Every table must have at least a single candidate
key. A table can have multiple candidate keys but only a single primary key.
 ALTERNATE KEYS is a column or group of columns in a table that uniquely identify
every row in that table. A table can have multiple choices for a primary key but only
one can be set as the primary key. All the keys which are not primary key are called an
Alternate Key.
DATABASE CONCEPTS AND PRACTICAL EXAMPLES
Foreign Key
 Foreign keys are the columns of a table that points to the primary key of
another table. They act as a cross-reference between tables.
 In next slide stud_id in course table is foreign key as it point out the primary
key of student table
Example of Foreign key
Course_Id Stu_Id
C01 101
C02 102
C03 101
C05 102
C06 103
C07 102
Stu_Id Stu_Name Stu_Age
101 Chaitanya 22
102 Arya 26
103 Bran 25
104 Jon 21
Foreign key
Referential Integrity
 A referential integrity constraint is
specified between two tables. It
states that table relationships must
always be consistent. In other words,
any foreign key field must agree with
the primary key that is referenced by
the foreign key. Thus, any primary
key field changes must be applied to
all foreign keys, or not at all.
 In the Referential integrity
constraints, if a foreign key in Table
1 refers to the Primary Key of Table
2, then every value of the Foreign
Key in Table 1 must be null or be
available in Table 2.
MySQL
 MySQL is the world's most popular open source database. With its proven
performance, reliability and ease-of-use, MySQL has become the leading
database choice for web-based applications, used by high profile web
properties including Facebook, Twitter, YouTube, Yahoo! and many more.
 SQL is used in the accessing, updating, and manipulation of data in a
database. Its design allows for the management of data in an RDBMS,
such as MYSQL. SQL language also used for controlling data access
 SQL provide many different types of command used for different
purposes. SQL commands can be divided into following category:
 DDL
 DML
 TCL
Category of SQL command
 DDL is abbreviation of Data Definition Language. It is used to create
and modify the structure of database objects in database.
CREATE – Creates objects in the database
ALTER – Alters objects of the database
DROP – Deletes objects of the database
TRUNCATE – Deletes all records from a table and resets table identity to initial value.
 DML is abbreviation of Data Manipulation Language. It is used to
retrieve, store, modify, delete, insert and update data in database.
SELECT – Retrieves data from a table
INSERT – Inserts data into a table
UPDATE – Updates existing data into a table
DELETE – Deletes all records from a table
Data types in SQL
DATA TYPE FROM TO
bigint -
9,223,372,036,854,77
5,808
9,223,372,036,854,77
5,807
int -2,147,483,648 2,147,483,647
smallint -32,768 32,767
decimal -10^38 +1 10^38 -1
numeric -10^38 +1 10^38 -1
date Stores a date like June 30, 1991
Char Fixed length string
varchar Variable length string

More Related Content

PPTX
Business models emerging in e commerce area
PPTX
Advantages and disadvantages of relational databases
PDF
Usuarios y administrador de bases de datos
PPTX
STRUCTURE OF SQL QUERIES
PPT
Unit01 dbms
PPTX
Introduction to Database, Purpose of Data, Data models, Components of Database
PPTX
Database Languages.pptx
PDF
Patrones de comportamiento iterator, strategy, command, observer y visitor
Business models emerging in e commerce area
Advantages and disadvantages of relational databases
Usuarios y administrador de bases de datos
STRUCTURE OF SQL QUERIES
Unit01 dbms
Introduction to Database, Purpose of Data, Data models, Components of Database
Database Languages.pptx
Patrones de comportamiento iterator, strategy, command, observer y visitor

What's hot (10)

PPTX
Dbms and rdbms
PPT
Using SQL Queries to Insert, Update, Delete, and View Data.ppt
PPTX
Online Bus Ticketing System
PPT
Atm Simulator
PPSX
EER Model
PPTX
Anti patrones SQL, Modelo conceptual
DOCX
proyecto final de analisis y diseño sesion5.docx
PDF
Html notes
PDF
Data Base Management System.pdf
Dbms and rdbms
Using SQL Queries to Insert, Update, Delete, and View Data.ppt
Online Bus Ticketing System
Atm Simulator
EER Model
Anti patrones SQL, Modelo conceptual
proyecto final de analisis y diseño sesion5.docx
Html notes
Data Base Management System.pdf
Ad

Similar to DATABASE CONCEPTS AND PRACTICAL EXAMPLES (20)

PDF
Relational database management system
PPTX
IP-Lesson_Planning(Unit4 - Database concepts and SQL).pptx
PPTX
Quick Revision on DATA BASE MANAGEMENT SYSTEMS concepts.pptx
PPTX
database concepts.pptx
PPTX
Database Concepts.pptx
PPTX
Relational Database.pptx
PPTX
Unit 10 - Realtional Databases.pptxxxxxxxxx
PPTX
SQL things ace series of the thing useful
PDF
DATA MANAGEMENT computer science class 12 unit - 3 notes.pdf
PPTX
PPT_DBMS.pptx
DOCX
COMPUTERS Database
PDF
sql_data.pdf
PPTX
chapter_2_-_midterm__aik__daatabase.pptx
PDF
Introduction to Database Management Systems: Structure, Applications, and Key...
PPTX
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
PPTX
DATABASE-1.pptx
PPTX
DBMS (1).pptx
PPTX
DEE 431 Database keys and Normalisation Slide 2
PPT
PPTX
Lecture 2 - Database Management System.pptx
Relational database management system
IP-Lesson_Planning(Unit4 - Database concepts and SQL).pptx
Quick Revision on DATA BASE MANAGEMENT SYSTEMS concepts.pptx
database concepts.pptx
Database Concepts.pptx
Relational Database.pptx
Unit 10 - Realtional Databases.pptxxxxxxxxx
SQL things ace series of the thing useful
DATA MANAGEMENT computer science class 12 unit - 3 notes.pdf
PPT_DBMS.pptx
COMPUTERS Database
sql_data.pdf
chapter_2_-_midterm__aik__daatabase.pptx
Introduction to Database Management Systems: Structure, Applications, and Key...
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE-1.pptx
DBMS (1).pptx
DEE 431 Database keys and Normalisation Slide 2
Lecture 2 - Database Management System.pptx
Ad

Recently uploaded (20)

PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
English Language Teaching from Post-.pdf
PDF
The Final Stretch: How to Release a Game and Not Die in the Process.
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Pre independence Education in Inndia.pdf
PPTX
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
PDF
Insiders guide to clinical Medicine.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PPTX
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Week 4 Term 3 Study Techniques revisited.pptx
English Language Teaching from Post-.pdf
The Final Stretch: How to Release a Game and Not Die in the Process.
Cardiovascular Pharmacology for pharmacy students.pptx
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Pre independence Education in Inndia.pdf
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
UPPER GASTRO INTESTINAL DISORDER.docx
Insiders guide to clinical Medicine.pdf
O7-L3 Supply Chain Operations - ICLT Program
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
How to Manage Starshipit in Odoo 18 - Odoo Slides
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
Open Quiz Monsoon Mind Game Final Set.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...

DATABASE CONCEPTS AND PRACTICAL EXAMPLES

  • 2. What is Database?  A database (DB)is an organized collection of data. More specifically, a database is an electronic system that allows data to be easily accessed, manipulated and updated.  In other words, a database is used by an organization as a method of storing, managing and retrieving information. Modern databases are managed using a database management system (DBMS).
  • 3. Need of database systems:  Database systems reduce data redundancy to large extent.  Database systems reduce data inconsistency to large extent.  Databases facilitate sharing of data.  Centralized databases can ensure data security.  Integrity can be maintained through databases
  • 4. Relational data Model  A Data models define how the logical structure of a database is modeled. Data models define how data is connected to each other and how they are processed and stored inside the system.  Relational data Model-Relational Model is the most widely used model. In this model, the data is maintained in the form of a two-dimensional table. All the information is stored in the form of row and columns. The basic structure of a relational model is tables. So, the tables are also called relations in the relational model. Example: In this example, we have a student table.
  • 5. Terms used in Relational Model  Attribute: Each column in a Table. Attributes are the properties which define a relation. e.g., Student_Rollno, NAME,etc.  Relation– In the Relational model the, relations are saved in the table format. It is stored along with its entities. A table has two properties rows and columns. Rows represent records and columns represent attributes.  Tuple – It is nothing but a single row of a table, which contains a single record.  Degree: The total number of attributes which in the relation is called the degree of the relation.  Cardinality: Total number of rows present in the Table.
  • 6. Terminologies:  Keys -help you to identify any row of data in a table. In a real-world application, a table could contain thousands of records. Moreover, the records could be duplicated. Keys ensure that you can uniquely identify a table record despite these challenges.  PRIMARY KEY is a column or group of columns in a table that uniquely identify every row in that table. The Primary Key can't be a duplicate meaning the same value can't appear more than once in the table. A table cannot have more than one primary key  CANDIDATE KEY is a set of attributes that uniquely identify tuples in a table. Candidate Key is a super key with no repeated attributes. The Primary key should be selected from the candidate keys. Every table must have at least a single candidate key. A table can have multiple candidate keys but only a single primary key.  ALTERNATE KEYS is a column or group of columns in a table that uniquely identify every row in that table. A table can have multiple choices for a primary key but only one can be set as the primary key. All the keys which are not primary key are called an Alternate Key.
  • 8. Foreign Key  Foreign keys are the columns of a table that points to the primary key of another table. They act as a cross-reference between tables.  In next slide stud_id in course table is foreign key as it point out the primary key of student table
  • 9. Example of Foreign key Course_Id Stu_Id C01 101 C02 102 C03 101 C05 102 C06 103 C07 102 Stu_Id Stu_Name Stu_Age 101 Chaitanya 22 102 Arya 26 103 Bran 25 104 Jon 21 Foreign key
  • 10. Referential Integrity  A referential integrity constraint is specified between two tables. It states that table relationships must always be consistent. In other words, any foreign key field must agree with the primary key that is referenced by the foreign key. Thus, any primary key field changes must be applied to all foreign keys, or not at all.  In the Referential integrity constraints, if a foreign key in Table 1 refers to the Primary Key of Table 2, then every value of the Foreign Key in Table 1 must be null or be available in Table 2.
  • 11. MySQL  MySQL is the world's most popular open source database. With its proven performance, reliability and ease-of-use, MySQL has become the leading database choice for web-based applications, used by high profile web properties including Facebook, Twitter, YouTube, Yahoo! and many more.  SQL is used in the accessing, updating, and manipulation of data in a database. Its design allows for the management of data in an RDBMS, such as MYSQL. SQL language also used for controlling data access  SQL provide many different types of command used for different purposes. SQL commands can be divided into following category:  DDL  DML  TCL
  • 12. Category of SQL command  DDL is abbreviation of Data Definition Language. It is used to create and modify the structure of database objects in database. CREATE – Creates objects in the database ALTER – Alters objects of the database DROP – Deletes objects of the database TRUNCATE – Deletes all records from a table and resets table identity to initial value.  DML is abbreviation of Data Manipulation Language. It is used to retrieve, store, modify, delete, insert and update data in database. SELECT – Retrieves data from a table INSERT – Inserts data into a table UPDATE – Updates existing data into a table DELETE – Deletes all records from a table
  • 13. Data types in SQL DATA TYPE FROM TO bigint - 9,223,372,036,854,77 5,808 9,223,372,036,854,77 5,807 int -2,147,483,648 2,147,483,647 smallint -32,768 32,767 decimal -10^38 +1 10^38 -1 numeric -10^38 +1 10^38 -1 date Stores a date like June 30, 1991 Char Fixed length string varchar Variable length string