A database schema is the skeleton structure that represents the logical view of the entire database.Constraints are the rules enforced on the data columns of a table. These are used to limit the type of data that can go into a table
2. DATABASE SCHEMA
A database schema is the selection structure that represent the logical view of the entire
database.
It define how the data is organized and how the relation among item are associated is
formulated all the constraints that are to be applied on the data.
A database schema it’s a entity and the relationship among them it contain a descriptive
details of the database which can be represented by the schema diagram.
3. SHOW IN FIGURE DATABASE SCHEMA
It is a database designs who design the schema to help programmers
understand the database is useful.
___________________________________________
______
Database Schema
View 1 View2 View3
Std_Id Std_Name Std_Add
Physical
Schema
4. DATABASE SCHEMA CAN BE DIVIDED INTO TWO TYPE
Logical Database Schema:-
Physical Database Schema:-
5. LOGICAL DATABASE SCHEMA
This schema defines all the logical constrains that need to be applied on the data store.
It defines table view and constraints logical schema is data model of a specific problem
domain expressed independtly of a particular database management product or storage
technology(physical schema)but in terms of data structure such as a realational table and
column object oriented classes.
6. PHYSICAL DATABASE SCHEMA
Physical database schema is representation of data design as implemented or intended to
be implemented in database management system.
Physical schema data model to calculate storage allocation details for a given database
system.
7. CONSTRAINTS
In DBMS constraints are imposed on every realation (table) to ensure that only correct
and accepted value are inserted into table. These are used to limit the type of data that can
go into a table.
Constraints could be table column level are table row level.
Column table constraints are applied only to 1 column where as a table level constraints
are applied to the whole table.
8. EXAMPLE OF CONSTRAINTS
ID Name Class Contact_no
1 Dipa BCS fy 956238412
2 Rupa BBA 7845126359
3 Vaishu BCS 7458923612
4 Sonu BBA 8486825476
5 Renu BCA 8795412386S
9. THERE ARE THREE TYPE OF INTEGRITY CONSTRAINTS
Domain Constraints
Entity Integrity Constraints
Referential Entity Integrity Constrains
10. INTEGRITY CONSTRAINTS
Integrity constraints maintain security and integrity of the database is the most important
factor of a system.
Integrity Constraints is a mechanism use to present invalid data entire into table.
Integrity Constraints ensure that changes make to the database authorized user is not in a
loss of data consistency.
For Example
Account balance cannot be null.
11. DOMAIN CONSTRAINTS
The Condition of Restriction associated with a particular domain (column)
Create Person Table
{
In int Not Null
Name varchar(15) Not Null
Age int
};
12. EXAMPLE OF DOMAIN CONSTRAINTS
Data type Integer ,Character , Float.
Domain Name Domain Constraints
ID Data type Not Null
Name Data type Maximum Character Not Null
Age Data type is null value allowed
13. ENTITY INTEGRITY CONSTRAINTS( PRIMARY KEY)
A primary key is a field in a table which uniquely identify each row column in database.
A primary key must be contained unique value.
A primary key column cannot have null value.
A table can have only one primary key which may consider of single as multiple filed.
14. EXAMPLE OF INTEGRITY CONSTRAINTS
Create table Student
{
ID int NOT Null primary key
name Varchar(20) not null
Contact int
};
16. DELETE PRIMARY KEY
You can clear in our student table if we want to delete a single record we can use
where clause to provide a condition in our delete statement.
Delete from student where S_ID
Stud_Name Stud_ Contact
Savita 7899066556
Kavita 9876457832
Anita 7876543789
Rita 7543858682
17. REFERENTIAL ENTITY INTEGRITY CONSTRAINT( FOREIGN KEY)
A foreign key is a key use to a link two table.
This sometimes called as a reference key and foreign key is a column or a combination
of a column whose value match a primary key in a different table.
The Relationship between two tables matches the primary key is one of the table with a
foreign key in a second table.
If a table has a primary key define and any field then you can not have to record having
same value of that field.
18. EXAMPLE FOR REFERENTIAL ENTITY INTEGRITY CONSTRAINTS
Example :- Consider the table for Student Admission
Foreign
Key using
In next
table
Table for
Hostel
Roll_No Course Course Address
1 Sandeep BCA N3
2 Swapnil BBA N8
3 Anju BCA N6
4 Renu BCS N12
Roll_No Hostel Room No
1 111
2 112
3 113
4 114