Learning SQL workbook z Based on a simple model of employees and departments in a company z Workbook takes you through the basics z Workbook covers three different DBMSs yAccess yOracle yMySQL zYou can use any of the DBMSs but MySQL is preferable
UoD <> Database zUniverse of Discourse - UoD zPart of Real world of interest zPhysical,Living,Active ze.g. the real life ‘Mr Smith’ z Database z Representaton of UoD z Abstract, Symbolic, Passive z e.g. the record with employee no 7369
Schema <> Factbase zDatabase Schema zA theory of the UoD zGeneral ze.g. Emp table definition zDevelops during design z‘Static’ during use zIntension z Factbase z Facts about the UoD expressed in Schema z Specific to time, place z E.g. employee with empno=7499 has name ‘ALLEN’ z Changes during use - Sequence of States z Extension
Integrity ?? zConsistancy zFactbase agrees with Schema zInternal to DBMS zDefined in Schema - ‘integrity constraints’ zChecked by DBMS zExact zFailure causes crash z Veracity z Factbase agrees with UoD z Between DBMS and UoD z Checked by humans z ‘good enough’ - issue of Data Quality z Failure causes errors
Types of Database Function zQuery zExtracts existing facts and derives new facts zLeaves Factbase unchanged zSELECT … z Update z Reflects some change in the UoD z Changes state of factbase z Must check integrity constraints z UPDATE.., INSERT.., DELETE..
Data Model?? zData Schema ze.g. Table definitions for Member, Facility, Booking zExtension of a ‘Meta- model’ z Architectural Data Model z e.g. Relational yAccess 97, 2002 yOracle 7, 9i z or Object-oriented z Tables for yTable, Field, Relationship, Query z ‘Meta-model’
Data <> Information <> Knowledge zData - basic facts yemployee with no=7369 has sal=800 zInformation - deduced facts yThe President has 3 staff reporting yThe organisation has 4 levels of hierarchy zKnowledge - information in context yStaff turnover is low for the size of company and industry sector
Tutorial zYou will need a login on the Windows 2000 system zOpen a browser and locate the model home page zLocate the SQL workbook. It is easier to copy and paste code from the book but you have a hard-copy to keep notes in as well.