MCS-170 The Nature of Computer Science

Fall 2006


1. Review - Database

 

2. Designing a Database

Student
    Student_ID    Number        // 8 digits
    First_Name    Text 25       // First name
    Middle_Name   Text 2        // Middle Initials
    Last_Name     Text 25       // Last Name
    Birthdate     Date    
    On-Probation  Boolean       // 0 = Good Standing, 1 = Trouble

Home_Address
    Student_ID    Number        // 8 digits
    Street_Addr   Text 100      // street address
    City          Text 25       // city
    State         Text 25       // Or province, canton, etc
    Country       Text 25      
    Post_Code     Text 10       // Many are not numbers (e.g., Canadian)

    Ease of use - allows access to student's address without extraneous info.
    Two tables are different, but linked through Student_ID key.
    Two tables have this Relationship

                                          Lives_At ------->
Student Table                                                         Home_Address Table
                                        <---------- Home_Of
Master_Record = Student JOIN Home_Base
            WHERE Student.Student_ID =
Home_Base.Student_ID

Creates
Master_Record
    Student_ID
    First_Name
    Middle_Name
    Last_Name
    Birthdate
   
On-Probation
   
Street_Addr
    City
    State
    Country
    Post_Code

3. SQL – Structured Query Language

 

 

Demo of session in class.