Presentation on theme: "A DVANCED D ATABASE M ANAGEMENT S YSTEMS Lecture no 5 September 26, 2013 Evening Class."— Presentation transcript:
A DVANCED D ATABASE M ANAGEMENT S YSTEMS Lecture no 5 September 26, 2013 Evening Class
AIM OF THE LECTURE In this very Lecture you will be able to understand; What is a Table in a Relational Model? How Tables are Created in a Relational Model (Conceptually and Practically)? And at the end there will a quiz
T ABLES AND C HARACTERISTICS The logical view of the relational database is facilitated by the creation of data relationships based on the logical construct known as a relation. A table is perceived as a two dimensional structure composed of rows and columns. Remind how tables are normally solved in Mathematics. The Creator of the Relational Model is E.F. Codd and he used the term relation as a synonym for Table.
Characteristic of a Relational Table 1. A Table is perceived as a two dimensional structure composed of rows and columns. 2. Each table row represents a single entity occurrence within the entity set. 3. Each table column represents an attribute, and each column has a distinct name. 4. Each row/ column intersection represents a single data value. 5. All values in a column must conform to the same data format. 6. Each column has a specific range of values known as the attribute domain. 7. The order of rows and columns is immaterial to the DBMS. 8. Each table must have an attribute or a combination of attributes that uniquely identify each row
C LASS A CTIVITY Okay You know the characteristics of a Relational Table. Now using this table try to analyze the table on the basis of the characteristics. Write the steps on a page. Use concept and you should understand logically what is happening in the table. Will see out of 8 characteristics how many can you find in this example.
A NALYZING THE T ABLE Try to match the table and let me know at the end how many you have listed them. 1. In the STUDENT table you have 2 dimensional structure consists of 8 rows and 12 columns. 2. Each row in a STUDENT column describes a single entity occurrence within the entity set. 3. Each column represents an attribute and each column has a distinct name. 4. All of the values in the column matches the attribute characteristics for example STU_GPA have only the Grades.
F ORMAT AND F UNCTION NB: Data must be classified according to the format and functions. While doing the last tutorial you all have noticed that some values were null. Now we can’t leave the values as nulls as it can arise so many issues. A. Numeric (You can perform arithmetic. STU- HRS and STU-GPA are examples) B. Character (where you don’t need to have mathematical operations. STU-CLASS and STU- Phone) C. Date (Julian Date Format, STU-DOB) D. Logical (Values are either true or false, STU- Transfer )
A NALYZING THE T ABLE C ONTINUED 5. The columns range of permissible value is also known as its domain. For example if you consider the STU-GPA it can not exceed 4.0. The domain therefore is [0,4] 6. The order of rows and columns is immaterial to the user. 7. Each table must have a Primary Key (PK). It is an attribute or a combination of attributes that uniquely identify each row. Lets go to the Table and try to find out the PK.
A N EXAMPLE FOR PROPER FORMAT
K EYS The Most important Key to understand is PK. Keys are important because they are used to ensure that each row in a table is uniquely identifiable. This concept is also used to establish the relationships among tables and to ensure the integrity of the data. Therefore a proper understanding of Keys in a relational model is very important.
R EADING T IME I am providing you an example taken from a real environment. Read it and you will learn the Initiative of Data Modeling taken by British Petroleum. You also had to submit me the research proposals by today, in case if you fail to submit it, I am sorry to say I will deduct marks.
K EYS PK has already been introduced. Defining and Describing the PK seem simple enough. However because the PK plays such an important role in the relational environment, you will examine the PK properties more carefully. I will give you a flavor of Super Keys, Candidate Keys and Secondary Keys. The key role is based on a concept known as Determination.
E XAMPLE OF K EYS In the context of a Database Table the statement A determines B indicates that if you know the value of Attribute A you can determine/ Look up the value of Attribute B. For instance if you consider the STU_NUM in the STUDENT table you will come up that if you know the Attribute A you can find all the remaining Attributes.
A N E XAMPLE OF A SIMPLE R ELATIONAL D ATABASE
T HE I NTEGRITY RULES Relational Database Integrity rules are very important to good database design. Many RDBMS’s enforce integrity rules automatically but it is not a rule of thumb. It varies from situation to situation. However it is much safer to make sure that your application design conforms to the entity and referential integrity rules mentioned in this chapter.
E NTITY AND REFERENTIAL INTEGRITY
R ELATIONAL S ET O PERATORS The data in relational tables are limited value unless the data can be manipulated to generate useful information. There are 8 relational operators we will have a look on the graphical context and try to understand how they manipulate to generate useful operations. The names are SELECT, PROJECT, JOIN, INTERSECT, UNION, DIFFERENCE, PRODUCT AND DIVIDE. I will cover some of them rest you have to understand yourself