Domain Constraints: Domain of possible values must be associated with every attribute. Domains could be specified as below:

Size: px
Start display at page:

Download "Domain Constraints: Domain of possible values must be associated with every attribute. Domains could be specified as below:"

Transcription

1 UNIT III Integrity and Security: Domain Constraints Referential Integrity Assertions Triggers Security and Authorization Authorization in SQL.Relational-Database Design: Normalization -First Normal Form, Second Normal Form, Third Normal Form, Boyce-Codd Normal Form. Integrity and Security Integrity constraints provide a means of ensuring that changes 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 data base. These constraints are in the forms: Key declarations: stipulation (condition) that certain attributes form a candidate key for a given entity set. The set of legal insertions and updates is constrained to those that do not create two entities with the same value on a candidate key. Form of a relationship: many- to- many, one- to- many, one to one. A one-to-one or one to-many relationship restricts the set of legal relationships among entities of a collection of entity sets. Domain Constraints Referential Integrity Assertions Triggers Security Authorization Authorization in SQL Domain Constraints: Domain of possible values must be associated with every attribute. Domains could be specified as below: create DOMAIN NAME1 CHAR(10) create DOMAIN STUNO INTEGER create DOMAIN NAME2 CHAR(10) etc. Note that NAME1 and NAME2 are both character strings of length 10 but they now belong to different (semantic) domains. It is important to denote different domains too Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 1

2 (a) Constrain unions, intersections, differences, and equi joins of relations. (b) Let the system check if two occurrences of the same database value denote the same real world object. The constraint on union-compatibility and join-compatibility is important so that only those operations that make sense are permitted. For example, a join on class number and student number would make no sense even if both attributes are integers and the user should not be permitted to carry out such operations (or at least be warned when it is attempted). When Should Constraints Be Checked? Usually they are checked for each modification statement. But sometimes deferred constraint checking is necessary. 1.Domain Constraints Integrity constraints guard against accidental damage to the database, by ensuring that authorized changes to the database do not result in a loss of data consistency. Domain constraints are the most elementary form of integrity constraint. They test values inserted in the database, and test queries to ensure that the comparisons make sense. Number of standard domain types, such as integer types, character types, and date/time types defined in SQL. Domain constraints are the most elementary form of integrity constraint. They are tested easily by the system whenever a new data item is entered into the database. It is possible for several attributes to have the same domain. For example, the attributes customer-name and employee-name might have the same domain: the set of all person names. However, the domains of balance and branch-name certainly ought to be distinct. It is perhaps less clear whether customer-name and branch-name should have the same domain. Find all customers who have the same name as a branch to be a meaningful query. Thus, if we view the database at the conceptual, rather than the physical, level, customer-name and branch-name should have distinct domains. The create domain clause can be used to define new domains. For example, the statements: Values of one domain can be cast (that is, converted) to another domain. If the attribute A or relation r is of type Dollars, we can convert it to Pounds by writing (cast r.a as Pounds) (Should also multiply by the dollar-to-pound conversion-rate) o The check clause in SQL-92 permits domains to be restricted: Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 2

3 Use check clause to ensure that an hourly-wage domain allows only values greater than a specified value. o The domain has a constraint that ensures that the hourly-wage is greater than 4.00 The domain HourlyWage has a constraint that ensures that the hourly wage is greater than The clause constraint wage-value-test is optional, and is used to give the name wagevalue-test to the constraint. The check clause can also be used to restrict a domain to not contain any null values: As another example, the domain can be restricted to contain only a specified set of values by using the in clause: The preceding check conditions can be tested quite easily, when a tuple is inserted or modified. However, in general, the check conditions can be more complex (and harder to check), since subqueries that refer to other relations are permitted in the check condition. For example, this constraint could be specified on the relation deposit: The check condition verifies that the branch-name in each tuple in the deposit relation is actually the name of a branch in the branch relation. Thus, the condition has to be checked not only when a tuple is inserted or modified in deposit, but also when the relation branch changes (in this case, when a tuple is deleted or modified in relation branch). The preceding constraint is actually an example of a class of constraints called referential-integrity constraints. Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 3

4 2.Referential Integrity A referential integrity constraint requires that a foreign key in one relation refers to an actual, existing tuple in another relation. i.e. the value that appears in one relation for a given set( s ) of attributes also appears for certain set of attributes in another relation for ( r ). Primary and candidate keys and foreign keys can be specified as part of the SQL create table statement The primary key clause lists of attributes that comprise the primary key. The unique key clause lists of attributes that comprise a candidate key. The foreign key clause lists the attributes that comprise the foreign key and the name of the relation referenced by the foreign key. By default, a foreign key references the primary key attributes of the referenced table. Example : create table deposit( branch-namechar(15) not null, account-numberchar(10),customer-namechar(20) not null, primary key (account-number, customer-name), foreign key (branch-name) references branch, foreign key (customer-name) references customer). Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 4

5 2.1.Referential Integrity in E-R Model Consider relationship set R between entity sets E1 and E2. The relational schema for R includes the primary keys K1 of E1 and K2 of E2. Then K1 and K2 form foreign keys on the relational schemas for E1 and E2 respectively.. weak entity sets are also a source of referential integrity constraints. For the relation schema for a weak entity set must include the primary key attributes of the entity set on which it depends 2.2.Referential Integrity in SQL SQL supports all four options on deletes and updates Default is NO ACTION ( Action is rejected). CASCADE(Also delete all tuples that refer to deleted tuple). SET NULL/SET DEFAULT(Sets foreign key value of refercing tuple). Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 5

6 Example: create table deposit ( branch-namechar(15) not null, account-numberchar(10), customer-namechar(20) not null, primary key (account-number, customer-name), foreign key (branch-name) references branch, foreign key (customer-name) references customer); 2.3Checking Referential Integrity on Database Modification The following tests must be made in order to preserve the following referential integrity constraint: (r2) K (r1) Insert. If a tuple t2 is inserted into r2, the system must ensure that there is a tuple t1 in r1 such that t1[k] = t2[]. That is t2 [] K (r1) Delete. If a tuple, t1 is deleted from r1, the system must compute the set of tuples in r2 that reference t1: = t1[k] (r2) If this set is not empty either the delete command is rejected as an error, or the tuples that reference t1 must themselves be deleted (cascading deletions are possible). Update. There are two cases: If a tuple t2 is updated in relation r2 and the update modifies values for foreign key, then a test similar to the insert case is made: Let t2 denote the new value of tuple t2. The system must ensure that t2 [] K(r1) Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 6

7 If a tuple t1 is updated in r1, and the update modifies values for the primary key (K), then a test similar to the delete case is made: The system must compute = t1[k] (r2) using the old value of t1 (the value before the update is applied). If this set is not empty 1. the update may be rejected as an error, or 2. the update may be cascaded to the tuples in the set, or 3. the tuples in the set may be deleted. 2.4 Referential Integrity in SQL Primary and candidate keys and foreign keys can be specified as part of the SQL create table statement: The primary key clause of the create table statement includes a list of the attributes that constitute the primary key. The unique clause of the create table statement includes a list of the attributes that constitute a candidate key. The foreign key clause of the create table statement includes both a list of the attributes that constitute the foreign key and the name of the relation referenced by the foreign key. Primary and foreign key declarations using the partial SQL DDL Definition of our bank database shown in fig:6.2 Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 7

8 We can use the following short form as part of an attribute definition to declare that the attribute forms a foreign key: However, a foreign key clause can specify that if a delete or update action on the referenced relation violates the constraint, then, instead of rejecting the action, the system must take steps to change the tuple in the referencing relation to restore the constraint. Consider this definition of an integrity constraint on the relation account: Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 8

9 Because of the clause on delete cascade associated with the foreign-key declaration,if a delete of a tuple in branch results in this referential-integrity constraint being violated,the system does not reject the delete. Instead, the delete cascades to the account relation, deleting the tuple that refers to the branch that was deleted. SQL also allows the foreign keyclause to specify actions other than cascade, if the constraint is violated: The referencing field (here, branch-name) can be set to null (by using set null in place of cascade),or to the default value for the domain (by using set default). Null values complicate the semantics of referential integrity constraints in SQL.Attributes of foreign keys are allowed to be null, provided that they have not otherwise been declared to be non-null. If all the columns of a foreign key are non-null in a given tuple, the usual definition of foreign-key constraints is used for that tuple. Ifany of the foreign-key columns is null, the tuple is defined automatically to satisfy the constraint. SQL also provides constructs that allow you to change the behavior with null values. 3.Assertions An assertion is a predicate expressing a condition that we wish the database always to satisfy. An assertion in SQL takes the form create assertion <assertion-name> check <predicate> When an assertion is made, the system tests it for validity, and tests it again on every update that may violate the assertion o This testing may introduce a significant amount of overhead; hence assertions should be used with great care. Asserting for all X, P(X) is achieved in a round-about fashion using not exists X such that not P(X) Assertions in SQL form: : Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 9

10 Example When an assertion is created, the system tests it for validity. If the assertion is valid,then any future modification to the database is allowed only if it does not cause that assertion to be violated. 4.Triggers A trigger is a statement that is executed automatically by the system as a side effect of a modification to the database. To design a trigger mechanism, we must: Specify when a trigger is to be executed. This is broken up into an event that causes the trigger to be checked and a condition that must be satisfied for trigger execution to proceed. Specify the actions to be taken when the trigger executes. The above model of triggers is referred to as the event-condition-action model for triggers. Trigger Example Suppose that instead of allowing negative account balances, the bank deals with overdrafts by o setting the account balance to zero o creating a loan in the amount of the overdraft o giving this loan a loan number identical to the account number of the overdrawn account The condition for executing the trigger is an update to the account relation that results in a negative balance value. Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 10

11 4.1Need of Triggers Triggers are useful mechanisms for alerting humans or for starting certain tasks automatically when certain conditions are met. As an illustration, suppose that, instead of allowing negative account balances, the bank deals with overdrafts by setting the account balance to zero, and creating a loan in the amount of the overdraft. The bank gives this loan a loan number identical to the account number of the overdrawn account. For this example, the condition for executing the trigger is an update to the account relation that results in a negative balance value. Suppose that Jones withdrawal of some money from an account made the account balance negative. Let t denote the account tuple with a negative balance value. The actions to be taken are: Insert a new tuple s in the loan relation with Insert a new tuple u in the borrower relation with Set t[balance] to Triggers in SQL SQL-based database systems use triggers widely, although before SQL:1999 they were not part of the SQL standard. Unfortunately, each database system implemented its Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 11

12 Centralized actions can be defined using a non declarative approach (writing PL/SQL code) with database triggers. A database trigger is a stored procedure that is fired (implicitly executed) when an INSERT, UPDATE, or DELETE statement is issued against the associated table. Database triggers can be used to customize a database management system: value-based auditing automated data generation the enforcement of complex security checks enforce integrity rules enforce complex business rules For updates, the trigger can specify columns whose update causes the trigger to execute. For instance if the first line of the overdraft trigger were replaced by then the trigger would be executed only on updates to balance; updates to other attributes would not cause it to be executed. Example:1 suppose the value in a phone number field of an inserted tuple is blank, which indicates absence of a phone number. We can define a trigger that replaces the value by the null value. The set statement can be used to carry out such modifications. Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 12

13 Example:2 Returning to our warehouse inventory example, suppose we have the following relations: inventory(item, level), which notes the current amount (number/weight/volume) of the item in the warehouse minlevel(item, level), which notes the minimum amount of the item to be maintained reorder(item, amount), which notes the amount of the item to be ordered when its level falls below the minimum orders(item, amount), which notes the amount of the item to be ordered. 4.3.The Execution Model for Triggers Execute all BEFORE statement triggers that apply to the statement. Loop for each row affected by the SQL statement. Execute all BEFORE row triggers that apply to the statement. Lock and change row, and perform integrity constraint checking. (The lock is not released until the transaction is committed.) Execute all AFTER row triggers that apply to the statement. Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 13

14 Complete deferred integrity constraint checking. Execute all AFTER statement triggers that apply to the statement. Example: 4.4.When Not To Use Triggers Triggers were used earlier for tasks such as maintaining summary data (e.g. total salary of each department) Replicating databases by recording changes to special relations (called change or delta relations) and having a separate process that applies the changes over to a replica There are better ways of doing these now: Databases today provide built in materialized view facilities to maintain summary data Databases provide built-in support for replication Encapsulation facilities can be used instead of triggers in many cases Define methods to update fields Carry out actions as part of the update methods instead of through a trigger 5.Security The data stored in the database need to be protected from unauthorized access, malicious destruction or alteration, and accidental introduction of consistency. Security Violations Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 14

15 Misuse of the database can be categorized as being either intentional(malicious) or accidental. Accidental loss of data consistency may result from Crashes during transaction processing Anomalies caused by concurrent access to the database Anomalies caused by the distribution of data over several computers Logical errors that violate the assumption those transcations prevent the database consistency constraints It is easier to protect against accidental loss of data consistency than to protect against malicious access to the database.among the forms of malicious access are: Unauthorized reading of data (theft of information) Unauthorized modification of data Unauthorized destruction of data To protect the database,we must take security measures at several levels: Database security refers to protection from malicious access. Absolute protection of the database from malicious abuse is not possible, but the cost to the perpetrator can be made high enough to deter most if not all attempts to access the database without proper authority. To protect the database, we must take security measures at several levels: Database system. Some database-system users may be authorized to access only a limited portion of the database. Other users may be allowed to issue queries, but may be forbidden to modify the data. It is the responsibility of the database system to ensure that these authorization restrictions are not violated. Operating system. No matter how secure the database system is, weakness in operatingsystem security may serve as a means of unauthorized access to the database. Network. Since almost all database systems allow remote access through terminals or networks, software-level security within the network software is as important as physical security, both on the Internet and in private networks. Physical. Sites with computer systems must be physic ally secured against armed or surreptitious entry by intruders. Human. Users must be authorized carefully to reduce the chance of any user giving access to an intruder in exchange for a bribe or other favors. Security at all these levels must be maintained if database security is to be ensured. A weakness at a low level of security (physical or human) allows circumvention of strict high-level (database) security measures. Security within the operating system is implemented at several levels, ranging from passwords for access to the system to the isolation of concurrent processes running within the system. The file system also provides some degree of protection. Finally, network-level security has gained widespread recognition as the Internet has evolved from an academic research platform to the basis of international electronic commerce. Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 15

16 6.Authorization A user may have several forms of authorization on parts of the database. Forms of authorization on parts of the database: Read authorization - allows reading, but not modification of data. Insert authorization - allows insertion of new data, but not modification of existing data. Update authorization - allows modification, but not deletion of data. Delete authorization - allows deletion of data Forms of authorization to modify the database schema: Index authorization - allows creation and deletion of indices. Resources authorization - allows creation of new relations. Alteration authorization - allows addition or deletion of attributes in a relation. Drop authorization - allows deletion of relations. The drop and delete authorization differ in that delete authorization allows deletion of tuples only. If a user deletes all tuples of a relation, the relation still exists, but it is empty. If a relation is dropped, it no longer exists. Resource authorization. A user with resource authorization who creates a new relation is given all privileges on that relation automatically. Index authorization may appear unnecessary, since the creation or deletion of an index does not alter data in relations. Rather, indices are a structure for performance enhancements.however, indices also consume space, and all database modifications are required to update indices. If index authorization were granted to all users, those who performed updates would be tempted to delete indices, whereas those who issued queries would be tempted to create numerous indices. To allow the database administrator to regulate the use of system resources, it is necessary to treat index creation as a privilege. 6.1 Authorization and Views Users can be given authorization on views, without being given any authorization on the relations used in the view definition Ability of views to hide data serves both to simplify usage of the system and to enhance security by allowing users access only to data they need for their job A combination or relational-level security and view-level security can be used to limit a user s access to precisely the data that user needs. View Example Suppose a bank clerk needs to know the names of the customers of each branch, but is not authorized to see specific loan information. Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 16

17 Approach: Deny direct access to the loan relation, but grant access to the view cust-loan, which consists only of the names of customers and the branches at which they have a loan. The cust-loan view is defined in SQL as follows: The clerk is authorized to see the result of the query: select * from cust-loan; Clearly, the clerk is authorized to see the result of this query. However, when the query processor translates it into a query on the actual relations in the database, it produces a query on borrower and loan. Thus, the system must check authorization on the clerk s query before it begins query processing 6.2Authorization on Views Creation of a view does not require resource authorization. A user who creates a view does not necessarily receive all privileges on that view. User receives only those privileges that provide no additional authorization beyond those that user already had. For example, a user cannot be given update authorization on a view without having update authorization on the relations used to define the view. If a user creates a view on which no authorization can be granted, the system will deny the view creation request. In our cust-loan view example, the creator of the view must have read authorization on both the borrower and loan relations. 6.3.Granting of Privileges The passage of authorization from one user to another may be represented by an authorization graph. The nodes of this graph are the users. The root of the graph is the database administrator. Consider graph for update authorization on loan. An edge Ui Uj indicates that user Ui has granted update authorization on loan to Uj. In the sample graph in Figure 6.6, observe that user U5 is granted authorization by both U1 and U2; U4 is granted authorization by only U1.A user has an authorization if and only if there is a path from the root of the authorizationgraph (namely, the node representing the database administrator) down to the node representing the user. Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 17

18 Suppose that the database administrator decides to revoke the authorization of user U1. Since U4 has authorization from U1, that authorization should be revoked as well. However, U5 was granted authorization by both U1 and U2. Since the database administrator did not revoke update authorization on loan from U2, U5 retains update authorization on loan. If U2 eventually revokes authorization from U5, then U5 loses the authorization. A pair of devious users might attempt to defeat the rules for revocation of authorization by granting authorization to each other, as shown in Figure 6.7a. If the database administrator revokes authorization from U2, U2 retains authorization through U3, as in Figure 6.7b. If authorization is revoked subsequently from U3, U3 appears to retain authorization through U2, as in Figure 6.7c. However, when the database administrator revokes authorization from U3, the edges fromu3 to U2 and from U2 to U3 are no longer part of a path starting with the database administrator. Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 18

19 7. Authorization in SQL Security Specification in SQL The SQL standard includes the privileges delete, insert, select, and update. The select privilege corresponds to the read privilege. SQL also includes a references privilege that permits a user/role to declare foreign keys the user/role must have been granted references privilege on those attributes. The SQL data-definition language includes commands to grant and revoke privileges. The grant statement is used to confer authorization. The basic form of this statement is: The privilege list allows the granting of several privileges in one command. The following grant statement grants users U1, U2, and U3 select authorization on the account relation: The update authorization may be given either on all attributes of the relation or on only some. If update authorization is included in a grant statement, the list of attributes on which update authorization is to be granted optionally appears in parentheses immediately after the update keyword. If the list of attributes is omitted, the update privilege will be granted on all attributes of the relation. This grant statement gives users U1, U2, andu3 update authorization on the amount attribute of the loan relation: Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 19

20 The SQL references privilege is granted on specific attributes in a manner like that for the update privilege. The following grant statement allows user U1 to create relations that reference the key branch-name of the branch relation as a foreign key: The privilege all privileges can be used as a short form for all the allowable privileges.similarly, the user name public refers to all current and future users of the system. SQL also includes a usage privilege that authorizes a user to use a specified domain Roles Roles can be created in SQL:1999 as follows Roles can then be granted privileges just as the users can, as illustrated in this statement: The Privilege to Grant Privileges By default, a user/role that is granted a privilege is not authorized to grant that privilege to another user/role. we append the with grant option clause to theappropriate grant command. For example, if we wish to allow U1 the select privilegeon branch and allow U1 to grant this privilege to others, we write To revoke an authorization, we use the revoke statement. It takes a form almost identical to that of grant: Thus, to revoke the privileges that we granted previously, we write The revoke statement may alternatively specify restrict Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 20

21 In this case, the system returns an error if there are any cascading revokes, and does not carry out the revoke action. The following revoke statement revokes only the grant option, rather than the actual select privilege: 7.1Limitations of SQL Authorization SQL does not support authorization at a tuple level E.g. we cannot restrict students to see only (the tuples storing) their own grades With the growth in Web access to databases, database accesses come primarily from application servers. End users don't have database user ids, they are all mapped to the same database user id All end-users of an application (such as a web application) may be mapped to a single database user The task of authorization in above cases falls on the application program, with no support from SQL Benefit: fine grained authorizations, such as to individual tuples, can be implemented by the application. Drawback: Authorization must be done in application code, and may be dispersed all over an application Checking for absence of authorization loopholes becomes very difficult since it requires reading large amounts of application code. 8.Encryption Data may be encrypted when database authorization provisions do not offer sufficient protection. Properties of good encryption technique: Relatively simple for authorized users to encrypt and decrypt data. Encryption scheme depends not on the secrecy of the algorithm but on the secrecy of a parameter of the algorithm called the encryption key. Extremely difficult for an intruder to determine the encryption key. Data Encryption Standard (DES) substitutes characters and rearranges their order on the basis of an encryption key which is provided to authorized users via a secure mechanism. Scheme is no more secure than the key transmission mechanism since the key has to be shared. Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 21

22 Advanced Encryption Standard (AES) is a new standard replacing DES, and is based on the Rijndael algorithm, but is also dependent on shared secret keys Public-key encryption is based on each user having two keys: o public key publicly published key used to encrypt data, but cannot be used to decrypt data o private key -- key known only to individual user, and used to decrypt data. Need not be transmitted to the site doing encryption. Encryption scheme is such that it is impossible or extremely hard to decrypt data given only the public key. The RSA public-key encryption scheme is based on the hardness of factoring a very large number (100's of digits) into its prime components. 9.Authentication Password based authentication is widely used, but is susceptible to sniffing on a network Challenge-response systems avoid transmission of passwords DB sends a (randomly generated) challenge string to user User encrypts string and returns result. DB verifies identity by decrypting result Can use public-key encryption system by DB sending a message encrypted using user s public key, and user decrypting and sending the message back Digital signatures are used to verify authenticity of data E.g. use private key (in reverse) to encrypt data, and anyone can verify authenticity by using public key (in reverse) to decrypt data. Only holder of private key could have created the encrypted data. Digital signatures also help ensure no repudiation: sender cannot later claim to have not created the data NORMALIZATION: Normalization is a technique for producing set of relation with desirable properties given the data requirements of an enterprise. It is the processes of removing redundant data from are tables to improve storage efficiency data integrity and scalability. It generally involves splitting the existing tables into multiple ones which must be rejoined or linked each time a query is used. Pitfalls in relational database design: The undesirable properties that a bad relational database design may have are: Repetition of information Inability to represent certain information Loss of information Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 22

23 Purpose of normalization To avoid redundancy by storing each fact within the database only once To put a data into a form that confirm to relational principles To put data into form that is more able to accurately accommodate change. To avoid updating anomalies To facilitate the enforcement of data constraints. Benefits: Facilitates data integration. Reduces data redundancy Produces a robust architecture for retrieving and maintaining data Complements data modeling Reduces the chance of data anomalies occurring Redundancy: Redundant is where we have stored some information more than once Repeating groups An attribute that can have more than one value Anomalies An undesirable side effects that occur when performing any modification Insert Update Delete Functional dependency Attribute B is functionally depend upon attributes A, if a values of A determines a single value of attribute B at any one time. Example: A->B A determines B or B functionally dependent on A Compound determinant If more than one attribute is necessary to determine another attribute in an entity Full functional dependency It use all the attribute of the composite determinant to identify its object uniquely Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 23

24 Partial functional dependency It only use a subset of attributes of the composite determinant to identify its object uniquely Transitive dependency Transitive dependency exists when there is an intermediate functional dependency Example: A->B->c If A->Band B->c then A->B->C then, A->C Lossless join dependency A property of decomposition which ensures that no spurious tuples are generated when relations are reunited to a natural join dependency or operator. Types of Normalization First normal form Second normal form Third normal form Boyee codd normal form Fourth normal form Fifth normal form FIRST NORMAL FORM(1 NF): The relation is said to be first normal form(1nf) if and only if each attribute of the relation is atomic more simplify to be in 1nf each column must contain only a single value and each row must contain the same columns. It describes the tabular format in which 1. All the key attributes are defined. 2. There are no repeating groups in the tables. 3. All attributes are depend on the primary key. Consider the table given below Table name:employee Empno name Deptno dname skills 1 Kevin jacob 201 R&d C,java,perl 2 Jones 224 IT Linux,max 3 Rivera 201 R&d Oracle,java,db2 Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 24

25 In the above table this skill field has multi value attributes and unnormalized form.a relation table must not have repeating groups. So,it can be converted into first normal form as shown as below Empno name Deptno dname skills 1 Kevin jacob 201 R&d C 1 Kevin jacob 201 R&d java 1 Kevin jacob 201 R&d perl 2 Jones 224 IT linux 2 Jones 224 IT max 3 Rivera 201 R&d oracle 3 Rivera 201 R&d java 3 rivera 201 R&d Db2 Here the above employee table is in the first normal form. The redundancy value in the are eliminated by placing the multi value attribute into different rows to indicate the same relationship as before. Characteristics of first normal form: Remove horizontal redundancy: No two columns hold the same value or information. No single column holds more than single item. Each row must be unique Use a primary key Benefits of 1NF: o Easy to query or sort the data o More scable o Each row can be identified for updating. SECOND NORMAL FORM A relation is said to be second normal form if and only if every non key field depend on the entire primary key, not on part of a composite key. If a database has only single field primary keys, it is automatically in second normal form. It involves a normalization using functional dependencies. A given set of functional dependencies can be used in designing relational database in which most of the undesirable property do not occur. Using Functional dependencies we can define several normal form, which represent good database design. EMPNO NAME DEPT NO DEPTNAME SKILSS 1 kevinjocob 201 R&D C 1 kevinjocob 201 R&D perl 1 kevinjocob 201 R&D java 2 jones 224 IT LINUX Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 25

26 2 jones 224 IT MAC 3 rivera 201 R&D DB2 3 rivera 201 R&D oracle 3 rivera 201 R&D java EMPNO NAME DEPTNO DEPTNAME 1 kevinjocob 201 R&D 2 jones 224 IT 3 rivera 201 R&D EMPNO SKILLS 1 C 1 perl 1 java 2 LINUX 2 MAC 3 oracle 3 java 3 DB2 FUNCTIONAL DEPENDENCIES The property of one or more attribute that uniquely determined the value of other attribute. Functional dependencies is a relationship between or among attribute such that the value of one attribute depend on or determined by the values of other attributes. Features of 2NF ->Meet all the requirements of the 2NF. -> Remove columns that are not depend up the primary key. -> Remove columns that are not fully depend up on the primary key. THIRD NORMAL FORM(3NF) ->It is always possible to find a lossless-join, dependency-preservation decomposition (I,e) in third normal form(3nf) Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 26

27 ->BCNF require that all non- trivial dependencies be of the form α->β, where, where α is a super key. 3NF relaxes this constrain by allowing non-trivial functional dependencies whose left side is not a super key. -> A relational schema R is in 3NF with respect to set F of functional dependencies, if, for all functional dependencies in F+ of the form α->β where αcr and βcr, at least one of the following holds: α->β is a trivial functional dependencies. α is a supper key for R. Each attribute A in β->a is contained is a candidate key for R. Dependency preserving, lossless join decomposition in to 3NF Let FC be a canonical cover for F; I:=0 For each functional dependency Rj, j=1,2,..i contain αβ Then begin I:=i+1; Ri:=αβ; And If none of the schemas Rj, j=i,1 I contains a candidate key for R Then begin I:=i+1; Ri:= any candidate key for R; End Return(R1, R2, Ri) The relation R is said to be 3NF, if and only if it is a second normal form and no transitive dependency exist between non-key attribute and key attribute. Transitive functional dependency arises only when non-key attribute. A relation is said to be transitively dependent when (i) Z is transitively dependent on X. (ii) When X determines Y and Y determines Z. (iii) Thus Z is indirectly dependent X through Y. EG; Employee Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 27

28 PROJECTNO NAME ADDRESS P1 Rose 86,new st. P2 Smith 42, Nehru st. P3 Rose 86,new st. P4 Rose 86, new st. EMPLOYEE PROJECT NO P1 P2 P3 P4 Employee name NAME Rose Smith NAME Rose Smith Rose Rose ADDRESS 86,Nehru st. 42, Nehru st. Here the name attribute is used to link between two tables and act as the foreign key. Boyce codd normal form: (BCNF) BCNF is based on the concept of determinant.a determinant is any artibute (simple,composite) on which some other arttribute is fully functional dependent. A relation schema R is in BCNF with respect to a set Fof functional dependencies if for all functional dependencies in f+ of the form α->β where α subset of R and,β _c R atleast one of the following holds: α->β Is a trivial functional dependency(β-c α) α Is a super key for schema R A relation is in boyee codd normal form is if and only if every detetminant is a candidate key(ie)for every x->y,x is candidate key. Example: Suppose each student may maior in several areas.each student has one tutor for each area.each area has several tutors but tutor advices in only one area each tutor advices several students in an area. Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 28

29 Table name: student-staff STUDENT NO AREA STAFF NO 12MC01 CSE MC02 IT MC01 SE MC02 BME MC03 IT 567 The schema is in third normal form because there are no partial dependencies and no interdata dependency and hence anamolies will raise. Suppose the data 12MC01 changes one of the major form computer science to information system.by doing this changes, we loss information about staff number 234 tutor on CSE.this is an anamolies. To insert a new row to establish the fact, staff number 789 an computer science.we cannot do this until atleast one student take this area as the major. This is an insertion anamoly. Suppose,12MC03 withdraw from the major. If removing the redundant row we lose information about staff no 567.This is an deletion anamoly. These anamoly occur bscause there are two overlapping candidate key occur.so BCNF indentify this problem and purpose to solution. Every table has only one candidate key. The above relation can be represented in BCNF by splitting the table into two relations called student number.,staff In one relation, here staff number is refered as second relation with area which is as below. STUDENT NUMBER O2 345 O1 456 O2 678 O3 567 STAFF NUMBER STAFF NUMBER 234 CSE 345 IT 456 SE 678 BME 567 IT AREA Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 29

30 Fourth Normal Form: To improve the database design, by decomposing this schema into fourth normal form decomposition. A relation schema R is in fourth normal form(4nf) with respect to a set D of functional and multivalve dependencies if,for all multivalve dependencies in D+ of the form A->-->B. Hold: A-->B is a trivial multivalued dependency. A is a superkey for schema R. A database design is in 4NF if each member of the set of relation schemas that constitutes the design is in 4 NF. The table set to be 4NF if and only if it s in BCNF and multivalve dependency or functional dependency. 4NF remove unwanted data structures it includes null values. All multivalve dependency must be changed from non trivial to trivial. Example: Car Color Engine C1 Red F3.2L C1 Red F4.5L C1 White F3.2L C1 White F4.5L C1 Blue F3.2L C1 Blue F4.5L C2 Red C3.2L C2 Red C4.5L C2 Green C3.2L C2 Green C4.5L In the above table primary key identifier is car, color, and engine. None of the attributes of dependencies of other attributes there is any possible dependencies or decomposition. Each color for each car is paired with each engine, size for each car and this continuous. With every other car, in the restated car this car reduces in the relational. Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 30

31 If a row is deleted from the table car, c1 comes for the row of the table this type of reduces by multivalve decomposition. Suppose there is a relation R of set of attribute S that contain multivalve dependencies X ->> Y. The remaining attribute of relation R called Z; X ->> Y is multivalve dependencies. Two tables:- Car color: Car C1 C1 C1 C2 C2 Color Red White Blue Red Green Car Engine: Car C1 C1 C2 C2 Engine F3.2L F4.5L C3.2L C4.5L When this table structure we can determine the 4NF. For example, Red, C1 car can have either F3.2L, F4.5L. However to delete one piece of (row) information do not actually lose the information as oppressed to when a row is eliminate from the original relation. Prepared by Mrs.D.Maladhy (AP/IT/RGCET) Page 31

Chapter 6: Integrity and Security.! Domain Constraints! Referential Integrity! Assertions! Triggers! Security! Authorization! Authorization in SQL

Chapter 6: Integrity and Security.! Domain Constraints! Referential Integrity! Assertions! Triggers! Security! Authorization! Authorization in SQL Chapter 6: Integrity and Security! Domain Constraints! Referential Integrity! Assertions! Triggers! Security! Authorization! Authorization in SQL 6.1 Domain Constraints! Integrity constraints guard against

More information

Domain Constraints Referential Integrity Assertions Triggers. Authorization Authorization in SQL

Domain Constraints Referential Integrity Assertions Triggers. Authorization Authorization in SQL Chapter 6: Integrity and Security Domain Constraints Referential Integrity Assertions Triggers Security Authorization Authorization in SQL 6.1 Domain Constraints Integrity constraints guard against accidental

More information

Database System Concepts"

Database System Concepts Database System Concepts! Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use " Database System Concepts" User Interfaces and Tools! Web Interfaces to Databases! Web Fundamentals!

More information

Database System Concepts

Database System Concepts Chapter 4(+8): Advanced SQL Departamento de Engenharia Informática Instituto Superior Técnico 1 st Semester 2007/2008 Slides (fortemente) baseados nos slides oficiais do livro c Silberschatz, Korth and

More information

User Interfaces and Tools. Web Interfaces to Database (Cont.) Web Interfaces to Databases. Client Side Scripting and Applets.

User Interfaces and Tools. Web Interfaces to Database (Cont.) Web Interfaces to Databases. Client Side Scripting and Applets. Ch 8: Application Design and Development User Interfaces and Tools Web Interfaces to Databases Web Fundamentals Servlets and JSP Building Large Web Applications Triggers Authorization in SQL Application

More information

DATABASE TECHNOLOGY - 1MB025 (also 1DL029, 1DL300+1DL400)

DATABASE TECHNOLOGY - 1MB025 (also 1DL029, 1DL300+1DL400) 1 DATABASE TECHNOLOGY - 1MB025 (also 1DL029, 1DL300+1DL400) Spring 2008 An introductury course on database systems http://user.it.uu.se/~udbl/dbt-vt2008/ alt. http://www.it.uu.se/edu/course/homepage/dbastekn/vt08/

More information

Data about data is database Select correct option: True False Partially True None of the Above

Data about data is database Select correct option: True False Partially True None of the Above Within a table, each primary key value. is a minimal super key is always the first field in each table must be numeric must be unique Foreign Key is A field in a table that matches a key field in another

More information

Comp 5311 Database Management Systems. 4b. Structured Query Language 3

Comp 5311 Database Management Systems. 4b. Structured Query Language 3 Comp 5311 Database Management Systems 4b. Structured Query Language 3 1 SQL as Data Definition Language Creates the Students relation. The type (domain) of each field is specified, and enforced by the

More information

Integrity and Security

Integrity and Security C H A P T E R 6 Integrity and Security This chapter presents several types of integrity constraints, including domain constraints, referential integrity constraints, assertions and triggers, as well as

More information

Slides by: Ms. Shree Jaswal

Slides by: Ms. Shree Jaswal Slides by: Ms. Shree Jaswal A trigger is a statement that is executed automatically by the system as a side effect of a modification to the database. To design a trigger mechanism, we must: Specify the

More information

SQL Interview Questions

SQL Interview Questions SQL Interview Questions SQL stands for Structured Query Language. It is used as a programming language for querying Relational Database Management Systems. In this tutorial, we shall go through the basic

More information

UNIT 3 DATABASE DESIGN

UNIT 3 DATABASE DESIGN UNIT 3 DATABASE DESIGN Objective To study design guidelines for relational databases. To know about Functional dependencies. To have an understanding on First, Second, Third Normal forms To study about

More information

Chapter 4: Intermediate SQL

Chapter 4: Intermediate SQL Chapter 4: Intermediate SQL Chapter 4: Intermediate SQL Join Expressions Views Transactions Integrity Constraints SQL Data Types and Schemas Authorization Joined Relations Join operations take two relations

More information

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601 Techno India Batanagar Computer Science and Engineering Model Questions Subject Name: Database Management System Subject Code: CS 601 Multiple Choice Type Questions 1. Data structure or the data stored

More information

CS6302 DBMS 2MARK & 16 MARK UNIT II SQL & QUERY ORTIMIZATION 1. Define Aggregate Functions in SQL? Aggregate function are functions that take a collection of values as input and return a single value.

More information

Chapter 4: Intermediate SQL

Chapter 4: Intermediate SQL Chapter 4: Intermediate SQL Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 4: Intermediate SQL Join Expressions Views Transactions Integrity Constraints SQL Data

More information

DATABASDESIGN FÖR INGENJÖRER - 1DL124

DATABASDESIGN FÖR INGENJÖRER - 1DL124 1 DATABASDESIGN FÖR INGENJÖRER - 1DL124 Sommar 2005 En introduktionskurs i databassystem http://user.it.uu.se/~udbl/dbt-sommar05/ alt. http://www.it.uu.se/edu/course/homepage/dbdesign/st05/ Kjell Orsborn

More information

Normalisation. Normalisation. Normalisation

Normalisation. Normalisation. Normalisation Normalisation Normalisation Main objective in developing a logical data model for relational database systems is to create an accurate and efficient representation of the data, its relationships, and constraints

More information

Textbook: Chapter 4. Chapter 5: Intermediate SQL. CS425 Fall 2016 Boris Glavic. Chapter 5: Intermediate SQL. View Definition.

Textbook: Chapter 4. Chapter 5: Intermediate SQL. CS425 Fall 2016 Boris Glavic. Chapter 5: Intermediate SQL. View Definition. Chapter 5: Intermediate SQL Views CS425 Fall 2013 Boris Glavic Chapter 5: Intermediate SQL Transactions Integrity Constraints SQL Data Types and Schemas Access Control Textbook: Chapter 4 5.2 Views View

More information

CS425 Fall 2017 Boris Glavic Chapter 5: Intermediate SQL

CS425 Fall 2017 Boris Glavic Chapter 5: Intermediate SQL CS425 Fall 2017 Boris Glavic Chapter 5: Intermediate SQL modified from: Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 5: Intermediate SQL Views Transactions Integrity

More information

Chapter 6: Relational Database Design

Chapter 6: Relational Database Design Chapter 6: Relational Database Design Chapter 6: Relational Database Design Features of Good Relational Design Atomic Domains and First Normal Form Decomposition Using Functional Dependencies Second Normal

More information

Normalization. Murali Mani. What and Why Normalization? To remove potential redundancy in design

Normalization. Murali Mani. What and Why Normalization? To remove potential redundancy in design 1 Normalization What and Why Normalization? To remove potential redundancy in design Redundancy causes several anomalies: insert, delete and update Normalization uses concept of dependencies Functional

More information

Chapter 8: Application Design and Development

Chapter 8: Application Design and Development Chapter 8: Application Design and Development Database System Concepts See www.db-book.com for conditions on re-use Database System Concepts Chapter 8: Application Design and Development User Interfaces

More information

CS403- Database Management Systems Solved MCQS From Midterm Papers. CS403- Database Management Systems MIDTERM EXAMINATION - Spring 2010

CS403- Database Management Systems Solved MCQS From Midterm Papers. CS403- Database Management Systems MIDTERM EXAMINATION - Spring 2010 CS403- Database Management Systems Solved MCQS From Midterm Papers April 29,2012 MC100401285 Moaaz.pk@gmail.com Mc100401285@gmail.com PSMD01 CS403- Database Management Systems MIDTERM EXAMINATION - Spring

More information

Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata

Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata SQL 3 Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata Slides re-used, with minor modification, from Silberschatz, Korth and Sudarshan www.db-book.com Outline Join Expressions Views

More information

Relational Design: Characteristics of Well-designed DB

Relational Design: Characteristics of Well-designed DB 1. Minimal duplication Relational Design: Characteristics of Well-designed DB Consider table newfaculty (Result of F aculty T each Course) Id Lname Off Bldg Phone Salary Numb Dept Lvl MaxSz 20000 Cotts

More information

DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS. QUESTION 1: What is database?

DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS. QUESTION 1: What is database? DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS Complete book short Answer Question.. QUESTION 1: What is database? A database is a logically coherent collection of data with some inherent meaning, representing

More information

Steps in normalisation. Steps in normalisation 7/15/2014

Steps in normalisation. Steps in normalisation 7/15/2014 Introduction to normalisation Normalisation Normalisation = a formal process for deciding which attributes should be grouped together in a relation Normalisation is the process of decomposing relations

More information

CT13 DATABASE MANAGEMENT SYSTEMS DEC 2015

CT13 DATABASE MANAGEMENT SYSTEMS DEC 2015 Q.1 a. Explain the role of concurrency control software in DBMS with an example. Answer: Concurrency control software in DBMS ensures that several users trying to update the same data do so in a controlled

More information

CS352 Lecture: Integrity and Security Constraints revised 9/8/06

CS352 Lecture: Integrity and Security Constraints revised 9/8/06 CS352 Lecture: Integrity and Security Constraints revised 9/8/06 Materials: 1. Handout of SQL statements for creating example library database, showing entity and referential integrity constraints. (Students

More information

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. # 13 Constraints & Triggers Hello and welcome to another session

More information

UNIT -III. Two Marks. The main goal of normalization is to reduce redundant data. Normalization is based on functional dependencies.

UNIT -III. Two Marks. The main goal of normalization is to reduce redundant data. Normalization is based on functional dependencies. UNIT -III Relational Database Design: Features of Good Relational Designs- Atomic Domains and First Normal Form- Second Normal Form-Decomposition Using Functional Dependencies- Functional-Dependency Theory-Algorithms

More information

8) A top-to-bottom relationship among the items in a database is established by a

8) A top-to-bottom relationship among the items in a database is established by a MULTIPLE CHOICE QUESTIONS IN DBMS (unit-1 to unit-4) 1) ER model is used in phase a) conceptual database b) schema refinement c) physical refinement d) applications and security 2) The ER model is relevant

More information

customer = (customer_id, _ customer_name, customer_street,

customer = (customer_id, _ customer_name, customer_street, Relational Database Design COMPILED BY: RITURAJ JAIN The Banking Schema branch = (branch_name, branch_city, assets) customer = (customer_id, _ customer_name, customer_street, customer_city) account = (account_number,

More information

CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam

CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam Question No: 1 ( Marks: 1 ) - Please choose one Which of the following is NOT a feature of Context DFD?

More information

DBMS Chapter Three IS304. Database Normalization-Comp.

DBMS Chapter Three IS304. Database Normalization-Comp. Database Normalization-Comp. Contents 4. Boyce Codd Normal Form (BCNF) 5. Fourth Normal Form (4NF) 6. Fifth Normal Form (5NF) 7. Sixth Normal Form (6NF) 1 4. Boyce Codd Normal Form (BCNF) In the first

More information

IS 263 Database Concepts

IS 263 Database Concepts IS 263 Database Concepts Lecture 4: Normalization Instructor: Henry Kalisti 1 Department of Computer Science and Engineering Limitations of E- R Designs Provides a set of guidelines, does not result in

More information

Learning outcomes. On successful completion of this unit you will: 1. Understand data models and database technologies.

Learning outcomes. On successful completion of this unit you will: 1. Understand data models and database technologies. 2015-2016 Phil Smith Learning outcomes On successful completion of this unit you will: 1. Understand data models and database technologies. (Assignment 1) Recap and setting the scene Before we get to Normalisation

More information

Database Technology Introduction. Heiko Paulheim

Database Technology Introduction. Heiko Paulheim Database Technology Introduction Outline The Need for Databases Data Models Relational Databases Database Design Storage Manager Query Processing Transaction Manager Introduction to the Relational Model

More information

Database Management Systems Paper Solution

Database Management Systems Paper Solution Database Management Systems Paper Solution Following questions have been asked in GATE CS exam. 1. Given the relations employee (name, salary, deptno) and department (deptno, deptname, address) Which of

More information

The Relational Model

The Relational Model The Relational Model What is the Relational Model Relations Domain Constraints SQL Integrity Constraints Translating an ER diagram to the Relational Model and SQL Views A relational database consists

More information

DC62 Database management system JUNE 2013

DC62 Database management system JUNE 2013 Q2 (a) Explain the differences between conceptual & external schema. Ans2 a. Page Number 24 of textbook. Q2 (b) Describe the four components of a database system. A database system is composed of four

More information

Database Management System Prof. Partha Pratim Das Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Database Management System Prof. Partha Pratim Das Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Database Management System Prof. Partha Pratim Das Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 19 Relational Database Design (Contd.) Welcome to module

More information

0. Database Systems 1.1 Introduction to DBMS Information is one of the most valuable resources in this information age! How do we effectively and efficiently manage this information? - How does Wal-Mart

More information

Redundancy:Dependencies between attributes within a relation cause redundancy.

Redundancy:Dependencies between attributes within a relation cause redundancy. Normalization Normalization: It is the process of removing redundant data from your tables in order to improve storage efficiency, data integrity and scalability. This improvement is balanced against an

More information

1. Considering functional dependency, one in which removal from some attributes must affect dependency is called

1. Considering functional dependency, one in which removal from some attributes must affect dependency is called Q.1 Short Questions Marks 1. Considering functional dependency, one in which removal from some attributes must affect dependency is called 01 A. full functional dependency B. partial dependency C. prime

More information

Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata

Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata SQL 4 Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata Slides re-used, with minor modification, from Silberschatz, Korth and Sudarshan www.db-book.com Outline Join Expressions Views

More information

ADVANCED DATABASES ; Spring 2015 Prof. Sang-goo Lee (11:00pm: Mon & Wed: Room ) Advanced DB Copyright by S.-g.

ADVANCED DATABASES ; Spring 2015 Prof. Sang-goo Lee (11:00pm: Mon & Wed: Room ) Advanced DB Copyright by S.-g. 4541.564; Spring 2015 Prof. Sang-goo Lee (11:00pm: Mon & Wed: Room 301-203) ADVANCED DATABASES Copyright by S.-g. Lee Review - 1 General Info. Text Book Database System Concepts, 6 th Ed., Silberschatz,

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 14 Basics of Functional Dependencies and Normalization for Relational Databases Slide 14-2 Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1 Semantics of the Relation Attributes

More information

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch. 1 :- Introduction Database Management System - 1

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch. 1 :- Introduction Database Management System - 1 Basic Concepts :- 1. What is Data? Data is a collection of facts from which conclusion may be drawn. In computer science, data is anything in a form suitable for use with a computer. Data is often distinguished

More information

Relational Database Design (II)

Relational Database Design (II) Relational Database Design (II) 1 Roadmap of This Lecture Algorithms for Functional Dependencies (cont d) Decomposition Using Multi-valued Dependencies More Normal Form Database-Design Process Modeling

More information

UNIT I. Introduction

UNIT I. Introduction UNIT I Introduction Objective To know the need for database system. To study about various data models. To understand the architecture of database system. To introduce Relational database system. Introduction

More information

CMP-3440 Database Systems

CMP-3440 Database Systems CMP-3440 Database Systems Logical Design Lecture 03 zain 1 Database Design Process Application 1 Conceptual requirements Application 1 External Model Application 2 Application 3 Application 4 External

More information

6 February 2014 CSE-3421M Test #1 w/ answers p. 1 of 14. CSE-3421M Test #1. Design

6 February 2014 CSE-3421M Test #1 w/ answers p. 1 of 14. CSE-3421M Test #1. Design 6 February 2014 CSE-3421M Test #1 w/ answers p. 1 of 14 CSE-3421M Test #1 Design Sur / Last Name: Given / First Name: Student ID: Instructor: Parke Godfrey Exam Duration: 75 minutes Term: Winter 2014 Answer

More information

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered

More information

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall The Relational Model Chapter 3 Comp 521 Files and Databases Fall 2012 1 Why Study the Relational Model? Most widely used model by industry. IBM, Informix, Microsoft, Oracle, Sybase, etc. It is simple,

More information

Informal Design Guidelines for Relational Databases

Informal Design Guidelines for Relational Databases Outline Informal Design Guidelines for Relational Databases Semantics of the Relation Attributes Redundant Information in Tuples and Update Anomalies Null Values in Tuples Spurious Tuples Functional Dependencies

More information

GUJARAT TECHNOLOGICAL UNIVERSITY

GUJARAT TECHNOLOGICAL UNIVERSITY Seat No.: Enrolment No. GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER III (NEW) - EXAMINATION SUMMER 2017 Subject Code: 21303 Date: 02/06/2017 Subject Name: Database Management Systems Time: 10:30 AM

More information

Lecture 11 - Chapter 8 Relational Database Design Part 1

Lecture 11 - Chapter 8 Relational Database Design Part 1 CMSC 461, Database Management Systems Spring 2018 Lecture 11 - Chapter 8 Relational Database Design Part 1 These slides are based on Database System Concepts 6th edition book and are a modified version

More information

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization CSE 544 Principles of Database Management Systems Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization References R&G Book. Chapter 19: Schema refinement and normal forms Also relevant to this

More information

CSE 565 Computer Security Fall 2018

CSE 565 Computer Security Fall 2018 CSE 565 Computer Security Fall 2018 Lecture 12: Database Security Department of Computer Science and Engineering University at Buffalo 1 Review of Access Control Types We previously studied four types

More information

Database System Concepts, 5th Ed.! Silberschatz, Korth and Sudarshan See for conditions on re-use "

Database System Concepts, 5th Ed.! Silberschatz, Korth and Sudarshan See   for conditions on re-use Database System Concepts, 5th Ed.! Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use " SQL Data Types and Schemas! Integrity Constraints! Authorization! Embedded SQL! Dynamic

More information

NORMAL FORMS. CS121: Relational Databases Fall 2017 Lecture 18

NORMAL FORMS. CS121: Relational Databases Fall 2017 Lecture 18 NORMAL FORMS CS121: Relational Databases Fall 2017 Lecture 18 Equivalent Schemas 2 Many different schemas can represent a set of data Which one is best? What does best even mean? Main goals: Representation

More information

The strategy for achieving a good design is to decompose a badly designed relation appropriately.

The strategy for achieving a good design is to decompose a badly designed relation appropriately. The strategy for achieving a good design is to decompose a badly designed relation appropriately. Functional Dependencies The single most important concept in relational schema design theory is that of

More information

DATABASE TRANSACTIONS. CS121: Relational Databases Fall 2017 Lecture 25

DATABASE TRANSACTIONS. CS121: Relational Databases Fall 2017 Lecture 25 DATABASE TRANSACTIONS CS121: Relational Databases Fall 2017 Lecture 25 Database Transactions 2 Many situations where a sequence of database operations must be treated as a single unit A combination of

More information

DATABASE MANAGEMENT SYSTEM

DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM For COMPUTER SCIENCE DATABASE MANAGEMENT. SYSTEM SYLLABUS ER model. Relational model: relational algebra, tuple calculus, SQL. Integrity constraints, normal forms. File organization,

More information

Relational Database design. Slides By: Shree Jaswal

Relational Database design. Slides By: Shree Jaswal Relational Database design Slides By: Shree Jaswal Topics: Design guidelines for relational schema, Functional Dependencies, Definition of Normal Forms- 1NF, 2NF, 3NF, BCNF, Converting Relational Schema

More information

Essay Question: Explain 4 different means by which constrains are represented in the Conceptual Data Model (CDM).

Essay Question: Explain 4 different means by which constrains are represented in the Conceptual Data Model (CDM). Question 1 Essay Question: Explain 4 different means by which constrains are represented in the Conceptual Data Model (CDM). By specifying participation conditions By specifying the degree of relationship

More information

II B.Sc(IT) [ BATCH] IV SEMESTER CORE: RELATIONAL DATABASE MANAGEMENT SYSTEM - 412A Multiple Choice Questions.

II B.Sc(IT) [ BATCH] IV SEMESTER CORE: RELATIONAL DATABASE MANAGEMENT SYSTEM - 412A Multiple Choice Questions. Dr.G.R.Damodaran College of Science (Autonomous, affiliated to the Bharathiar University, recognized by the UGC)Re-accredited at the 'A' Grade Level by the NAAC and ISO 9001:2008 Certified CRISL rated

More information

CS2255 DATABASE MANAGEMENT SYSTEMS QUESTION BANK UNIT I

CS2255 DATABASE MANAGEMENT SYSTEMS QUESTION BANK UNIT I CS2255 DATABASE MANAGEMENT SYSTEMS CLASS: II YEAR CSE SEM:04 STAFF INCHARGE: Mr S.GANESH,AP/CSE QUESTION BANK UNIT I 2 MARKS List the purpose of Database System (or) List the drawback of normal File Processing

More information

CS211 Lecture: Database Design

CS211 Lecture: Database Design CS211 Lecture: Database Design Objectives: last revised November 21, 2006 1. To introduce the anomalies that result from redundant storage of data 2. To introduce the notion of functional dependencies

More information

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization CSE 544 Principles of Database Management Systems Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization References R&G Book. Chapter 19: Schema refinement and normal forms Also relevant to

More information

DATABASE MANAGEMENT SYSTEMS

DATABASE MANAGEMENT SYSTEMS www..com Code No: N0321/R07 Set No. 1 1. a) What is a Superkey? With an example, describe the difference between a candidate key and the primary key for a given relation? b) With an example, briefly describe

More information

MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38

MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38 Student Info StudentID: Center: ExamDate: MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: 1356458 Time: 60 min Marks: 38 BC080402322 OPKST 5/28/2010 12:00:00 AM

More information

Chapter 7: Relational Database Design

Chapter 7: Relational Database Design Chapter 7: Relational Database Design Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 7: Relational Database Design Features of Good Relational Design Atomic Domains

More information

The Relational Model. Chapter 3

The Relational Model. Chapter 3 The Relational Model Chapter 3 Why Study the Relational Model? Most widely used model. Systems: IBM DB2, Informix, Microsoft (Access and SQL Server), Oracle, Sybase, MySQL, etc. Legacy systems in older

More information

Chapter 2. DB2 concepts

Chapter 2. DB2 concepts 4960ch02qxd 10/6/2000 7:20 AM Page 37 DB2 concepts Chapter 2 Structured query language 38 DB2 data structures 40 Enforcing business rules 49 DB2 system structures 52 Application processes and transactions

More information

DATABASE DESIGN - 1DL400

DATABASE DESIGN - 1DL400 DATABASE DESIGN - 1DL400 Spring 2012 A course on modern database systems http://www.it.uu.se/edu/course/homepage/dbastekn2/vt12/ Tore Risch Uppsala Database Laboratory Department of Information Technology,

More information

Q.1 Short Questions Marks 1. New fields can be added to the created table by using command. a) ALTER b) SELECT c) CREATE. D. UPDATE.

Q.1 Short Questions Marks 1. New fields can be added to the created table by using command. a) ALTER b) SELECT c) CREATE. D. UPDATE. ID No. Knowledge Institute of Technology & Engineering - 135 BE III SEMESTER MID EXAMINATION ( SEPT-27) PAPER SOLUTION Subject Code: 2130703 Date: 14/09/27 Subject Name: Database Management Systems Branches:

More information

Normalization in DBMS

Normalization in DBMS Unit 4: Normalization 4.1. Need of Normalization (Consequences of Bad Design-Insert, Update & Delete Anomalies) 4.2. Normalization 4.2.1. First Normal Form 4.2.2. Second Normal Form 4.2.3. Third Normal

More information

Distributed Database Systems By Syed Bakhtawar Shah Abid Lecturer in Computer Science

Distributed Database Systems By Syed Bakhtawar Shah Abid Lecturer in Computer Science Distributed Database Systems By Syed Bakhtawar Shah Abid Lecturer in Computer Science 1 Distributed Database Systems Basic concepts and Definitions Data Collection of facts and figures concerning an object

More information

Chapter 8: Relational Database Design

Chapter 8: Relational Database Design Chapter 8: Relational Database Design Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 8: Relational Database Design Features of Good Relational Design Atomic Domains

More information

The Relational Model. Chapter 3. Database Management Systems, R. Ramakrishnan and J. Gehrke 1

The Relational Model. Chapter 3. Database Management Systems, R. Ramakrishnan and J. Gehrke 1 The Relational Model Chapter 3 Database Management Systems, R. Ramakrishnan and J. Gehrke 1 Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc.

More information

Unit 3 : Relational Database Design

Unit 3 : Relational Database Design Unit 3 : Relational Database Design Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Content Relational Model: Basic concepts, Attributes and Domains, CODD's Rules, Relational

More information

CSCI 403: Databases 13 - Functional Dependencies and Normalization

CSCI 403: Databases 13 - Functional Dependencies and Normalization CSCI 403: Databases 13 - Functional Dependencies and Normalization Introduction The point of this lecture material is to discuss some objective measures of the goodness of a database schema. The method

More information

The Relational Model 2. Week 3

The Relational Model 2. Week 3 The Relational Model 2 Week 3 1 We have seen how to create a database schema, how do we create an actual database on our computers? professor(pid : string, name : string) course(pid : string, number :

More information

E-R diagrams and database schemas. Functional dependencies. Definition (tuple, attribute, value). A tuple has the form

E-R diagrams and database schemas. Functional dependencies. Definition (tuple, attribute, value). A tuple has the form E-R diagrams and database schemas Functional dependencies Definition (tuple, attribute, value). A tuple has the form {A 1 = v 1,..., A n = v n } where A 1,..., A n are attributes and v 1,..., v n are their

More information

MODULE: 3 FUNCTIONAL DEPENDENCIES

MODULE: 3 FUNCTIONAL DEPENDENCIES MODULE: 3 (13 hours) Database design: functional dependencies - Inference Rules for Functional Dependencies - Closure -- Minimal Cover -Normal forms First-second and third normal forms Boyce- Codd normal

More information

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 6 Normalization of Database Tables

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 6 Normalization of Database Tables Database Systems: Design, Implementation, and Management Tenth Edition Chapter 6 Normalization of Database Tables Objectives In this chapter, students will learn: What normalization is and what role it

More information

DATABASE DESIGN - 1DL400

DATABASE DESIGN - 1DL400 DATABASE DESIGN - 1DL400 Spring 2014 2014-01-21 A course on modern database systems http://www.it.uu.se/research/group/udbl/kurser/dbii_vt14/integrity.pdf Tore Risch Uppsala Database Laboratory Department

More information

ACS-2914 Normalization March 2009 NORMALIZATION 2. Ron McFadyen 1. Normalization 3. De-normalization 3

ACS-2914 Normalization March 2009 NORMALIZATION 2. Ron McFadyen 1. Normalization 3. De-normalization 3 NORMALIZATION 2 Normalization 3 De-normalization 3 Functional Dependencies 4 Generating functional dependency maps from database design maps 5 Anomalies 8 Partial Functional Dependencies 10 Transitive

More information

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall The Relational Model Chapter 3 Comp 521 Files and Databases Fall 2014 1 Why the Relational Model? Most widely used model by industry. IBM, Informix, Microsoft, Oracle, Sybase, MySQL, Postgres, Sqlite,

More information

The Basic (Flat) Relational Model. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

The Basic (Flat) Relational Model. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The Basic (Flat) Relational Model Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 Outline The Relational Data Model and Relational Database Constraints Relational

More information

Q.2 e) Time stamping protocol for concurrrency control Time stamping ids a concurrency protocol in which the fundamental goal is to order transactions globally in such a way that older transactions get

More information

The Relational Model

The Relational Model The Relational Model UVic C SC 370, Fall 2002 Daniel M. German Department of Computer Science University of Victoria 3 1 The Relational Model CSC 370 dmgerman@uvic.ca Overview How is data represented in

More information

; Spring 2008 Prof. Sang-goo Lee (14:30pm: Mon & Wed: Room ) ADVANCED DATABASES

; Spring 2008 Prof. Sang-goo Lee (14:30pm: Mon & Wed: Room ) ADVANCED DATABASES 4541.564; Spring 2008 Prof. Sang-goo Lee (14:30pm: Mon & Wed: Room 302-208) ADVANCED DATABASES Syllabus Text Books Exams (tentative dates) Database System Concepts, 5th Edition, A. Silberschatz, H. F.

More information

CSE 562 Database Systems

CSE 562 Database Systems Goal CSE 562 Database Systems Question: The relational model is great, but how do I go about designing my database schema? Database Design Some slides are based or modified from originals by Magdalena

More information

Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2

Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2 Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2 Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant

More information

Relational Data Model

Relational Data Model Relational Data Model 1. Relational data model Information models try to put the real-world information complexity in a framework that can be easily understood. Data models must capture data structure

More information

Chapter 1: Introduction

Chapter 1: Introduction Chapter 1: Introduction Chapter 2: Intro. To the Relational Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Database Management System (DBMS) DBMS is Collection of

More information