1 / 14

RAJIKA TANDON

RAJIKA TANDON. DATABASES. CSE 781 – Database Management Systems Instructor: Dr. A. Goel. WHY DATABASE ?. TRADITIONAL METHOD:. In the traditional approach, information is stored in flat files which are maintained by the file system of OS.

malia
Download Presentation

RAJIKA TANDON

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. RAJIKA TANDON DATABASES • CSE 781 – Database Management Systems Instructor: Dr. A. Goel

  2. WHY DATABASE ? • TRADITIONAL METHOD: • In the traditional approach, information is stored in flat files which are maintained by the file system of OS. • Application programs go through the file system to access these flat files.

  3. WITH DATABASE • DBMS acts as a layer of abstraction on top of the File system. • You might have observed that, for interacting with the file system, we were using high level language functions for example, the ‘c++’ file handling functions. For interacting with the DBMS we would be using a Query language called SQL.

  4. ADVANTAGES OF A DBMS • Data independence • Reduction in data redundancy • Better security • Better flexibility • Effective data sharing • Enforces integrity constraints • Enables backup and recovery • Users and application programs need not know exactly where or how the data is stored in order to access it. • Proper database design can reduce or eliminate data redundancy and confusion. • Support for unforeseen (ad hoc) information requests are better supported - better flexibility. • Data can be more effectively shared between users and/or application programs. • Data can be stored for long term analysis (data warehousing).

  5. DATA MODEL A conceptual tool used to describe • Data • Data relationships • Data semantics • Consistency constraints

  6. RELATIONAL MODEL • Data is viewed as existing in two dimensional tables known as relations • A relation (table) consists of unique attributes (columns) and tuples (rows) • Tuples are unique • Sometimes the value to be inserted into a particular cell may be unknown, or it may have no value. This is represented by a NULL • Null is not the same as zero, blank or an empty string • Relational Database: Any database whose logical organization is based on relational data model. • RDBMS: A DBMS that manages the relational database. • Note: • Though logically data is viewed as existing in the form of two dimensional tables, actually, the data is stored under the file system only. • The RDBMS provides an abstraction on top of the file system and gives an illusion that data resides in the form of tables.

  7. KEYS Candidate key An attribute, or group of attributes, that is sufficient to distinguish every tuple in the relation from every other one. A candidate key is all those set of attributes which can uniquely identify a row. However, any subset of these set of attributes would not identify a row uniquely. Primary Key The candidate key that is chosen to perform the identification task is called the primary key. Every tuple must have, by definition, a unique value for its primary key. A primary key which is a combination of more than one attribute is called a composite primary key .

  8. KEYS Alternate Key The candidate key that is chosen to perform the identification task is called the primary key and the remaining candidate keys are known as alternate keys. No of Alternate Keys = No of Candidate Keys - 1 Super Key Any superset of a candidate Key is a super key. An attribute, or group of attributes, that is sufficient to distinguish every tuple in the relation from every other one. For example, a Customer Id,Customer Name(together)can uniquely distinguish each tuple of the relation from the other ones. Thus it satisfies the property of uniqueness. Also Customer Idcan alone distinguish each tuple of the relation from the others. Thus it too, satisfies the property of uniqueness. Each candidate key is a super key.

  9. KEYS Foreign Key • A set of attribute (s) whose values are required to match values of a Candidate key in the same or another table. • A foreign key is a “copy” of a primary key that has been exported from one relation into another to represent the existence of a relationship between them. DEPTEMP (Parent /Master/Referenced Table)(Child /Referencing Table) • Foreign key values do not (usually) have to be unique. • Foreign keys can also be null .

  10. KEYS More About Foreign Key • Foreign key values do not (usually) have to be unique. • Foreign keys can also be null . • A Foreign Key is a set of attributes of a table, whose values are required to match values of some Candidate Key in the same or another table. • The constraint that values of a given Foreign Key must match the values of the corresponding Candidate Key is known as Referential constraint. • A table which has a Foreign Key referring to its own Candidate Key is known as Self-Referencing table.

  11. KEYS • Consider employees who are also a couple • The primary key field itself will become foreign key in the same table Employee( E#, EName,…Spouse) Example of a self-referencing table

  12. KEYS Non-Key Attributes • The attributes other than the Candidate Key attributes in a table/relation are called Non-Key attributes. • These attributes do not participate in the Candidate key.

  13. EXERCISE Given a relation R(A,B,C,D) and the following attribute(s) can uniquely identify the records of relation R. 1) A 2) A,D 3) C,D Identify the following in relation R ? Candidate Key(s) Primary Key Alternate Key Key attribute(s) Non-key attribute(s)

  14. THANK YOU !!

More Related