Académique Documents
Professionnel Documents
Culture Documents
SALESANDINVENTORYSYSTEMFORCHAINSTORES (AMUSEMENTCENTER)
FINALREPORT JANUARY2008
NAME: PI: PROJECTCODE: TUTOR: SUBMISSIONDATE: LEECHANGJIN K0604033 JAN08/BHICT/03 MSNORSHIDASELAMAT 24thOCTOBER2008
LEECHANGJIN(K0604033)
JAN08/BHICT/03
ABSTRACT
Methodsofdatastoringanddataprocessingarecrucialtoeverybusiness.Usually, companiesoverlookedtheprocessofderivingthedata.Aslongthedataisobtained,howit isobtainedreallydoesnotmatteranymore.Somecompaniesarestillusingpaperswith someusageofofficerelatedprogramslikeMicrosoftWordsorExceltostoreorprocess data.Usingpaperstoprocessdatacanbetimeconsumingandinefficient. Thisprojectistodemonstratethehowdatabasesystemcanbeusedtobettermanageand processdatausingstoredproceduresandtriggers.Thestrategyadoptedtoachievethe objectivesincludesprojectmanagementtobettermonitorandplanfortheprojectprogress, adoptingofthedatabaseapplicationlifecycletodevelopthedatabasesystem,reference andreviewofliteraturestoimproveoncompletingthisproject. MySQLisusedastheDBMSforthisproject.ThisprojectprovidesdetailsontheEARModel ofthedatabasesystem.Triggersandstoredproceduresarewrittenandtestedtofulfillthe systemobjectivesandanyenterpriseconstraints. Thisprojectonlycoversthedesigningandtestingofthedatabasesystem.Tobeableto implementintousablesystemstillneedintegrationtoGUIapplication.Businessesusing databasesystemtherightway,shouldhelptoautomatetediousmanualtasks,making processingdatamoreefficientandwithgreatchance,minimizeanyhumanerrorsinthe manualtasks.Areassuchassecurityissueanddistributedsystemdeploymentcanbelooked intointhefuturetoimproveonthisproject.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 2of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
ACKNOWLEDGEMENTS
Iwouldliketotakethisopportunitytoexpressmydeepestgratitudetothefollowing individualswhohavegivenmetremendoussupportandhelpincompletingmyFinalYear Project. Thankyou,MsNorishidaSelamat. ItisapleasuretohaveMsNorishidaasmyprojectsupervisor,agreattutorwithpatience andthoughtfulness.Withherworthyadviceandinvaluableguidance,shehasguidedmeon thisjourneytocompletemyFinalYearProject. IwouldliketothankAidanWeewhousedtobethebusinessmanagerofValibel TechnologiesPteLtd.Hehadsharedwithmethelimitationoftheamusementcenter operationandprovidedusefulinformationtoaidmeinmyproject.Throughhim,Ihave gottenmyprojecttitleandsystemobjectives. Iwouldliketothankmybusinesspartnerforhisextendedunderstandingandabundant patiencehehashadgivenme,allowingmetohaveabalancedcommitmentbetweenmy FinalYearProjectandmystartupbusiness. Finally,ImustthankmyMomandDadfortheirlovingcareandinestimablemoralesupport throughoutthisbumpyyear. Loveya,Mum&Dad!
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 3of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
CDROMREPORT
ThisreportincludesaCDwiththefollowingcontents. 1) FinalYearReportICT499_K0604033.doc 2) GanttChartgantt_chart_K0604033.xlsorgantt_chart_K0604033.pdf 3) Thefullschemafull_schema.sql 4) Testscripttopopulatethedatabasetest_script.sql 5) Backupdatabasek0604033_backup.sql 6) AcrobatReader9.0Installer 7) MySQLCommunityServer5.0Installer 8) MySQLGUITools5.0Installer
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 4of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
TABLEOFCONTENTS
ABSTRACT .................................................................................................................................. 2 ACKNOWLEDGEMENTS ............................................................................................................. 3 CDROMREPORT ....................................................................................................................... 4 TABLEOFCONTENTS ................................................................................................................. 5 1. INTRODUCTION ................................................................................................................. 8 1.1. 1.2. 1.3. 1.4. 1.5. 1.6. 1.7. 1.8. 1.9. 2. PROJECTTITLE ........................................................................................................... 8 PROJECTAIMS ........................................................................................................... 8 CONTEXTBACKGROUND ........................................................................................... 9 SYSTEMDEFINITION ................................................................................................ 10 SYSTEMOBJECTIVES ................................................................................................ 11 METHODOLOGYADOPTED ...................................................................................... 13 RESOURCESUSED .................................................................................................... 15 LITERATUREREVIEW................................................................................................ 16 PROJECTMANAGEMENT ......................................................................................... 18
CONCEPTUALDESIGNING................................................................................................ 21 2.1. 2.2. 2.3. 2.4. 2.5. ERDIAGRAM............................................................................................................ 21 ENTITYDEFINITION&DESCRIPTION ....................................................................... 23 RELATIONSHIPDESCRIPTION................................................................................... 24 ATTRIBUTEDESCRIPTION ........................................................................................ 26 CHANGESTOEARMODEL ....................................................................................... 32
3.
4.
PHYSICALDESIGNING ...................................................................................................... 35
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 5of81
JAN08/BHICT/03
DATABASETESTING ......................................................................................................... 43 5.1. 5.2. 5.3. 5.4. 5.5. 5.6. ENTITYTESTING ....................................................................................................... 43 REFERENTIALINTEGRITYTESTING........................................................................... 44 DATADOMAINTESTING .......................................................................................... 45 CARDINALITYTESTING............................................................................................. 45 SYSTEMOBJECTIVECHECKLIST................................................................................ 46 SYSTEMOBJECTIVETESTING ................................................................................... 48
6.
CONCLUSION ................................................................................................................... 58 6.1. 6.2. 6.3. CRITICALREVIEW&REFLECTIONS........................................................................... 58 RECOMMENDATIONS .............................................................................................. 60 CONCLUSION ........................................................................................................... 60
7.
APPENDICES..................................................................................................................... 61 7.1. 7.2. 7.3. 7.4. APPENDIXA:SQLSCHEMA ...................................................................................... 61 APPENDIXB:SQLTABLEPOPULATION .................................................................... 72 APPENDIXC:GANTTCHART .................................................................................... 75 APPENDIXD:OTHERS .............................................................................................. 77
8. 9.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 6of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
LISTSOFFIGURESANDTABLES
FIGURE1.1THEDATABASEDEVELOPMENTLIFECYCLEFORTHEPROJECT. FIGURE1.2THENETWORKDIAGRAMUSEDDURINGTHEPROJECT FIGURE1.3CRITICALPATH FIGURE2.1ERDIAGRAM FIGURE4.1CREATETABLESTATEMENTFORFACILITY FIGURE4.2TRIGGERSTATEMENTFORBEFORE_FACILITY_UPDATE FIGURE4.3STOREDPROCEDURESTATEMENTFORADDSALES FIGURE4.4FUNCTIONSTATEMENTFORCALCULATEPAYABLE FIGURE4.5VIEWCREATESTATEMENTFORFACILITYCENTERPROMOVIEW FIGURE5.1SUCCESSFULINSERTINTOTABLEFACILITYBYOMITTINGTHEPRIMARYKEY. FIGURE5.2SUCCESSFULINSERTINTOTABLEFACILITYUSINGNULLFORPRIMARYKEY. FIGURE5.3UNSUCCESSFULINSERTINGOFDATAINTOTABLEFACILITY. FIGURE5.4UNSUCCESSFULINSERTINTOTABLEFACILITYUSINGINVALIDFOREIGNKEY. FIGURE5.5UNSUCCESSFULINSERTINTOTABLEFACILITYUSINGWRONGDATATYPE. FIGURE5.6UNSUCCESSFULINSERTWITHREFERENTIALINTEGRITYERRORFORCARDINALITY CHECKING. 13 19 20 21 35 37 40 41 42 43 43 44 44 45 46
TABLE1.1WORKBREAKDOWNSTRUCTURE TABLE2.1ENTITYDEFINITION&DESCRIPTION TABLE2.2RELATIONSHIPDESCRIPTION TABLE2.3ATTRIBUTEDESCRIPTONFORFACILITY TABLE2.4ATTRIBUTEDESCRIPTIONFORARCADE TABLE2.5ATTRIBUTEDESCRIPTIONOFGAME TABLE2.6ATTRIBUTEDESCRIPTIONFORINVENTORY TABLE2.7ATTRIBUTEDESCRIPTIONFORINVENTORYLOG TABLE2.8ATTRIBUTEDESCRIPTIONFORCENTER TABLE2.9ATTRIBUTEDESCRIPTIONFORPROMOTION TABLE2.10ATTRIBUTEDESCRIPTIONFORCENTERPROMOTION TABLE2.11ATTRIBUTEDESCRIPTIONFORSALES TABLE2.12ATTRIBUTEDESCRIPTIONFORLANBILLIARDSALES TABLE2.13ATTRIBUTEDESCRIPTIONFORARCADECARDSALES TABLE2.14ATTRIBUTEDESCRIPTIONFORARCADECARD TABLE2.15ATTRIBUTEDESCRIPTIONFORMEMBER TABLE2.16ATTRIBUTEDESCRIPTIONFORREDEEMITEM TABLE2.17ATTRIBUTEDESCRIPTIONFORREDEMPTION TABLE4.1TRIGGERSDESCRIPTIONANDSCOPE TABLE4.2STOREDPROCEDUREDESCRIPTIONANDSCOPE TABLE5.1CODESTHATFULFILLINVENTORYSYSTEMOBJECTIVES TABLE5.2CODESTHATFULFILLSALESSYSTEMOBJECTIVE TABLE5.3CODESTHATFULFILLMEMBERSYSTEMOBJECTIVES 18 24 25 26 26 27 27 27 27 28 28 29 29 29 30 31 31 32 37 39 47 47 48
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 7of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
1.
INTRODUCTION
PROJECTTITLE
1.1.
1.2.
PROJECTAIMS
Ingeneral,byundergoingthisproject,itallowsmetoaccessmystandardsinplanningand managingaprojectandapplywhatIhavehadlearntinUniSIM.Settingmycriteriaand scheduletodevelopthisprojectandfulfillingthemisachallengingexperienceforme. Duringtheprocessofthisproject,Iamabletoidentifymyweaknessesinthevariousstages ofprojectmanagement.Byknowingtheseweaknesses,improvementplansweremadeand scheduledbymetoimproveonmyweakareas.Thus,theexperienceandknowledgegained bydoingthisprojectdefinitelyhelpsmebebetterinmyprojectmanagementskillinfurther projects. Adatabasesystemiswidelyusedtoprovideacentralcontrolofdatawherethedatais accessedandusedbymultipleusersfordifferentpurposes.Differentusersmightneedthe samedatafordifferentpurposes.Hence,bydevelopingadatabasesolution,itshouldsolve andenhancetheoperationallimitationfacedbythecompany.Thecompanyshouldbeable tomanageitsdatamoreefficientlywiththedatabasesystem.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 8of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
1.3.
CONTEXTBACKGROUND
Introduction ValibelTechnologiesPtdLtdisoneofthepioneersinthefamilyentertainmentbusiness. Incorporatein1983,Valibelaimstoexcelinfamilyentertainmentandtoachievetop standardsinserviceandproductstomeetitsbusinessgoals.Currently,Valibelmanagesa chainof6amusementcenters. Thefacilities Theseamusementcenterscanprovideupto3differenttypesoffacilitiesnamely,Arcade machines,LANstationsandbilliardtables.Thearcademachinesarecategoriesintodifferent genressuchasshooting,racingandsport.Eacharcademachineswillhaveitsgametitleand itscreditpriceforonegameplay.ForLANstationsandbilliardtables,customerpaysforthe usagebyhourlyrate. Inventory Thereisaninventorywarehousetoholdthefacilities.Whenafacilityrequiresservicing,itis sendtotheinventory.Afterservicingisdone,itwillbesendbacktotheformercenterif required.Newfacilityissendtotheinventorybeforedeployingtoanycenters.Thefacilities areeitherinacenterorintheinventory.Ifafacilityneedstoberelocatedtoothercenter,it hastobesentbacktotheinventoryfirstbeforedeployingtothecenter. Arcadecards Arcardcardsaresoldinallcenters.Customersarerequiredtobuyarcadecardstoplaythe arcademachines.Arcadecardsareavailableindifferenttotalcreditvaluewhichcost differently.Forexample,acustomerpaysS$5fora6dollarscreditvaluecard. Promotions Acentercanonlyhaveonepromotionatanyonetime.Thepromotioncanbefora particularfacilityorfortheentirecenter.Thepromotionwillhaveastartdateandenddate aspromotionperiod.Apromotionwillgiveadiscountoffthetotalbilleitherbyanamount
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 9of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
orbyacertainpercentagewithminimumspending.Promotionsarestrictlynotapplicableto member. Sales SalesrecordisgeneratedwhencustomersbuyarcadecardsorpayforLAN/billiardusages.If thecustomerisamember,thecustomerwillenjoymemberpricingifany.Thesalesofthe arcadecardsarerecordeddownonapieceofsalesreportformbytherespectivecounter staffofeachcenter.Theformsarecollectedfromeachcenterandsendtothemainoffice foraccountingattheendoftheday.ThesalesoftheLANstationsandbilliardtablesare managedbyaMarco32systemwheretherespectivecounterstaffprintsthesalesreceiptof eachcenterattheendoftheday.Thesalesreceiptsarealsocollectedandsendtothemain officeforaccountingattheendoftheday. ThesalesrecordsfromtheseformsandreceiptsarethenkeyedintoExcelsheetforbetter managementofthesalesdataandaccountingpurpose. Membership Acustomercanbecomeamemberbyfillingupthemembershipform.Informationtobe capturedincludesmembernumber,name,identitynumber(i.e.NRICorpassportnumber), gender,dateofbirth,address,contact,emailandoccupation.Foreveryfacilityamember hasspenton,thememberwillearnmemberpoints.Membercanusetopointstoredeem forgiftitemsandotherprizes.Memberpointswillberesetbacktozerowhenthemember expirypointdatehaspast.
1.4.
SYSTEMDEFINITION
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 10of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
1.5.
SYSTEMOBJECTIVES
Thesystemobjectivesarerepresentedinthebracketsastherespectivemodulesaliaswhich willbeuseinthisreporttorepresentaparticularsystemobjective.Forexample,thesystem objectiveofInventorySystempoint1willberepresentedasIS:Point1. InventorySystem(IS) 1. Thesystemwillbeabletoaddnewfacilityrecordsintotheinventory.Thesystemwill logthisevent. 2. Thesystemwillbeabletochangewherethefacilityistobedeployed.Iffacilityis currentlyinacenter,changingthecenterwillmovethefacilitytotheinventorytobe redeployed.Thesystemwilllogthisevent. 3. Thesystemwillbeabletomovefacilityrecordsfromcentersthatrequiremaintenance servicingbacktotheinventory.Thesystemwilllogthisevent. 4. Thesystemwillbeabletomovefacilityrecordbacktothecenteritshouldbedeployed towhenthemaintenanceservicingisdone.Thesystemwilllogthisevent. Sales(SA) 1. Thesystemwillbeabletoregisteroneparticularpromotiontoacenter. 2. Thesystemwillbeabletoensurethatacentercanonlyhaveonepromotionatanyone time. 3. Thesystemwillbeabletogeneratesalesrecordon a. Anormalbasiswhenthereisnopromotionandthecustomerisnotamember. b. Apromotionbasisifthecenterishavingapromotion. c. Amembershipbasisifthecustomerisamember. 4. Thesystemwillbeabletoensurethatthepromotionprivilegewillnotbeapplicableif thesaleisfromamember. Member(ME) 1. Thesystemwillbeabletoaccumulatethememberpointsforanysalesgeneratedby memberwhereforeveryS$0.10spent,1pointwillbeaccumulated.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 11of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 12of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
1.6.
METHODOLOGYADOPTED
Conceptual Design
Logical Design
Physical Design
Database Testing
Figure1.1Thedatabasedevelopmentlifecyclefortheproject.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 13of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
Withtherequirementsthendefiningthesystemdefinitionandobjectives,Ibeginon conceptualdesigningofthedatabasesystem.Ihaddonerevisionandreferencetohavea betterideaonhowtodotheEAR(EntityAttributeRelationship)model.Itinvolved definingtheentities,eachentrysattributes,therelationshipbetweentheentitiesandtheir description.IhaditeratedatthisstageafewtimeduetochangesontheEARmodel. LogicaldesignstageiswhereIdonetherelationshipheadingsandfinalizingthedetailsto beginondesigningandcreatingtheschema. AsIamnotverygoodwithtriggersandstoredprocedures,Ididresearchandreferencingon bookstowebsites.Iwasluckytofoundagoodbook,ProMySQL,whichgivesexcellent exampleofcreatingtriggersandstoredprocedures.Welldoingthecodes,smalltestingis donetoseeifthecodeworks.Ididnotcompleteallthecodesandscriptbeforemovingto testingstage.WhatIdidwasthatafterfinishtheinventorysystem,Ijumpedintotestingthe inventorysystemandwentbacktodebugifbugswerefound.Thisprocessiteratesforafew timesbeforeImoveontothenextmodule,salessystemandsoon.Iusedthesamemethod, forthenexttwopartsofthedatabasesystem.OnceIdoneallofthem,Ididawholesystem checkagaintoseeifthereisanyloopholesorbugsthatIhadmissed.Indeed,bugswere foundandIhadtogobacktotheconcernsareatosolvethebugs. Inaway,alotofiterationfromvariousstagestoprecedentstageoccurredwherechanges weremadeandfinetuningwasdonetothedatabasesystem.Untilallthesystemobjectives arefulfilledandtest,thatiswhenIworkedonmyreport.FromthereIdidresearchand referencingonhowtowriteagoodreport.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 14of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
1.7.
RESOURCESUSED
IhavehadvisitedNationalLibrariesandSIMslibraryforresearchandrevision.Someofthe booksthatIhadborrowedwereusedforliteratureresearch,whilesomeotherswereused togainmoreknowledgeandreviseonmyrelevantexperiencestodothisproject.National LibrariesprovideawiderrangeofbooksforreferencewhichsomewhichIrequiredcannot befoundinSIMlibrary. However,SIMLibrarydoesprovideothermaterialswhichNationalLibrariesdonothave. SIMLibraryhasprovidedacollectionofpastCapstoneProjectReportswhichIhave referencedforthecontentstructureandhowpastprojectstudentsdidtheirreport.These reportsthatIhavereferencedgavemeaninsightofthestandardofthereportandhowI canimprovisewhendoingmine. Otherthenlibraries,Ihaveusetheinternettosearchforrelevantinformationforfurther research.Surfingoninternetislikeatreasurehunt.WithGooglespowerfulsearchengine,I amabletofindworthywebsitesforreference. Acomputerwiththenecessarysoftwareinstallediscrucialforthisprojecttoo.Luckily,I havealaptopwithMicrosoftOfficeinstalled.Hence,Icanworkonmyreportevenatnight. ThoughSIMdoesprovideworkstationforstudentstouse,itisdefinitelymoreflexibleand easierwithonethatIownit.Towardstheendoftheproject,Iwillpreparemypresentation onmylaptop. AsIamusingMySQLasmyDBMS,IwouldneedtodownloadandinstallMySQLCommunity Server.IhavechosenMySQLasthisDBMSisanopensourcedatabaseandisproclaimedto betheworldsmostpopularopensourcedatabasebytheglobalcommunity.Otherthenitis free,Ihavesomeexperienceusingitsincemypolytechnicdays.IhavealsoinstalledMySQL GUIToolstoassistmeinmanagingmydatabaseforthisproject.ItprovidesGUIfeaturesfor metointeractwiththeDBMSwithmuchease. Meetingroomorstudyareaisalsooneoftheresourcesrequired.Ihavehadmonthly meetingwithmytutortofollowuptheprojectstatusandenquireformytutorsadvice.Our tutorwillbookameetingroominSIMforthemonthlymeeting.Onceinawhile,Iwould meetupwithotherstudentsdoingthe499capstoneprojecttoshareandhelpeachother. WeusuallymeetupinSIMandgrabanyavailablestudyareaorusetheopenlabsession available.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 15of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
1.8.
LITERATUREREVIEW
FormoreinformationregardingthematerialsthatIhavereferenced,refertoReference sectionattheendofthisreport. DatabaseSystems(Book) IfoundthisbookintheUniSIMlibrarywhenlookingfordatabaserelatedinformationformy project.ThisbookprovidesalotofinformationwhichIusedittoguidemeindoingthe project. First,mySDLCisderivedfromthisbook,Chapter9,section9.2,TheDatabaseApplication Lifecycle.Ireferencethediagramonpage272anduseditasaguidancetostructuremy SDLC.Intheend,IuseditstermDatabaseApplicationLifecycleinsteadofSDLC.The DatabaseApplicationLifecycleissimilartoofaSDLCwhichconsisttherequirement gathering,designingandtestingofthesystem. Ialsoreferencechapter11,EntityRelationshipModelingtogetsomeguidelinetoworkon myERdiagram.ParticularlyonSection11.3,Attributes,tofamiliarizewiththedifferenttype ofattributesnamelysingle,composite,multivalued,derivedandkeys. However,thisbookisusefulformyconceptualdesignwhereithelpmeplanandsetmyER model.ItdoesnotprovidemuchhelpintriggerandstoredprocedurewhichIwillneedto getfamiliarizestoworkonmyphysicaldesignstageofthedatabasesystem.Itisnota wonderbookbutitdidhelpmegetstarted. ProMySQL(Book) DuringmyICT315courseinschool,triggerandstoredprocedureistaughtonlyonthe surface,weweretaughttoknowthepseudocodeforthetriggerbutnotreallygoindepth totryit.Hence,triggerandstoredprocedureisoneareaImustresearchon.Thisbookis introducedtomebymyfriend,asIwasaskingaroundifthereareanygoodbookswhich teachtriggerandstoredprocedureonMySQL.ImanagedtofinditinWestMallNational Library. Onthecover,itquotesTheExpertsVoiceInOpenSource.Indeed,itgivesmegreatdetails oncreatingtriggers,storedprocedureandmore.Allmycodeswouldnotbepossiblewithout thisbook.Ihadtriedouttheirexampletriggerandstoredprocedurebeforeworkingon mine.Chapter9,StoredProcedures,BuildingStoredProcedureonPage354,teachesthe creatingofstoredprocedureinastepbystepexplanationwhichIfollowedclosely.Samefor Chapter10onFunctionsandChapter11onTriggers,itguidedmeoncreatingmySQL schema.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 16of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
Ifsomeoneislearninghowtousetrigger,storedprocedureandfunctionsonMySQL,Iwill surelyrecommendthisbooktohim/her.Itisabookthatcoversaveryspecificarea;people withspecializedneedonMySQLwillfinditveryuseful.Thisbookhasgivenmygreat assistanceincompletingmyphysicaldesignandSQLschema.Fromthere,Iwasabletomove ontotestingtheschema. MySQL5.0ReferenceManual ThismanualisonematerialIcannotmissoutasIwanttoknowmoreaboutMySQL.Itcovers mostofthegeneralinformationaboutMySQL.Asitisavailableeasilyonline,Ijustneedan internetconnectionbrowseitorIcanevendownloadittomycomputer. Ireferencedchapter10,DataType,whichgiveageneraldescription,enoughforunderstand andapplication,ofallthedatatypeusedinMySQL.ThereiswhereIfoundtheusageof stringdatatypeENUMwillonlygiveavaluefromalistofvalues. Chapter12SQLStatementsyntax,12.1.9CreateTablesyntax,isasectionIusedtocheckmy CREATEstatementandforexplanationinmyreport.Ialsoreferenceothersectionon CREATEtriggersyntax,storedprocedureandfunctions.Anywayinmyopinion,itisjusta referencemanualwithoutgoodexampleandexplanations. ItisagoodsourcetogettoknowMySQLandprovidesomegeneralinformationtotheareaI amlookingfor.However,ifIwanttoknowmoreindepthinformationonaspecificarea,I willneedtosourceforbettermaterials. AGuidetotheProjectManagementBodyofKnowledge(Book) IgottoknowthisbookfrommyICT317course.Itisgiventomeonthelastdayofcourse. Thoughthepublicationisfouryearsago,itisstillaverygoodbookonprojectmanagement. Ireferencedonthechapter,ProjectScopeManagementonpage103topage118onthe guidelinestoplanmyprojectscopeandderivemyworkbreakdownstructure(WBS).Some referenceonpage131toknowmoreaboutnetworkdiagram. Thoughthebookdoesgivegoodknowledgeofprojectmanagementbutitservesmorelike guidelinestome.Asthisprojectisaonemanshowinsteadofateam,thebookisgoodfor theoriesreading,notfortryingthemout.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 17of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
1.9.
PROJECTMANAGEMENT
WorkBreakdownStructure Thisistheworkbreakdownstructureafterthecompletionoftheprojectwithoutthepotion ontheinitialreportandpresentation. Task 3. GatherRequirements 3.1. Literaturestudy 3.2. Interviewwithkeypersonnel 3.2.1.Prepareinterviewquestions 3.2.2.Conductinterview 4. DatabaseDesign 4.1. Conceptualdesign 4.1.1.Literaturestudy 4.1.2.RequirementAnalysis 4.1.3.Identifyentityandrelationshiptypes 4.1.4.Identifyattributesforentityandrelationship 4.1.5.Determineattributedomains 4.1.6.Determinecandidateandprimarykeyattributes 4.2. Logicaldesign 4.2.1.Literaturestudy 4.2.2.DefinetherelationshipHeadings 4.3. Physicaldesign 4.3.1.Literaturestudy 4.3.2.CreateTableStatements 4.3.3.TriggerStatements 4.3.4.StoredProceduresStatements 4.3.5.FunctionStatements 4.3.6.ViewStatements 5. DatabaseTesting 5.1. Literaturestudy 5.2. Implementingoftables 5.3. Populatedata 5.4. Testingofschemas 6. FinalReport 6.1. Literaturestudy 6.2. Doingoffinalreport
Table1.1WorkBreakdownStructure
Estimated Time 9hrs 4hrs 5hrs 4hrs 1hr 104hrs 38hrs 10hrs 4hrs 6hrs 8hrs 4hrs 6hrs 16hrs 6hrs 10hrs 50hrs 10hrs 8hrs 8hrs 8hrs 8hrs 8hrs 80hrs 10hrs 10hrs 10hrs 50hrs 70hrs 10hrs 60hrs
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 18of81
LEECHANGJIN(K0604033) NetworkDiagram
Figure1.2Thenetworkdiagramusedduringtheproject
JAN08/BHICT/03
Conceptual Design
LogicalDesign
Triggers Statements
TestTriggers Statements
Function Statements
TestFunction Statements
View Statements
TestView Statements
Report
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 19of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 20of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
2.
CONCEPTUALDESIGNING
ERDIAGRAM
2.1.
Inventory facilityNo{PK} toDeployAt stores 1..1 Arcade facilityNo{PK} {Optional} plays 1..1 Game gameNo{PK} gameTitle genre 1..N LanBilliardSales salesNo{PK} startTime endTime 1..N
has
relatesTo hosts 1..1 ArcadeCard arcadeCardNo{PK} normalCardPrice memberCardPrice cardValue {Mandatory, Or} Sales salesNo{PK} salesType salesDatetime amtPayable 1..N generates Redemption memberNo{PK redeemItemNo{PK} redeemDatetime{PK} 1..N belongsTo 1..1 RedeemItem redeemItemNo{PK} redeemDesc pointsCost 1..1 Member memberNo {PK} name 1..1 1..N identityNo makes gender dob address email contact occupation memberCardNo joinedDate points pointsExpiry
1..N CenterPromotion centerNo{PK} promotionNo{PK} startdate{PK} enddate{PK} 1..N appliesTo 1..1 Promotion promotionNo{PK} description rateType rate minSpent promoType
Figure2.1ERDiagram
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 21of81
JAN08/BHICT/03
4. 5. 6. 7. 8.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 22of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
2.2.
Entity Facility
ENTITYDEFINITION&DESCRIPTION
Definition/Description (facilityNo, facilityType, facilityStatus, normalPrice, memberPrice) Each instance of Facility holds details of a facility which can be a LAN-station, a billiard table or an arcade machine.
Arcade
Game
(gameNo, gameTitle, genre) Each instance of Game holds the details of the game played on an arcade machine.
Inventory
(facilityNo, toDeployAt) There is only an instance of Inventory which record the facilities that are under-servicing and newly purchased.
InventoryLog
(facilityNo, invLogDatetime, invDescription) Each instance of InventoryLog records the logging details of a particular facility in the inventory.
Center
(centerNo, name) Each instance of Center holds the details of an amusement center.
Promotion
(promotionNo, promoDescription, rateType, rate, minSpent, promoType) Each instance of Promotion holds the details of a promotion.
CenterPromotion
(centerNo, promotionNo, startDate, endDate) Each instance of CenterPromotion records an amusement center having a particular promotion.
Sales
(salesNo, salesType, salesDateTime, amtPayable, memberNo) Each instance of Sales records the sales details.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 23of81
JAN08/BHICT/03
Each instance of LanBilliardSales records the sales details of a particular facility. ArcadeCard (arcadeCardNo, normalCardPrice, memberCardPrice, cardValue) Each instance of ArcadeCard holds the details of an arcade card type. ArcadeCardSales (salesNo, arcadeCardNo, centerNo) Each instance of ArcadeCardSales records the sales details of a particular arcade card. Member (memberNo, name, identityNo, gender, dob, address, email, contact, occupation, memberCardNo, joinedDate, points, pointsExpiry) Each instance of Member holds details of an individual member. RedeemItem (redeemItemNo, redeemDesc, pointCost) Each RedeemItem holds the details of a redeemable item. Redemption (memberNo, redeemItemNo, redeemDateTime) Each Redemption records the details of a redeemable item redeemed by a particular member.
Table2.1EntityDefinition&Description
2.3.
RELATIONSHIPDESCRIPTION
Description/Justification An Inventory stores Facilities. An Inventory can be empty, but a Facility must be either in an Inventory or Center.
Relationship stores
willHave
A Facility will have InventoryLogs. A Facility has InventoryLogs, but an InventoryLog must belong to a Facility.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 24of81
JAN08/BHICT/03
A Center must have at least one Facilities but Facility must be either in an Inventory or Center. plays An Arcade plays a game. An Arcade plays one game, but a game can be played on many Arcades. creates A Facility creates LanBilliardSales. A Facility can creates many LanBilliardSales, but a LanBilliardSales must be from a Facility. hosts A Center hosts a CenterPromotion. A Center can hosts one CenterPromotion at any one time, but a CenterPromotion must belong to a Center. appliesTo A promotion is applied to CenterPromotions. A promotion can be applied to many CenterPromotions, but a CenterPromotion must have a Promotion makes A Center makes ArcadeCardSales. A Center can makes many ArcadeCardSales, but an ArcadeCardSales must be from a Center. relatesTo An ArcadeCard is related to each ArcadeCardSales. An ArcadeCard can be related to many ArcadeCardSales, but an ArcadeCardSales must have an ArcadeCard. generates A Member generates Sales. A Member can generates many Sales, but a Sales need not be from a Member. makes A Member makes a Redemption. A Member can makes many Redemptions, but a Redemption must be applied from a Member. belongsTo A RedeemItem belongs to each Redemption. A RedeemItem can belongs to many Redemption, but a Redemption must have a RedeemItem.
Table2.2RelationshipDescription
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 25of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
2.4.
Facility
ATTRIBUTEDESCRIPTION
Attribute facilityNo
Description Primary key of each facility Either: lan for LAN station, bill for Billiard table, arc for Arcade machine Either: 0 for Maintance, 1 for Operational For LAN station and billiard table will be hourly rate. For arcade machine will be the credit price for one play. E.g. 7.50 Same as above, only the price is of member rate for the facilities. E.g. 7.50
Null No
facilityType
Enum(lan,bill,arc) No
facilityStatus
Enum(0,1)
No
normalPrice
Decimal(5,2)
No
memberPrice
Decimal(5,2)
Yes
Table2.3AttributeDescriptonforFacility
Description
Null No
Game Attribute GameNo Primary key of the game Int(10) No Description Data type Null
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 26of81
LEECHANGJIN(K0604033) gameTitle Arcade machines game title. E.g. Time Crisis 4 Arcade machines game genre. E.g. Shooting Text
JAN08/BHICT/03
No
genre
Text
No
Table2.5AttributeDescriptionofGame
Inventory Attribute facilityNo Foreign key of FACILITY The center number the facility is going to be deployed at. Int(10) No Description Data type Null
toDeployAt
Int(10)
Yes
Table2.6AttributeDescriptionforInventory
InventoryLog Attribute facilityNo Foreign key of FACILITY Datetime of this action from inventory. E.g. 2008-10-01 18:20:00 Description of the action from inventory Int(10) No Description Data type Null
invLogDatetime invDescription
Datetime Text
No No
Table2.7AttributeDescriptionforInventoryLog
Center Attribute centerNo Primary key of the center name Int(10) No Description Data type Null
Text
No
Table2.8AttributeDescriptionforCenter
Promotion
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 27of81
LEECHANGJIN(K0604033) Attribute promotionNo Primary key of promotion promoDescription Promotion details Either: amt which means amount. per which means percentage. The rate for the discount. E.g. rate is 5 and rateType is percentage. It will be a 5% discount. Else it will be an S$5 discount. Minimum spending of a customer in order to enjoy this promotion Either: lan for LAN station, bill for Billiard table, arc for Arcade machine Text Int(10) Description Data type
JAN08/BHICT/03 Null No
No
rateType
Enum(amt,per)
No
rate
Int(3)
No
minSpent
Int(2)
No
promoType
Enum(lan,bill,arc,all) No
Table2.9AttributeDescriptionforPromotion
CenterPromotion Attribute centerNo Composite Primary Key promotionNo Composite Primary Key Composite Primary Key; start date of this promotion for this center Composite Primary Key; end date of this promotion for this center Int(10) No Int(10) No Description Data type Null
startDate
Datetime
No
endDate
Datetime
No
Table2.10AttributeDescriptionforCenterPromotion
Sales
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 28of81
LEECHANGJIN(K0604033) Attribute salesNo Primary key of a sales record Either: lan for LAN station, bill for Billiard table, arc for Arcade machine Datetime of this sales record E.g. 2008-10-01 18:20:56 Computered attribute; amount to be paid by customer E.g. 39.70 Int(10) Description Data type
JAN08/BHICT/03 Null No
salesType
Enum(lan,bill,arc) No
salesDatetime
Datetime
No
amtPayable
Decimal(10,2)
No
Table2.11AttributeDescriptionforSales
LanBilliardSales Attribute salesNo Primary key of the sales record Start time when customer used the LAN station or Billiard table E.g. 18:20:56 End time when customer used the LAN station or Billiard table E.g. 18:20:56 Int(10) No Description Data type Null
startTime
Time
No
endTime
Time
No
Table2.12AttributeDescriptionforLanBIlliardSales
Description
Null No
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 29of81
LEECHANGJIN(K0604033) ArcadeCard Attribute arcadeCardNo Primary key for the arcade card normalCardPrice Description
JAN08/BHICT/03
Null No
Cost price of arcade card E.g. 5.00 Member cost price of arcade card E.g. 4.00 The credit value in the card E.g. 6.00
Decimal(5,2)
No
memberCardPrice
Decimal(5,2)
No
cardValue
Decimal(5,2)
No
Table2.14AttributeDescriptionforArcadeCard
Member Attribute memberNo Primary key for member name Name of member identityNo NRIC or passport number Gender. Either: M for Male, F for Female Date of birth E.g. 1980-10-01 text No text No Int(10) No Description Data type Null
gender
Enum(M,F)
No
dob
Date
No
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 30of81
LEECHANGJIN(K0604033) contact Contact number occupation Occupation Member card number allocated to the member Date of customer becomes a member E.g. 2000-10-01 Computered attribute; points member has for redemption Date of expiry for the points E.g. 2009-10-01 Text
JAN08/BHICT/03
Int(10)
No
No
memberCardNo
Int(10)
No
joinedDate
Date
No
Points pointsExpiry
Int(10)
No
Date
No
Table2.15AttributeDescriptionforMember
RedeemItem Attribute redeemItemNo Primary key for redeem item redeemDesc Redeem item description pointsCost Text No Int(10) No Description Data type Null
Int(10)
No
Table2.16AttributeDescriptionforRedeemItem
Redemption Attribute memberNo Composite Primary Key redeemItemNo Composite Primary Key Int(10) No Int(10) No Description Data type Null
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 31of81
JAN08/BHICT/03
Datetime
No
Table2.17AttributeDescriptionforRedemption
2.5.
CHANGESTOEARMODEL
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 32of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
3.
LOGICALDESIGNING
RELATIONALHEADINGS
3.1.
Facility (facilityNo, CenterNo, facilityType, facilityStatus, normalPrice, memberPrice, gameNo) Changes: Arcade entity is being merged to Facility entity. This is done to remove generalization of the entity. The supertype will hold the attributes of the subtype. Game (gameNo, gameTitle, genre)
Sales (salesNo, salesType, salesDateTime, amtPayable, memberNo, startTime, endTime, facilityNo, arcadeCardNo, centerNo) Changes: LanBilliardSales entity and ArcadeCardSales entity are merged to Sales entity.
Member (memberNo, name, identityNo, gender, dob, address, email, contact, occupation, memberCardNo, joinedDate, points, pointsExpiry)
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 33of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 34of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
4.
PHYSICALDESIGNING
CREATETABLESTATEMENTS
4.1.
Figure4.1CREATETABLEstatementforFacility
ThesyntaxforCREATETABLEstatementscanbeeasilyobtainedfromMySQLdocumentation inMySQLhomepage. Line1startstheCREATETABLEstatementforcreatingthetablenamedfacility. Line2toline8definesthecolumnnameofthetable.Eachcolumnnamewillneedtodefine thecolumndefinitions.Usuallythedatatype,lengthofdatatypeifany,ifitcanbeNULLor NOTNULLandifithasaDEFAULTvalue.UNSIGNEDisusedtodefineanumericdatatype thatcannothavenegativevalue.AUTO_INCREMENTisusedtogenerateauniqueidentifier fornewrows,usuallyusedonaprimarykeycolumn.ENUMisanenumerationstringobject datatypebyMySQLwhichcanonlyhaveonevaluefromalistofvalues. Line9definesthePRIMARYKEYofthetable.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 35of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
Line10andline11definestheKEYthatneedtobeindexedforfasterretrievalofrow. BTREE,atreedatastructure,istheindextypeusedforindexing. Line12andline13definestheforeignkeyconstraintforthetable. Line14andline15definesthereferentialactionsfortheforeignkey.ONDELETENO ACTIONdefinesthatnoactionistobetakenwhenDELETEstatementisexecutedonthe referencedrowthatexistinthechildrow.ONUPDATECASCADEdefinesthatwhenUPDATE statementisexecutedonthereferencedrow,therespectivechildrowsmatchingtheforeign keywillbeupdatedaswell. Line20definestheDBMSengineforthetable.InnoDBisusedasitistheenginethatobeys thereferentialintegrityprotocol.DEFAULTCHARSETdefinesthedefaultcharactersetforthe tablewhichusestheUTF8unicodecharacterset.
4.2.
TRIGGERSTATEMENTS
Thetablebelowdefinesthetriggersusedforthesystemwithabriefdescriptionofthe triggerusageanditsscope. TriggerName before_facility_insert Description/Scopeoftrigger Thetriggertobeexecutedbeforearecordisinsertedinto facilitytable. 1. Toeraseanycenternumberwhencreatingfacility. 2. ToeraseanygamenumberwhenfacilityisnotanArcade. 3. Tocheckifgamenumberisprovidewhenfacilityisan Arcade. Thetriggertobeexecutedafterarecordisinsertedinto facilitytable. 1. Tosetthenewfacilityintheinventory(IS:Point1) 2. Dotheloggingofthisevent.(IS:Point1) Thetriggertobeexecutedbeforearecordisupdatedinthe facilitytable. 1. Iffacilityneedsmaintenance,movethefacilityto inventoryandlogthisevent.(IS:Point3) 2. Iffacilityisoperational,movethefacilitybacktothe centerandlogthisevent.(IS:Point4) 3. Iffacilityneedstoredeploytoanothercenter,senditback
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 36of81
after_facility_insert
before_facility_update
LEECHANGJIN(K0604033)
after_sales_insert
Table4.1Triggersdescriptionandscope
Ihavepickedthetriggerbefore_facility_updatewhichhasthemostcomplexcode toexplain.Theothertriggersmoreorlesshavethesameformatandstructure.
1. DELIMITER // 2. CREATE TRIGGER `before_facility_update` BEFORE UPDATE ON facility 3. FOR EACH ROW 4. BEGIN 5. SET @facilityStatus = NEW.facilityStatus; 6. SET @facilityStatusOld = OLD.facilityStatus; 7. SET @facilityNo = NEW.facilityNo; 8. SET @centerNo = NEW.centerNo; 9. SET @centerNoOld = OLD.centerNo; 10. 11. IF @facilityStatus = 0 THEN 12. INSERT INTO inventory (facilityNo, toDeployAt) 13. VALUES (@facilityNo, @centerNo); 14. CALL LogInventory(@FacilityNo,@centerNo,2); 15. SET NEW.centerNo = NULL; 16. END IF; 17. 18. IF @facilityStatus = 1 AND @facilityStatus != @facilityStatusOld THEN 19. SET NEW.centerNo = (SELECT toDeployAt FROM inventory WHERE facilityNo = @facilityNo); 20. 21. DELETE FROM inventory WHERE facilityNo = @facilityNo; 22. CALL LogInventory(@facilityNo,NEW.centerNo,3); 23. END IF; 24. 25. IF @centerNoOld <> @centerNo AND @facilityStatus = '1' THEN 26. INSERT INTO inventory (facilityNo, toDeployAt) 27. VALUES (@facilityNo, @centerNo); 28. CALL LogInventory(@facilityNo,@centerNo,4); 29. SET NEW.centerNo = NULL; 30. SET NEW.facilityStatus = '0'; 31. END IF; 32. 33. END 34. // 35. DELIMITER;
Figure4.2Triggerstatementforbefore_facility_update
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 37of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
Line2startsthecreatestatementforthetrigger.BEFOREUPDATEONdefinesthatthe triggeristobeexecutedbeforeupdateisdonetothefacilitytable. Line3definesthatthescopeofthetriggerisexecutedforeachrowinserted. Line4definesthestartofthetrigger. Line5toline9definestheuserdefinedvariablesusedinthetrigger. Line10toline16definesthescopeofPoint1mentionedabove:Iffacilityneeds maintenance,movethefacilitytoinventoryandlogthisevent. Line18toline23definesthescopeofPoint2mentionedabove:Iffacilityisoperational, movethefacilitybacktothecenterandlogthisevent. Line25toline31definesthescopeofPoint3mentionedabove:Iffacilityneedstoredeploy toanothercenter,senditbacktotheinventoryfirst. Line33definestheendofthetrigger.
4.3.
STOREDPROCEDURESTATEMENTS
Thetablebelowdefinesthestoredprocedureusedforthesystemwithabriefdescriptionof thestoredprocedureusageanditsscope. StoredprocedureName Description/Scopeofstored procedure AddaFacility MoveFacilitytoInventory MoveFacilitytoCenter ChangetheCenterofFacility Loggingofeventintheinventory AddaSalesrecordforLANstationand billiardfacilitytype. AddaSalesrecordforanarcadecard sales AddPromotiontoaCenter AddpointstotheMember SystemObjectives
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 38of81
Table4.2Storedproceduredescriptionandscope
IhavepickedthestoredprocedureAddSalestoexplain,whichhasthemostcomplex code.
1. DELIMITER // 2. CREATE PROCEDURE `AddSales` 3. ( 4. facNo INTEGER, 5. startTime TIME, 6. endTime TIME, 7. memNo INTEGER 8. ) 9. proc:BEGIN 10. SET @price = 0.0; 11. SET @facilityNo = facNo; 12. #Check IF member number is valid. IF not valid, leave procedure. Only NULL or valid member number is accepted. 13. IF memNo IS NOT NULL THEN 14. IF isMember(memNo) IS NOT NULL THEN 15. SET @memberNo = memNo; 16. SET @Price = getMemberPrice(@facilityNo); 17. ELSE 18. SELECT 'Procedure call ends. Member does not exist. ' AS Error; 19. LEAVE proc; 20. END IF; 21. ELSE 22. SET @memberNo = NULL; 23. SET @price = getNormalPrice(@facilityNo); 24. END IF; 25. 26. SET @centerNo = getFacilityCenter(@facilityNo); 27. IF @centerNo IS NOT NULL THEN 28. SET @facilityType = getFacilityType(@facilityNo); 29. IF @facilityType != 'arc' THEN 30. SET @amtpayable = calculatePayable(startTime,endTime,@price,@centerNo,@facilityType, @memberNo); 31. INSERT INTO sales VALUES (NULL,@facilityType,NOW(),@amtpayable,@memberNo,startTime,endTime, @facilityNo,NULL,@centerNo); 32. ELSE 33. SELECT 'Facility type is Arcade. Not Applicable for this procedure call.' AS Error; 34. END IF; 35. ELSE 36. SELECT 'Facility is in Inventory or invalid.' AS Error; 37. END IF; 38. END proc; 39. //
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 39of81
LEECHANGJIN(K0604033)
40. DELIMITER ;
Figure4.3StoredprocedurestatementforAddsales
JAN08/BHICT/03
Line2startsthecreatestatementforthestoredprocedure. Line3toline8definestheparametersneededforthestoredprocedure. Line9definesthestartofthestoredprocedurewithprocasthelabelfortheblockcode. Line10andLine11initializessomeuserdefinedvariables. Line13toLine24willsetthepriceforamemberornonmemberandthemembernumber ifany.Thecodescheckifthemembernumberisvalid.Ifmembernumberisnotvalid, LEAVE procstatementwillexittheblockcode.OnlyNULLvalueorvalidmembernumber isaccepted. Line26isusedtogetthecenternumberofthefacility. Line27checkifthefacilityisinacenter,thengoestoline28.Ifnotinacenter,goestoline 36. Line28getsthefacilitytypeofthefacility. Line29toline34checksifthefacilitytypeisnotanArcade,thencalculatethepayableusing functioncalculatePayableandaddthesalesrecord.IfitisanArcade,thenshowsan errorthatthistransactionisnotapplicableforarcadefacility. Line36checkiffacilityisnotinacenter,showsanerrorthatthisfacilityisininventory. Line38definestheendofthisstoredprocedure.
4.4.
FUNCTIONSTATEMENTS
LEECHANGJIN(K0604033)
JAN08/BHICT/03
9. SET @minspent = getPromotionMinimumSpent(@centerNo); 10. SET @amtPayable = TIME_TO_SEC(TIMEDIFF(endTime,startTime))/3600 * price; 11. IF @memberNo IS NULL AND @promoType != 'arc' AND @promoType = @facilityType AND @amtPayable >= @minspent THEN 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. SET @rateType = getPromotionRateType(@centerNo); SET @rate = getPromotionRate(@centerNo); IF @rateType = 'per' THEN SET @amtPayable = @amtPayable - (@amtPayable*@rate/100); ELSE SET @amtPayable = @amtPayable - @rate; END IF; END IF; SET @result = CAST(@amtPayable AS DECIMAL(10,2)); RETURN @result; END code; // DELIMITER;
Figure4.4FunctionstatementforcalculatePayable
Line2startsthecreatestatementforthefunctionwiththeparametersneededforthe function. Line3definesthereturndatatypeforthisfunction Line4definesthestartofthefunctionwithcodeasthelabelfortheblockofcodes. Line5to7definessomeuserdefinedvaluesrequiredinthefunction Line8callsafunctiontoobtainthepromotiontype. Line9callsafunctiontoobtaintheminimumexpendituretoqualifyforthepromotion. Line10calculatesthenormalpayableormemberpayableforthefacilityusage. Line11doesafewcheckstovalidateifthepayablequalityforthepromotiondiscount.The criteriaincludesthatthepayableisnotfromamember,thepromotiontypeisnotforan Arcade,thepromotiontypematchesthefacilitytypeandtheminimumpayableisatleast met. Line12andline13getsthepromotionratetypeandraterespectively. Line14toline18calculatesthediscounttobegiven. Line20setsthevaluetobereturned Line21returnsthevaluetothecaller. Line22definestheendofthefunction.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 41of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
4.5.
VIEWSTATEMENTS
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 42of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
5.
DATABASETESTING
ENTITYTESTING
5.1.
Figure5.1SuccessfulinsertintotableFacilitybyomittingtheprimarykey.
Figure5.2SuccessfulinsertintotableFacilityusingNULLforprimarykey.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 43of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
Figure5.3UnsuccessfulinsertingofdataintotableFacility.
5.2.
REFERENTIALINTEGRITYTESTING
Figure5.4UnsuccessfulinsertintotableFacilityusinginvalidforeignkey.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 44of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
5.3.
DATADOMAINTESTING
Figure5.5UnsuccessfulinsertintotableFacilityusingwrongdatatype.
5.4.
CARDINALITYTESTING
CREATE TRIGGER `before_facility_insert` BEFORE INSERT ON facility FOR EACH ROW BEGIN
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 45of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
IF NEW.facilityType = 'arc' AND NEW.gameNo IS NULL THEN SET NEW.gameNo = 'gameNo_not_defined'; END IF;
Figure5.6Unsuccessfulinsertwithreferentialintegrityerrorforcardinalitychecking.
Ontheotherhand,Figure5.2demonstratesasuccessfulinsertquerywheninsertanon Arcadefacility(LANStation)withgameNovalueasNULL.
5.5.
SYSTEMOBJECTIVECHECKLIST
Thischecklistisanoverviewofwhichtriggersandstoredproceduresareusedtofulfillthe systemobjective.Thereareacoupleofcommonfunctionswhicharenotlistedasthose functionsarecalledwithinthetriggerorstoredprocedures.PleaserefertotheAppendixA: SQLSchemaformoreinformationonthefunctions. InventorySystem SystemObjective 1. Thesystemwillbeabletoaddnew facilityrecordsintotheinventory.The systemwilllogthisevent. Trigger/StoredprocedureUsed Store:AddFacility Trigger:before_facility_insert Trigger:after_facility_insert Store:LogInventory Store:InvChangeCenter Trigger:before_facility_update Store:LogInventory
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 46of81
LEECHANGJIN(K0604033) centerwillmovethefacilitytothe inventorytoberedeployed.Thesystem willlogthisevent. 3. Thesystemwillbeabletomovefacility recordsfromcentersthatrequire maintenanceservicingbacktothe inventory.Thesystemwilllogthisevent. 4. Thesystemwillbeabletomovefacility recordbacktothecenteritshouldbe deployedtowhenthemaintenance servicingisdone.Thesystemwilllogthis event.
Table5.1CodesthatfulfillInventorysystemobjectives
JAN08/BHICT/03
Store:AddPromotionToCenter
3. Thesystemwillbeabletogeneratesales Store:AddSales OR recordon Store:AddSalesArcadeCard a. Anormalbasiswhenthereisno promotionandthecustomeris notamember. b. Amembershipbasisifthe customerisamember. c. Apromotionbasisifthecenteris havingapromotion. 4. Thesystemwillbeabletoensurethat thepromotionprivilegewillnotbe applicableifthesaleisfromamember.
Table5.2CodesthatfulfillSalessystemobjective
Store:AddSales OR Store:AddSalesArcadeCard
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 47of81
LEECHANGJIN(K0604033) Member SystemObjective 1. Thesystemwillbeabletoaccumulate thememberpointsforanysales generatedbymemberwhereforevery S$1spent,10pointswillbe accumulated. 2. Thesystemwillbeabletoensurethat thememberhassufficientmember pointsfordeductionbeforeregistering anyredemptionmadebythemember. 3. Thesystemwillbeabletoresetthe memberpointsbacktozerowhenthe memberpointexpirydatehaspast.A newmemberpointexpirydatewillbe givenbythesystem.
Table5.3Codesthatfulfillmembersystemobjectives
JAN08/BHICT/03
Store:RedeemItem Store:AddPoints
Store:MemberPointChecking
5.6.
SYSTEMOBJECTIVETESTING
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 48of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
Figure5.7aSuccessfulexecutingofstatement.
Figure5.7bFacility1isinserted.
Figure5.7cFacility1isintheinventory.
Figure5.7dThiseventislogged.
LEECHANGJIN(K0604033)
JAN08/BHICT/03
Currently,thereare2facilities.Facility1isininventoryandFacility2isinCenter1.Facility1 doesnothaveanyCenterappointedtoit.
Figure5.8aFacility1hasnotallocatedacenterandFacility2isinacenter.
Figure5.8bFacility1isininventorywithnocenterallocatedyet.
Figure5.8cFacility2issentbacktoinventoryuponchangingcenter.
Figure5.8dFacility2isintheinventory.Bothfacilitiesareallocatedacentereach.
Figure5.8eThiseventislogged.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 50of81
LEECHANGJIN(K0604033) InventorySystem,SI:Point3&Point4
JAN08/BHICT/03
3)Thesystemwillbeabletomovefacilityrecordsfromcentersthatrequiremaintenance servicingbacktotheinventory.Thesystemwilllogthisevent. 4)Thesystemwillbeabletomovefacilityrecordbacktothecenteritshouldbedeployedto whenthemaintenanceservicingisdone.Thesystemwilllogthisevent. Statementforexecution: A. CALLInvToCenter(1); Result: IhaveusedPoint4todothetestingasbothservesimilarfunctionality.Currentlyboth facilitiesareintheinventory.ExecutingthestatementshowsthatFacility1issentto Center1andthiseventislogged.ThisdemonstratesthatthesystemfulfillsPoint4aswellas Point3.
Figure5.9aFacility1isinCenter1afterexecutingthestatement.
Figure5.9bFacility1isnotintheinventoryafterexecutingthestatement.
Figure5.9cThiseventislogged.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 51of81
JAN08/BHICT/03
Figure5.10aCenter1ishavingapromotion.
Figure5.10bCenter1cannothaveanotherpromotion.
LEECHANGJIN(K0604033)
JAN08/BHICT/03
4)Thesystemwillbeabletoensurethatthepromotionprivilegewillnotbeapplicableifthe saleisfromamember. Statementforexecution: A. CALLAddSales(3,'11:00:00','15:00:00',NULL); B. CALLAddSales(1,'11:00:00','15:00:00',NULL); C. CALLAddSales(1,'11:00:00','18:00:00',NULL); D. CALLAddSales(1,'11:00:00','15:00:00',1); E. CALLAddSales(1,'11:00:00','18:00:00',1); Result: Currently,Center1ishavingPromotion7whichstatesthatanyLANstationusageof$15and morewillhavea10%deduction.ExecutingStatement(A)generatessalesrecordfor Facility3,aBilliardTable.4hoursofbilliardat$7perhourscost$28andthecenterishaving promotionforLANstation.ThisdemonstratethesystemfulfilltheobjectiveofPoint3(a).
Figure5.11aSalesrecordgeneratedfromexecutingStatement(A).
Figure5.11bNewsalesrecordgeneratedfromexecutingStatement(B)&(C).
LEECHANGJIN(K0604033)
JAN08/BHICT/03
LAN,thepromotionprivilegeisnotapplicableforasalesrecordfromamember.This demonstratethesystemfulfilltheobjectiveofPoint4.
Figure5.11cNewsalesrecordgeneratedfromexecutingStatement(D)&(E).
Figure5.12aMember1currentlyhas2275points.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 54of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
Figure5.12bGenerateasalesrecordof$24.80forMember1.
Figure5.12cMember1nowhas2523pointsafterpayingfortheBilliardusage.
Figure5.13aPointscostforItem14andItem15
InFigure5.12cshowsthatMember1currentlyhas2523points.AfterexecutingStatement (A),1000pointsisdeductedfromMember1andtheredemptionisregistered.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 55of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
Figure5.13bMember1nowhas1523afterredeemingItem14.
Figure5.13cTheredemptionisrecorded.
Figure5.13dMember1doesnothaveenoughpointstoredeemItem15.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 56of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
Figure5.14aMember3pointsandexpirydatebeforeexecutingStatement(A).
Figure5.14bMember3pointsandexpirydateafterexecutingStatement(A).
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 57of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
6.
CONCLUSION
CRITICALREVIEW&REFLECTIONS
6.1.
CreatingFunctionsbasedonViews WhileIwascreatingthefunctionsformysystem,IrealizedthatifIneedtomakeany changestothetablestructure,Iwillneedtotediouslymodifyallthefunctionswhichare basedonthattablee.g.tablename.Moreover,insomelogic,Ineedtocall2functionsin ordertogetthedata.Forexample,acentercanhavepromotion.Hence,togetthe promotiondataofthatcenter,Iwilltousethecenternumbertocallsafunctiontoobtain thepromotionnumber,withitcallsanotherfunctiontoobtaindatarelatingtothat promotion. Iwasthinkingaloud,heythisisrathernotefficient.HowcanImakethecodingfriendlierin thelongrun?ThatiswhenViewscomeintomymind. IhaverecodedmyfunctionstoqueryfromtheViews.Whenthereareanychangestothe individualtablestructureusedtocreatethatView,IjustneedtomodifytheViewinsteadof allthefunctionsrelyonthattable.Modifyingonetimethanmany,itreallymakescode modificationeasier.BymakingcomplexqueryintoView,IcandosimplySELECTqueryon theViewtoobtainthedataIwant.Fromtheexamplementionedearlier,Ihavecreated Viewcenterpromoviewwhichleftjoincenterandpromotiondata.Hencewiththe centernumber,Icancallonefunctiontoobtainpromotiondataifthecenterhasone.Refer totheViewcenterpromoviewinAppendixA:SQLSchema. ProjectManagementVs.TimeManagement EventhoughIhavetakenupProjectManagementcourseinUniSIM,Istillneedtremendous practiceandhandsontobegoodinit.Singleprojectmanagementisstillmanageablefor me.However,IaminasituationwhereIneedtomanagemultipleprojectsotherthanmy academicproject.Attimewhentimeisaconstraint,Ineedtoprioritizeandjeopardizethe timeallocatedformyacademicproject.Istillneedtoimproveonmyplanningandtime managementtobettercontrolmysituation.HowIcanimproveonthisistolearnand practiceriskmanagement. ConductingInterviews BeforegoingfortheinterviewwiththebusinessmanagerofValibelTechnologiesPteLtdfor requirementgathering,Ihaveplannedsomeinterviewquestionstobeasked.IthoughtIam
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 58of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
wellpreparedwiththelistofquestionsandIcanasksystematically.However,Iwaswrong. EventhoughIhadthequestionsorderlylistedtobeasked,thetendencyofhopping betweenquestionsisstillhigh.Thisisduetointervieweesometimetalksaboutinformation relatedtoanotherquestioninsteadoftheonebeingasked.ThenIgotoutofhandwiththe questionsIwanttoask.Ishouldhavemadethequestionsintoachecklistwhichisbetterto manage.HowIcanimproveisthemakeatemplateforinterviewquestions,andimproveson itasIconductmorerequirementgathering.Withthetemplate,itcanbemoreefficiencyin futureinterviews. UsingMySQLastheDBMS IhavechosenMySQLoverotherDBMSisbecauseIamsomepriorknowledgeinMySQLthen otherDBMS.LearningtocreatetriggersandstoredprocedureinMySQLwillbeanassetto me.However,doingthisprojectinMySQLgavemeaninsightofthelimitationofthisDBMS. FortheDBMStohavereferentialintegrity,IhavetouseInnoDBstorageengine.Some limitationisthatMySQLdoesnotsupportCHECKconstraintsondomaindataandthetrigger doesnotsupportINSTEADOFfunctionalitylikeMSSQL.AsMySQLisanopensource databaseandisverywidelyused,userswillwantimprovementsandallthiscommon functionalityamongthedifferentdatabasesmightbeintheMySQLdevelopmentpipeline. Nevertheless,itisbettertomeasurethescopeandobjectivesofthesystemandtoevaluate beforedecidingonwhichDBMStousefortheproject. Databasecodingandsyntax ThoughIloveprogramming,butIhaveneverreallygoneindepthfordatabase programming.Formypractice,Iusuallywouldprogramawebapplicationtointeractwith thedatabase,andthedatabaseisjustmainlyforquerying(SELECT,UPDATEandDELETE). Mostofthecheckingwillbedonebythewebserverbeforeinteractingwiththedatabaseto executethequery.Fromthisproject,Ihavelearntmuchondatabaseprogrammingusing triggerandstoredprocedurewhichwillbeanassettomewhenItakeonfutureweb applicationprojects. Writingagoodreport Englishlanguageisoneofmyworstsubjects.Hencewhendoingthisreport,Idonothave theconfidencetoproduceagoodreport.Eventhough,Ihavereaduponmaterialsonhow towriteagoodreport,languageflowandstructurestillplayamajorpartinthereporting. Whatisthepointofdoingthereportifthereadergetsthewrongmeaning?Thisisonearea Iamweakinandneedgreatpracticestoimprove.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 59of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
6.2.
RECOMMENDATIONS
6.3.
CONCLUSION
ThedatabasesystemIhavedoneforthisprojecthasmetitssystemobjectives.Allthisis possiblewithtriggersandstoredprocedurescalltocheckontheconstraintsofthesystem objectives.ItisachallengetomeasthisprojectispurelyondatabasescriptingwhichIam notgoodinitandtheICT315coursewhichItookisaverygeneralintroductioninto databasewhichdidnotreallygoindepthontriggersandstoredprocedures.AlthoughIam familiarwithwebserverscriptinglikePHP,Icannotuseitforthisproject.Nevertheless,itis agoodexperiencetoexploreintodatabasescripting. Inmyreport,section1.6MethodologyAdopted,IsharedhowIdidmyproject.Inmygeneral view,whatwasplannedbeforeeffectswhatIwasdoinglater.Iftheredoesnothavea developmentlifecycletoservemeasaguideline,Iwouldhavebeeninamess,notknowing wheretocarryon.Agoodplanningdefinitelyleadstobetterandefficientwork. Fromthisproject,Ihavedevelopedalearningprocessformyself.ForareawhereIamnew orneedimprovementon,Iwillneedtoconductresearchontherelatedarea,understand theinformationIamresearchingon,practiceswithhandson,evaluatewhatIhavehandson anddone,thenresearchonareaIamweakinorunsureof.Sothislearningprocessiterates ateverystageinthedevelopmentlifecycle,andIshouldimproveontheprocesswithother smallsubprocessesthatIhavelearnt.Inthiswayoranotherway,puttingwhatIhavelearnt intopracticeisthebestwaytostrengthenmyareas. (About7500wordsforcontentwithoutincludetheheader,caption,figuresandtables.)
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 60of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
7.
APPENDICES
APPENDIXA:SQLSCHEMA
7.1.
CREATETABLESCHEMA Table:game
DROP TABLE IF EXISTS `game`; CREATE TABLE `game` ( `gameNo` int(10) unsigned NOT NULL auto_increment, `gameTitle` text NOT NULL, `genre` text NOT NULL, PRIMARY KEY (`gameNo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Table:center
DROP TABLE IF EXISTS `center`; CREATE TABLE `center` ( `centerNo` int(10) unsigned NOT NULL auto_increment, `name` text NOT NULL, PRIMARY KEY (`centerNo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Table:promotion
DROP TABLE IF EXISTS `promotion`; CREATE TABLE `promotion` ( `promotionNo` int(10) unsigned NOT NULL auto_increment, `description` text NOT NULL, `ratetype` enum('amt','per') NOT NULL, `rate` int(3) unsigned NOT NULL, `minspent` int(2) NOT NULL default '0', `promoType` enum('lan','bill','arc','all') NOT NULL, PRIMARY KEY (`promotionNo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Table:member
DROP TABLE IF EXISTS `member`; CREATE TABLE `member` ( `memberNo` int(10) unsigned NOT NULL auto_increment, `name` text NOT NULL, `identityNo` text NOT NULL, `gender` enum('M','F') NOT NULL, `dob` date NOT NULL, `address` text NOT NULL, `email` text NOT NULL, `contact` int(10) unsigned NOT NULL, `occupation` text NOT NULL, `memberCardNo` int(10) unsigned NOT NULL, `joinedDate` date NOT NULL, `points` int(10) unsigned NOT NULL,
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 61of81
LEECHANGJIN(K0604033)
`pointsExpiry` date NOT NULL, PRIMARY KEY (`memberNo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
JAN08/BHICT/03
Table:arcadecard
DROP TABLE IF EXISTS `arcadecard`; CREATE TABLE `arcadecard` ( `arcadeCardNo` int(10) unsigned NOT NULL auto_increment, `normalCardPrice` decimal(5,2) NOT NULL, `memberCardPrice` decimal(5,2) NOT NULL, `cardValue` decimal(5,2) NOT NULL, PRIMARY KEY (`arcadeCardNo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Table:redeemitem
DROP TABLE IF EXISTS `redeemitem`; CREATE TABLE `redeemitem` ( `redeemItemNo` int(10) unsigned NOT NULL auto_increment, `redeemDesc` text NOT NULL, `pointsCost` int(10) unsigned NOT NULL, PRIMARY KEY (`redeemItemNo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Table:facility
DROP TABLE IF EXISTS `facility`; CREATE TABLE `facility` ( `facilityNo` int(10) unsigned NOT NULL auto_increment, `centerNo` int(10) unsigned default NULL, `facilityType` enum('lan','bill','arc') NOT NULL, `facilityStatus` enum('0','1') NOT NULL default '0', `normalPrice` decimal(5,2) NOT NULL default '0.00', `MemberPrice` decimal(5,2) default '0.00', `gameNo` int(10) unsigned default NULL, PRIMARY KEY (`facilityNo`), KEY `Facility_Index1` USING BTREE (`centerNo`), KEY `Facility_Index2` USING BTREE(`gameNo`), CONSTRAINT `FK_facility_1` FOREIGN KEY (`centerNo`) REFERENCES `center` (`centerNo`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `FK_facility_2` FOREIGN KEY (`gameNo`) REFERENCES `game` (`gameNo`) ON DELETE NO ACTION ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Table:inventory
DROP TABLE IF EXISTS `inventory`; CREATE TABLE `inventory` ( `facilityNo` int(10) unsigned NOT NULL, `toDeployAt` int(10) unsigned default NULL, PRIMARY KEY (`facilityNo`), KEY `Inventory_Index1` USING BTREE (`facilityNo`), CONSTRAINT `FK_inventory_1` FOREIGN KEY (`facilityNo`) REFERENCES `facility` (`facilityNo`) ON DELETE CASCADE
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 62of81
LEECHANGJIN(K0604033)
ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
JAN08/BHICT/03
Table:inventorylog
DROP TABLE IF EXISTS `inventorylog`; CREATE TABLE `inventorylog` ( `facilityNo` int(10) unsigned NOT NULL, `invLogDatetime` datetime NOT NULL, `invDescription` text NOT NULL, PRIMARY KEY (`facilityNo`,`invLogDatetime`), KEY `InventoryLog_Index1` USING BTREE (`facilityNo`), CONSTRAINT `FK_inventorylog_1` FOREIGN KEY (`facilityNo`) REFERENCES `facility` (`facilityNo`) ON DELETE NO ACTION ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Table:centerpromotion
DROP TABLE IF EXISTS `centerpromotion`; CREATE TABLE `centerpromotion` ( `centerNo` int(10) unsigned NOT NULL, `promotionNo` int(10) unsigned NOT NULL, `startDate` datetime NOT NULL, `endDate` datetime NOT NULL, PRIMARY KEY (`centerNo`,`promotionNo`,`startDate`,`endDate`), KEY `CenterPromotion_Index1` USING BTREE (`centerNo`), KEY `CenterPromotion_Index2` USING BTREE (`promotionNo`), CONSTRAINT `FK_centerpromotion_1` FOREIGN KEY (`centerNo`) REFERENCES `center` (`centerNo`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_centerpromotion_2` FOREIGN KEY (`promotionNo`) REFERENCES `promotion` (`promotionNo`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Table:sales
DROP TABLE IF EXISTS `sales`; CREATE TABLE `sales` ( `salesNo` int(10) unsigned NOT NULL auto_increment, `salesType` enum('lan','bill','arc') NOT NULL, `salesDatetime` datetime NOT NULL, `amtPayable` decimal(10,2) NOT NULL, `memberNo` int(10) unsigned default NULL, `startTime` time NULL, `endTime` time NULL, `facilityNo` int(10) unsigned default NULL, `arcadeCardNo` int(10) unsigned NULL, `centerNo` int(10) unsigned default NULL, PRIMARY KEY (`salesNo`), KEY `Sales_Index1` USING BTREE (`memberNo`), KEY `Sales_Index2` USING BTREE (`facilityNo`), KEY `Sales_Index3` USING BTREE (`arcadeCardNo`), KEY `Sales_Index4` USING BTREE (`centerNo`), CONSTRAINT `FK_sales_1` FOREIGN KEY (`memberNo`) REFERENCES `member` (`memberNo`)
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 63of81
LEECHANGJIN(K0604033)
ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `FK_sales_2` FOREIGN KEY (`facilityNo`) REFERENCES `facility` (`facilityNo`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `FK_sales_3` FOREIGN KEY (`arcadeCardNo`) REFERENCES `arcadecard` (`arcadeCardNo`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `FK_sales_4` FOREIGN KEY (`centerNo`) REFERENCES `center` (`centerNo`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
JAN08/BHICT/03
Table:redemption
DROP TABLE IF EXISTS `redemption`; CREATE TABLE `redemption` ( `redeemDatetime` datetime NOT NULL, `redeemItemNo` int(10) unsigned NOT NULL, `memberNo` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`redeemDatetime`,`redeemItemNo`,`memberNo`), KEY `Redemption_Index1` USING BTREE (`redeemItemNo`), KEY `Redemption_Index2` USING BTREE (`memberNo`), CONSTRAINT `FK_redemption_1` FOREIGN KEY (`memberNo`) REFERENCES `member` (`memberNo`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `FK_redemption_2` FOREIGN KEY (`redeemItemNo`) REFERENCES `redeemitem` (`redeemItemNo`) ON DELETE NO ACTION ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATEVIEWSSCHEMA
View:centerpromoview
DELIMITER // DROP VIEW IF EXISTS `centerpromoview` // #Showing the centers which has or does not has a promotion and the details on the current promotion. Only the current promotion for each center is retrieved. CREATE VIEW `centerpromoview` AS SELECT centerNo AS centerNo, promotionNo AS promotionNo, name AS centerName, startDate AS promoStartDate, endDate AS promoEndDate, description AS promoDesc, rateType AS promoRateType, rate AS promoRate, minspent AS promoMinSpent, promoType as promoType
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 64of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
FROM center LEFT JOIN centerpromotion USING (centerNo) LEFT JOIN promotion using (promotionNo) WHERE endDate >= CURDATE() OR endDate IS NULL; // DELIMITER ;
View:facilitycenterpromoview
DELIMITER // DROP VIEW IF EXISTS `facilitycenterpromoview` // #Showing the facility which has or does not has a promotion and the details on the current promotion and the center which the facility is in. Only the current promotion for each center is retrieved. CREATE VIEW `facilitycenterpromoview` AS SELECT facilityNo AS facilityNo, centerNo AS centerNo, promotionNo AS promotionNo, facilityType AS facilityType, normalPrice AS normalPrice, memberPrice AS memberPrice, gameTitle AS arcadeGameTitle, genre AS arcadeGenre, name AS centerName, startDate AS promoStartDate, endDate AS promoEndDate, description AS promoDesc, rateType AS promoRateType, rate AS promoRate, minspent AS promoMinSpent, promoType as promoType FROM facility LEFT JOIN center USING (centerNo) LEFT JOIN centerpromotion USING (centerNo) LEFT JOIN promotion USING (promotionNo) LEFT JOIN game USING (gameNo) WHERE endDate >= CURDATE() OR endDate IS NULL; // DELIMITER ;
CREATETRIGGERSCHEMA Trigger:before_facility_insert
DELIMITER // DROP TRIGGER IF EXISTS `before_facility_insert` // CREATE TRIGGER `before_facility_insert` BEFORE INSERT ON facility FOR EACH ROW BEGIN SET @center = NEW.centerNo; SET NEW.centerNo = NULL; IF NEW.facilityStatus <> 0 THEN SET NEW.facilityStatus = '0'; END IF; IF NEW.facilityType <> 'arc' THEN SET NEW.gameNo = NULL; END IF; IF NEW.facilityType = 'arc' AND NEW.gameNo IS NULL THEN SET NEW.gameNo = 'gameNo_not_defined'; END IF;
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 65of81
LEECHANGJIN(K0604033)
END // DELIMITER;
JAN08/BHICT/03
Trigger:after_facility_insert
DELIMITER // DROP TRIGGER IF EXISTS `after_facility_insert` // CREATE TRIGGER `after_facility_insert` AFTER INSERT ON facility FOR EACH ROW BEGIN SET @newFacility = NEW.facilityNo; INSERT INTO inventory (facilityNo, toDeployAt) VALUES (@newFacility,@center); CALL LogInventory(@newFacility,@center,1); END // DELIMITER;
Trigger:before_facility_update
DELIMITER // DROP TRIGGER IF EXISTS `before_facility_update` // CREATE TRIGGER `before_facility_update` BEFORE UPDATE ON facility FOR EACH ROW BEGIN SET @facilityStatus = NEW.facilityStatus; SET @facilityStatusOld = OLD.facilityStatus; SET @facilityNo = NEW.facilityNo; SET @centerNo = NEW.centerNo; SET @centerNoOld = OLD.centerNo; IF @facilityStatus = 0 THEN INSERT INTO inventory (facilityNo, toDeployAt) VALUES (@facilityNo, @centerNo); CALL LogInventory(@FacilityNo,@centerNo,2); SET NEW.centerNo = NULL; END IF; IF @facilityStatus = 1 AND @facilityStatus != @facilityStatusOld THEN SET NEW.centerNo = (SELECT toDeployAt FROM inventory WHERE facilityNo = @facilityNo); DELETE FROM inventory WHERE facilityNo = @facilityNo; CALL LogInventory(@facilityNo,NEW.centerNo,3); END IF; IF @centerNoOld <> @centerNo AND @facilityStatus = '1' THEN INSERT INTO inventory (facilityNo, toDeployAt) VALUES (@facilityNo, @centerNo); CALL LogInventory(@facilityNo,@centerNo,4); SET NEW.centerNo = NULL; SET NEW.facilityStatus = '0'; END IF; END // DELIMITER;
Trigger:after_sales_insert
DELIMITER // DROP TRIGGER IF EXISTS `after_sales_insert` // CREATE TRIGGER `after_sales_insert` AFTER INSERT ON sales
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 66of81
LEECHANGJIN(K0604033)
FOR EACH ROW BEGIN CALL AddPoints(NEW.memberNo,FLOOR(NEW.amtpayable*10)); END // DELIMITER;
JAN08/BHICT/03
CREATESTOREDPROCEDURESCHEMA Storedprocedure:AddFacility
DELIMITER // DROP PROCEDURE IF EXISTS `AddFacility` // CREATE PROCEDURE `AddFacility` ( facilityType CHAR(4), normalPrice DECIMAL(5,2), memberPrice DECIMAL(5,2), gameNo INTEGER ) BEGIN IF facilityType NOT IN ('lan','bill','arc') THEN SELECT 'Facility Type is invalid. Use \'lan\', \'bill\' or \'arc\'' AS Error; ELSEIF facilityType = 'arc' AND gameNo IS NULL THEN SELECT 'Please provide game number for the arcade facility.' AS Error; ELSE INSERT INTO `facility` ( `facilityType`, `normalPrice`, `MemberPrice`, `gameNo` ) VALUES (facilityType, normalPrice, memberPrice, gameNo); END IF; END// DELIMITER ;
Storedprocedure:InvToInventory
DELIMITER // DROP PROCEDURE IF EXISTS `InvToInventory` // CREATE PROCEDURE `InvToInventory` ( facNo INTEGER ) BEGIN SET @facilityNo = facNo; If getFacilityCenter(@facilityNo) IS NOT NULL THEN UPDATE facility SET facilityStatus = '0' WHERE facilityNo = @facilityNo; ELSE SELECT 'Facility is already in inventory.' AS Error; END IF; END// DELIMITER ;
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 67of81
LEECHANGJIN(K0604033) Storedprocedure:InvToCenter
JAN08/BHICT/03
DELIMITER // DROP PROCEDURE IF EXISTS `InvToCenter` // CREATE PROCEDURE `InvToCenter` ( facNo INTEGER ) proc:BEGIN SET @facilityNo = facNo; IF getDeployAt(@facilityNo) IS NULL THEN SELECT 'Facility has not set which center to deploy to.' AS Error; LEAVE proc; END IF; If getFacilityCenter(@facilityNo) IS NULL THEN UPDATE facility SET facilityStatus = '1' WHERE facilityNo = @facilityNo; ELSE SELECT 'Facility is already in a center.' AS Error; END IF; END proc; // DELIMITER ;
Storedprocedure:InvChangeCenter
DELIMITER // DROP PROCEDURE IF EXISTS `InvChangeCenter` // CREATE PROCEDURE `InvChangeCenter` ( facNo INTEGER, cenNo INTEGER ) BEGIN SET @facilityNo = facNo; SET @changeCenter = cenNo; If getFacilityCenter(@facilityNo) IS NULL THEN UPDATE inventory SET toDeployAt = @changeCenter WHERE facilityNo = @facilityNo; ELSE UPDATE facility SET centerNo = @changeCenter WHERE facilityNo = @facilityNo; END IF; END// DELIMITER ;
Storedprocedure:LogInventory
DELIMITER // DROP PROCEDURE IF EXISTS `LogInventory` // CREATE PROCEDURE `LogInventory` ( facilityNo INTEGER, centerNo INTEGER, logType INTEGER ) BEGIN DECLARE description TEXT; IF logType != '' THEN SET @facilityType = (SELECT getFacilityName(facilityNo));
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 68of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
SET @centerName = (SELECT getCenterName(centerNo)); CASE logType WHEN 1 THEN SET description = CONCAT('Facility ',facilityNo,' (', @facilityType,') is added to inventory.'); WHEN 2 THEN SET description = CONCAT('Facility ',facilityNo,' (', @facilityType,') is sent to inventory for maintainance.'); WHEN 3 THEN SET description = CONCAT('Facility ',facilityNo,' (', @facilityType,') is sent back to Center ', centerNo, ' (',@centerName,').'); WHEN 4 THEN SET description = CONCAT('Facility ',facilityNo,' (', @facilityType,') is sent back to inventory to be sent to Center ', centerNo, ' (',@centerName,').'); END CASE; INSERT INTO inventorylog VALUES (facilityNo, NOW(), description); END IF; END // DELIMITER;
Storedprocedure:AddPoints
DELIMITER // DROP PROCEDURE IF EXISTS `AddPoints` // CREATE PROCEDURE `AddPoints` ( memNo INTEGER, pts INTEGER ) proc:BEGIN SET @memberNo = memNo; SET @points = pts; UPDATE member SET points = points + @points WHERE memberNo = @memberNo; END proc; // DELIMITER ;
Storedprocedure:RedeemItem
DELIMITER // DROP PROCEDURE IF EXISTS `RedeemItem` // CREATE PROCEDURE `RedeemItem` ( memNo INTEGER, reItem INTEGER ) proc:BEGIN SET @memberNo = memNo; SET @redeemItemNo = reItem; #Get the points to redeem the redeem item and check if redeem item is exist. SET @pointsRedeemed = (SELECT getRedeemItemPoints(@redeemItemNo)); IF @pointsRedeemed IS NULL THEN SELECT 'Procedure call ends. Redeem Item does not exist. ' AS Error; LEAVE proc; END IF; #Get the points of the member and check if member is exist. SET @pointsLeft = (SELECT getMemberPoints(@memberNo));
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 69of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
IF @pointsLeft IS NULL THEN SELECT 'Procedure call ends. Member does not exist. ' AS Error; LEAVE proc; END IF; IF @pointsLeft > @pointsRedeemed THEN INSERT INTO redemption VALUES (NOW(),@redeemItemNo,@memberNo); CALL AddPoints(@memberNo,-@pointsRedeemed); ELSE SELECT 'Member does not have enough points to redeem the item.' AS Error; END IF; END proc; // DELIMITER ;
Storedprocedure:MemberPointChecking
DELIMITER // DROP PROCEDURE IF EXISTS `MemberPointChecking` // CREATE PROCEDURE `MemberPointChecking` ( ) proc:BEGIN UPDATE member SET points = 0, pointsExpiry = DATE_ADD(pointsExpiry,INTERVAL 1 YEAR) WHERE pointsExpiry <= CURDATE(); END proc; // DELIMITER ;
Storedprocedure:AddSales
DELIMITER // DROP PROCEDURE IF EXISTS `AddSales` // CREATE PROCEDURE `AddSales` ( facNo INTEGER, startTime TIME, endTime TIME, memNo INTEGER ) proc:BEGIN SET @price = 0.0; SET @facilityNo = facNo; #Check IF member number is valid. IF not valid, leave procedure. Only NULL or valid member number is accepted. IF memNo IS NOT NULL THEN IF isMember(memNo) IS NOT NULL THEN SET @memberNo = memNo; SET @Price = getMemberPrice(@facilityNo); ELSE SELECT 'Procedure call ends. Member does not exist. ' AS Error; LEAVE proc; END IF; ELSE SET @memberNo = NULL; SET @price = getNormalPrice(@facilityNo); END IF; SET @centerNo = getFacilityCenter(@facilityNo);
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 70of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
IF @centerNo IS NOT NULL THEN SET @facilityType = getFacilityType(@facilityNo); IF @facilityType != 'arc' THEN SET @amtpayable = calculatePayable(startTime,endTime,@price,@centerNo,@facilityType,@me mberNo); INSERT INTO sales VALUES (NULL,@facilityType,NOW(),@amtpayable,@memberNo,startTime,endTime,@fa cilityNo,NULL,@centerNo); ELSE SELECT 'Facility type is Arcade. Not Applicable for this procedure call.' AS Error; END IF; ELSE SELECT 'Facility is in Inventory or invalid.' AS Error; END IF; END proc; // DELIMITER ;
Storedprocedure:AddSalesArcadeCard
DELIMITER // DROP PROCEDURE IF EXISTS `AddSalesArcadeCard` // CREATE PROCEDURE `AddSalesArcadeCard` ( cenNo INTEGER, arCardNo INTEGER, memNo INTEGER ) proc:BEGIN SET @price = 0.0; SET @centerNo = cenNo; SET @arcadeCardNo = arCardNo; IF isCenterExist(@centerNo) IS NOT NULL THEN #Check IF member number is valid. IF not valid, leave procedure. Only NULL or valid member number is accepted. IF memNo IS NOT NULL THEN IF isMember(memNo) IS NOT NULL THEN SET @memberNo = memNo; SET @Price = getMemberPriceArcadeCard(@arcadeCardNo); ELSE SELECT 'Procedure call ends. Member does not exist. ' AS Error; LEAVE proc; END IF; ELSE SET @memberNo = NULL; SET @price = getNormalPriceArcadeCard(@arcadeCardNo); SET @promoType = getPromotionType(@centerNo); SET @minspent = getPromotionMinimumSpent(@centerNo); IF (@promoType = 'arc' OR @promoType = 'all') AND @price >= @minspent THEN SET @rateType = getPromotionRateType(@centerNo); SET @rate = getPromotionRate(@centerNo); IF @rateType = 'per' THEN SET @price = @price - (@price*@rate/100); ELSE SET @price = @price - @rate; END IF;
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 71of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
END IF; END IF; INSERT INTO sales VALUES (NULL,'arc',NOW(),@price,@memberNo,NULL,NULL,NULL,@arcadeCardNo,@cent erNo); ELSE SELECT 'Arcade Center does not exist.' AS Error; END IF; END proc; // DELIMITER ;
Storedprocedure:AddPromotionToCenter
DELIMITER // DROP PROCEDURE IF EXISTS `AddPromotionToCenter` // CREATE PROCEDURE `AddPromotionToCenter` ( cenNo INTEGER, promoNo INTEGER, startDate DATE, endDate DATE ) proc:BEGIN SET @centerNo = cenNo; SET @promotionNo = promoNo; IF getCenterPromotion(@centerNo) IS NULL THEN INSERT INTO centerpromotion VALUES (@centerNo,@promotionNo,startDate,endDate); ELSE SELECT CONCAT('Center ', @centerNo, ' is currently having promotion.') AS Error; END IF; END proc; // DELIMITER ;
7.2.
APPENDIXB:SQLTABLEPOPULATION
DEFAULTDATAPOPULATION DefaultDataPopulation:arcadecard
INSERT INTO arcadecard (arcadeCardNo, normalCardPrice, memberCardPrice, cardValue) VALUES (1, 2, 2, 2), (2, 5, 4, 5), (3, 10, 8, 10), (4, 15, 10, 15), (5, 25, 18, 25), (6, 50, 30, 50);
DefaultDataPopulation:center
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 72of81
LEECHANGJIN(K0604033)
INSERT INTO center (centerNo, name) VALUES (1, 'Funland Bedok'), (2, 'Funland Bishan'), (3, 'Funland East Coast'), (4, 'Funland Educare Centre'), (5, 'Funland Sembawang'), (6, 'Funland Yishun 10'), (7, 'Cyberbyte Bugis'), (8, 'Cyberbyte Snookerium Clementi'), (9, 'Cyberbyte Snookerium Paradiz'), (10, 'Ang Mo Kio Snookerium');
JAN08/BHICT/03
DefaultDataPopulation:game
INSERT INTO game (gameNo, gameTitle, genre) VALUES (1, 'Time Crisis 2', 'Shooting'), (2, 'Time Crisis 3', 'Shooting'), (3, 'Time Crisis 4', 'Shooting'), (4, 'House Of The Dead 3', 'Shooting'), (5, 'House Of The Dead 4', 'Shooting'), (6, 'Initial D 3', 'Racing'), (7, 'Initial D 4', 'Racing'), (8, 'Midnight Tune 3', 'Racing'), (9, 'Pinball Fire', 'Pinball Machine '), (10, 'Raw Thrills', 'Racing'), (11, 'Stacker', 'Prize Merchandiser'), (12, 'Grab A Doll', 'Claw & Skill Crane Machine'), (13, 'Lollipop Lucky', 'Claw & Skill Crane Machine'), (14, 'The Three Kingdoms', 'Platform'), (15, 'Football Championship', 'Sports');
DefaultDataPopulation:member
INSERT INTO member (memberNo, name, identityNo, gender, dob, address, email, contact, occupation, memberCardNo, joinedDate, points, pointsExpiry) VALUES (1, 'Andrew Wee Kim Soo', 'S8020938A', 'M', '1980-05-24', '218 Orchard Road (S)238851', 'andrewee80@hotmail.com', 92373629, 'Banker', 928349495, '2002-01-11', 2000, '2010-08-31'), (2, 'Lim Jingyin', 'S8406273B', 'F', '1984-07-02', '795 Ang Mo Kio Avenue 1 (S)569976', 'ljy88@hotmail.com', 86738293, 'Student', 983920311, '2008-02-15', 2000, '2010-02-15'), (3, 'Gan Kee Sim', 'S8588432J', 'M', '1985-03-07', '248 Choa Chu Kang Avenue 2 (S)680248', 'keesim99@yahoo.com', 81239123, 'Student', 928347771, '2007-07-31', 2000, '2008-07-31'), (4, 'Betty Su Kim Ling', 'S8947384C', 'F', '1989-09-22', '720 Woodlands Avenue 6 (S)730720', 'susubetty@yahoo.com.sg', 97382937, 'Student', 912348372, '2007-12-23', 2000, '2008-12-23'), (5, 'Gary Tan Seng', 'S8321138D', 'M', '1983-06-21', '55 Chua Chun Kang Road (S)345643', 'garygary55@hotmail.com', 94532349, 'Student', 912381239, '2007-01-11', 2000, '2009-08-15');
DefaultDataPopulation:promotion
INSERT INTO promotion (promotionNo, description, ratetype, rate, minspent, promoType) VALUES (1, '5% off for LAN usage', 'per', 5, 0, 'lan'), (2, '5% off for billiard usage', 'per', 5, 0, 'bill'), (3, '5% off for purchase of arcade card', 'per', 5, 0, 'arc'), (4, '5% off spending at this center', 'per', 5, 0, 'all'),
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 73of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
(5, '$2 off LAN usage with a minimum spending of $10', 'amt', 2, 10, 'lan'), (6, '$2 off billiard usage with a minimum spending of $10', 'amt', 2, 10, 'bill'), (7, '10% off LAN usage with minimum spending of $15', 'per', 10, 15, 'lan'), (8, '10% off billiard usage with minimum spending of $15', 'per', 10, 15, 'bill'), (9, '$1 off with $5 and above arcade card purchased', 'amt', 1, 5, 'arc'), (10, '$3 off with $10 and above arcade card purchased', 'amt', 3, 10, 'arc'), (11, '$10 off with $25 and above arcade card purchased', 'amt', 10, 25, 'arc');
DefaultDataPopulation:redeemitem
INSERT INTO redeemitem (redeemItemNo, redeemDesc, pointsCost) VALUES (1, 'Beautiful Sticker', 50), (2, 'Pencil Box', 150), (3, 'Candy Sweets', 150), (4, 'Small Teddy Bear', 150), (5, 'Medium Teddy Bear', 250), (6, 'Big Teddy Bear', 450), (7, 'Gaint Teddy Bear', 1500), (8, 'Stylish Watch', 200), (9, 'Baseball Cap', 120), (10, 'Funland T-shirt', 220), (11, 'Handheld Game', 350), (12, 'Cool Sunglasses', 300), (13, 'Can Drink', 80), (14, 'Mobile Phone', 1000), (15, '32" LCD TV', 5000), (16, 'Mini Home Threatre System', 2000), (17, 'MP3 Player 1GB', 500), (18, 'MP3 Player 2GB', 1100), (19, 'MP3 Player 4GB', 2500), (20, 'Thumb Drive 2GB', 900), (21, 'Basketball', 350), (22, 'Soccerball', 350);
*OtherdatacanbepopulatebycallingtheStoredProcedures.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 74of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
7.3.
APPENDIXC:GANTTCHART
StartingoftheProjecttillthesubmissionofinitialreport
SecondpartoftheProjectfromrequirementgatheringtillthesubmissionofthisFinal Report.
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 75of81
LEECHANGJIN(K0604033) ScheduleMeetingwithTutor Task 7. Meeting With Tutor 7.1. Meeting 01 7.2. Meeting 02 7.3. Meeting 03 7.4. Meeting 04 7.5. Meeting 05 7.6. Meeting 06 7.7. Meeting 07 7.8. Meeting 08 7.9. Meeting 09 7.10. Meeting 10 8. Workshop 8.1. Workshop 01 8.2. Workshop 02 8.3. Workshop 06 Day Mon Wed Wed Wed Sat Sat Sat Sat Sat Mon Sat Sat Sat Date 02 Feb 20 Feb 26 Mar 16 Apr 31 May 28 Jun 26 Jul 23 Aug 13 Sep 13 Oct 16 Feb 23 Feb 16 Aug Allocated 25hrs 2.5hrs 2.5hrs 2.5hrs 2.5hrs 2.5hrs 2.5hrs 2.5hrs 2.5hrs 2.5hrs 2.5hrs 8.5hrs 2.5hrs 3hrs 3hrs
JAN08/BHICT/03
Attendants Attended Attended Attended Attended Attended Attended Attended Unavailable Attended Oversea Attended Attended Oversea
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 76of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
7.4.
APPENDIXD:OTHERS
Interviewform
UserRequirementsInterviewQuestions
Project Title: Sales and Inventory System for Chain Stores (Amusement Center)
1) Company background. a. How many centers? b. How does each center operate in general? 2) Companys operation workflow a. Is company using any system? b. What is the company sales operation? c. What is the company logistic operation? d. Any repeating tasks? e. Any exceptional cases? 3) Information that is of importance to the user. (Content Identification) a. What are the data that need to be store? b. What information user currently uses? c. Any forms? d. How is the data currently stored? 4) Open questions. a. What are the problems the user encounter? b. What concerns the user has on the current system? c. What the user wants the system to be capable of? d. What are the expectations? 5) User to prioritize the information importance. (Prioritization) a. What user wants to do with the information? b. How user wants to see the information? 6) Defining the major user requirements if any. 7) Anything the user wants to point out?
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 77of81
LEECHANGJIN(K0604033) MembershipForm
JAN08/BHICT/03
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 78of81
LEECHANGJIN(K0604033) SalesTrackingForm
JAN08/BHICT/03
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 79of81
LEECHANGJIN(K0604033)
JAN08/BHICT/03
8.
REFERENCES
[ 1 ] Chen, Peter P. (1976) The Entity-Relationship Model - Toward a Unified View of Data. ACM Transactions on Database Systems, Vol 1. Issue 1. pp.9-36 [ 2 ] Powell, Gavin. (c2006) Beginning database design. Indianapolis: Wiley Publishing. 0764574906 [ 3 ] Lans, Rick F. van der. (c2007) SQL for MySQL Developers: A Comprehensive Tutorial and Reference. Upper Saddle River, NJ : Addison-Wesley. 0131497359 [ 4 ] Peltier, Jon Gantt Charts in Microsoft Excel. http://pubs.logicalexpressions.com/pub0009/LPMArticle.asp?ID=343 [viewed 14/02/2008] [ 5 ] Holohan, Ron 6 Steps to Successful Schedules. http://www.projectsmart.co.uk/6-steps-to-successful-schedules.html [viewed 13/02/2008] [ 6 ] Christina, Low and Daphne, Pan (2007) The Write Right Guide. http://www.cdtl.nus.edu.sg/wrg/ [viewed 14/02/2008] [ 7 ] Connolly, Thomas M. and Begg, Carolyn E. (2002) Database Systems A Practical Approach to Design, Implementation, and Management. 3rd Ed. Harlow: Addison-Wesley/Pearson. 0201708574 [ 8 ] Project Management Institute. (2004) A Guide to the Project Management Body of Knowledge (PMBOK Guides). Third Edition. Newtown Square, Pa.: Project Management Institute. 193069945X [ 9 ] Kruckenberg, Michael. and Pipes, Jay. (c2005) Pro MySQL. Berkeley, CA : New York : Apress. 159059505X [ 10 ] MySQL AB, 2008 Sun Microsystems, Inc., MySQL 5.0 Reference Manual.
LEECHANGJIN(K0604033)
JAN08/BHICT/03
9.
SDLC DBMS GUI
GLOSSARY
SystemsDevelopmentLifeCyclerelatestomodelsormethodologiesthat peopleusetodevelopsystems ADataBaseManagementSystemiscomputersoftwaredesignedforthe purposeofmanagingdatabasesbasedonavarietyofdatamodels. AGraphicalUserInterfaceisatypeofuserinterfacewhichallowspeopleto interactwithelectronicdevicessuchascomputers.Itoffersgraphicalicons, andvisualindicatorsasopposedtotextbasedinterfaces,typedcommand labelsortextnavigationtofullyrepresenttheinformationandactions availabletoauser. WorkBreakdownStructureisatreestructurelistingoftaskscommonlyused inprojectmanagement. EntityAttributeRelationshipModelusedindatabasedesign.
WBS EARModel
ICT499CAPSTONEPROJECTCOURSEFINALREPORTJANUARY2008 81of81