{"id":3243,"date":"2023-10-04T13:18:23","date_gmt":"2023-10-04T13:18:23","guid":{"rendered":"http:\/\/localhost\/ecole9ja\/?p=3243"},"modified":"2023-10-04T13:25:59","modified_gmt":"2023-10-04T13:25:59","slug":"week-3-and-4-ss2-second-term-data-processing-notes","status":"publish","type":"post","link":"https:\/\/ecolebooks.com\/nigeria\/posts\/week-3-and-4-ss2-second-term-data-processing-notes\/","title":{"rendered":"Week 3 and 4 &#8211; SS2 Second Term Data Processing Notes"},"content":{"rendered":"<p>\u00a0<strong>WEEK : 3-4\u00a0\u00a0\u00a0\u00a0<br \/>\n<\/strong><strong>TOPIC: Relational Database- Integrity Constraints<br \/>\n<\/strong><strong>CONTENT<br \/>\n\t\t<\/strong><strong>RELATIONAL MODEL &#8212; Integrity Constraints<br \/>\n<\/strong>\u00a0<br \/>\n\u00a0<strong>Integrity Constraints over Relations<\/strong><br \/>\n\t\t\tAn <strong>integrity constraint <\/strong>(<strong>IC<\/strong>) is a condition specified on a database schema and restricts the data that can be stored in an instance of the database. If a database instance satisfies all the integrity constraints specifies on the database schema, it is a <strong>legal <\/strong>instance. A DBMS permits only legal instances to be stored in the database.<br \/>\nMany kinds of integrity constraints can be specified in the relational model:<br \/>\nDatabase integrity refers to the validity and consistency of stored data. <em>Integrity is usually expressed in terms of constraints, which are consistency rules that the database is not permitted to violate.<br \/>\n<\/em><br \/>\n\u00a0 Constraints may apply to each attribute or they may apply to relationships between tables.<br \/>\nIntegrity constraints ensure that changes (update deletion, insertion) made to the database by authorized users do not result in a loss of data consistency. Thus, integrity constraints guard against accidental damage to the database.<\/p>\n<p>\u00a0EXAMPLE-\u00a0A brood group must be &#8216;A&#8217; or &#8216;B&#8217; or &#8216;AB&#8217; or &#8216;O&#8217; only (can not be any other values else).<\/p>\n<p>\u00a0TYPES OF INTEGRITY CONSTRAINTS<\/p>\n<p>\u00a0<br \/>\n\u00a0<br \/>\n\u00a0Various types of integrity constraints are-<\/p>\n<ol>\n<li>Domain Integrity\n<\/li>\n<li>Entity Integrity Constraint\n<\/li>\n<li>Referential Integrity Constraint\n<\/li>\n<li>Key Constraints\n<\/li>\n<\/ol>\n<p>1. Domain Integrity-\u00a0Domain integrity means the definition of a valid set of values for an attribute. You define\u00a0data type,\u00a0length or size,\u00a0is null value allowed ,\u00a0is the value unique or not for an attribute ,the default value, the range (values in between) and\/or specific values for the attribute.\u00a0<\/p>\n<p>\u00a02. Entity Integrity Constraint- This rule states that in any database relation value of attribute of a primary key can&#8217;t be null.<\/p>\n<p>\u00a0EXAMPLE- Consider a relation &#8220;STUDENT&#8221; Where &#8220;Stu_id&#8221; is a primary key and it must not contain any null value whereas other attributes may contain null value e.g \u00a0&#8220;Branch&#8221; in the following relation contains one null value.<\/p>\n<p>\u00a0<br \/>\n\u00a0<\/p>\n<div>\n<table>\n<tbody>\n<tr>\n<td>Stu_id<\/td>\n<td>Name<\/td>\n<td>Branch<\/td>\n<\/tr>\n<tr>\n<td>11255234<\/td>\n<td>Aman<\/td>\n<td>CSE<\/td>\n<\/tr>\n<tr>\n<td>11255369<\/td>\n<td>Kapil<\/td>\n<td>ECE<\/td>\n<\/tr>\n<tr>\n<td>11255324<\/td>\n<td>Ajay<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td>11255237<\/td>\n<td>Raman<\/td>\n<td>CSE<\/td>\n<\/tr>\n<tr>\n<td>11255678<\/td>\n<td>Aastha<\/td>\n<td>ECE<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u00a03.Referential Integrity Constraint-It states that if a foreign key exists in a relation then either the foreign key value must match a primary key value of some tuple in its home relation or the foreign key value must be null.<\/p>\n<p>\u00a04.Key Constraints-\u00a0A\u00a0Key Constraint\u00a0is a statement\/condition that a certain\u00a0minimal\u00a0subset of the fields of a relation is a unique identifier for a tuple.<br \/>\nThere are 4 types of \u00a0key constraints-<\/p>\n<ol>\n<li>Candidate key.\n<\/li>\n<li>Super key\n<\/li>\n<li>Primary key\n<\/li>\n<li>Foreign key\n<\/li>\n<\/ol>\n<p>\u00a0<br \/>\n\u00a0\u00a0<br \/>\n\u00a0<br \/>\n\u00a0<br \/>\n\u00a0<br \/>\n\u00a0<br \/>\n\t\t\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0WEEK : 3-4\u00a0\u00a0\u00a0\u00a0 TOPIC: Relational Database- Integrity Constraints CONTENT RELATIONAL MODEL &#8212; Integrity Constraints \u00a0&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,259],"tags":[],"class_list":["post-3243","post","type-post","status-publish","format-standard","hentry","category-posts","category-second-term-ss2-data-processing"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ecolebooks.com\/nigeria\/wp-json\/wp\/v2\/posts\/3243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ecolebooks.com\/nigeria\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ecolebooks.com\/nigeria\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ecolebooks.com\/nigeria\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ecolebooks.com\/nigeria\/wp-json\/wp\/v2\/comments?post=3243"}],"version-history":[{"count":1,"href":"https:\/\/ecolebooks.com\/nigeria\/wp-json\/wp\/v2\/posts\/3243\/revisions"}],"predecessor-version":[{"id":3244,"href":"https:\/\/ecolebooks.com\/nigeria\/wp-json\/wp\/v2\/posts\/3243\/revisions\/3244"}],"wp:attachment":[{"href":"https:\/\/ecolebooks.com\/nigeria\/wp-json\/wp\/v2\/media?parent=3243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ecolebooks.com\/nigeria\/wp-json\/wp\/v2\/categories?post=3243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ecolebooks.com\/nigeria\/wp-json\/wp\/v2\/tags?post=3243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}