GURU NANAK COLLEGE ,BUDHLADA SESSION: 2018-19Assignment of : JAVA PROGRAMMING Topic : IntegritySubmitted To: Submitted By:Prof. Rekha Kalra Manpreet Kaur MCA(LE)-2 INTEGRITYIntegrity means that uniformity and uniformitarianism.DATA INTEGRITY : Data integrity word is a combination of two words: DATA + INTEGRITY = DATA INTEGRITY.1.DATA: Facts and statistics which are collected together for the reference and also for the analysis.
Data are the things considers as facts which make the basis of calculation.2.INTEGRITY: Integrity means wholeness,unification,unity,coherence,solidarity,cohesion.
Integrity is a state of being whole and undivided.’so data integrity refers that the data has to be complete and correct.In other words we can say that data integrity refers to the completeness , correctness and uniformity of the data.When our data is complete and correct ,then it become consistent data.In other words, when data has two factors , completeness and correctness then that data is said to be consistent data.Consistent data is that data which is when processed always return the required results and no inconsistencies are generated and not any type of error is prodused/occured.
When our data is not complete and not correct then during processing many inconsistencies occur and many types of errors are generated ,which always causes the unrequired and incorrect results.NOW WE WILL DISCUSS DATA INTEGRITY IN THE DATABASE:To maintain the integrity of the database it is required that we should always enter the correct and the complete information in the database’s tables’ field’s cells.Let us consider as an example a DATABASE’S TABLE: STUDENT RECORDROLL NO. NAME CLASS PH. NO.
AGE1967 Manpreet MCA-2 9080706050 191972 Satnam MCA-2 9181716151 191973 Hardeep MCA-2 9282726252 201974 Manwinder MCA-2 9383736353 201975 Shifali MCA-2 9484746454 191977 Bharti MCA-2 9989796959 23In the above table the information that is provided is complete and correct and consistent, so this information ,entered in the table maintain the integrity of the database.CASE-1:ROLL NO. NAME CLASS PH.
NO AGE1967 Manpreet MCA-2 9080706050 -19Though -19 is a valid number ,but it is not a valid age. So’ to maintain the integrity of the database these incorrect,invalid values are restricted to be entered in the database.CASE-2:ROLL NO. NAME CLASS PH. NO. AGEHardeep MCA-2 9988776655 20To maintain the integrity of the database , it is needed that the data that is entered into the database must be complete.
CASE-3:ROLL NO. NAME CLASS PH. NO. AGE1967 MANPREET MCA2,MBA-2 9987765432 19This entry is incorrect because a student has not to be in two master degrees at the same time.so to maintain the integrity these entries are restricted.
CASE-4:ROLL NO. NAME CLASS PH.NO. AGE1967 MANPREET MCA-2 9988776655 191967 SATNAM MCA-2 9978563412 19This entry is also incorrect because not two students have the same rollno.
CASE-5:Let us take two tables of database :One is STUDENT RECORD and the second one is STUDENT FEE RECORD: STUDENT RECORDROLL NO. NAME CLASS CITY1967 manpreet MCA-2 Budhlada1968 bharti MCA-2 Boha1969 shifali MCA-2 Mansa STUDENT FEE RECORD ROLL NO. NAME CLASS CITY TOTAL FEE1967 Manpreet MCA-2 Bathinda 500001968 Rajni MCA-2 Boha 500001969 Shifali BCA-2 mansa 50000There are inconsistencies in the entries . so to maintain the integrity these entries must be restricted.So from the above cases we clearly understood that to maintain the integrity of the database ,the data entered into the database must be complete ,consistent and correct.Therefore data integrity means that data is reliable and trustable.
When in database our data is consistent,correct,complete then ,when we process that data we get the required results so we can say that data in the database is trustable, which is essential to maintain the integrity of the database.Integrity is a another form of data protection. In this case we restrict that only correct nad complete records are entered into the database. In this way , data protection is achieved in logical means.Integrity also concerned with the quality of the data.To maintain the integrity of the database some rules are used called consistency constraints.These rules act as a filter that purify the data that, we want to enter into the database.
These rules checks whether the data entered into the database is valid or not,complete or not.These rules are implemented by the DBMS.Two types of integrity constraints are available:First one is ENTITY INTEGRITYAnd the second one is REFERENTIAL INTEGRITY.1.ENTITY INTEGRITY:We also called entity integrity ,is a record integrity because it checks a tables’s individual record for its completeness and correctness.Entity integrity rules are applied to the primary key of the table.
When we set the primary key of the table , then automatically entity integrity rules are applied. One condition is that primary key attribute does not have null or duplicate value.For example consider a STUDENT RECORD TABLE: STUDENT RECORD TABLEROLL NO.(P.K.
) NAME CLASS1967(must not be MANPREET MCA-21967 duplicate) Parmeet MCA-21968 Sandeep MCA-2Not null Nitika MCA-22 REFERENTIAL INTEGRITY: Referential integrity rules are applied on the foreign key. Referential integrity can be achieved by specifying the relationship between two tables and this is achieved by using the foreign key. When we enforce the referential integrity constraints :In this case:1.Records are entered into the parent table first.
2.Records are deleted from the child table first.It is the requirement of the referential integrity constraints that the foreign key has the same name and same data type as the primary key has in the parent table.
For example consider two tables One is PARENT TABLE and the second one is CHILD TABLE. PARENT TABLE(STUDENT NAME RECORD)ID(Primary key) NAME1000 Manwinder1001 Prabjot1002 Kanchan1003 SimranCHILD TABLE( STUDENT PHONE NUMBER RECORD)ID (Foreign Key) PHONE NUMBER1000 99887766551001 98765432121002 98675423211003 89674523541004(not inserted) 9087654321Referential integrity ensures that data entered into the child table and also into the parent table is always consistent.