Basically, youcanwriteout a wholelongscriptandthenbeabletocallthatscriptusing a simplename.
That's whatyou'reabletodowith a storeprocedurewithanymysequeldatabase.
Whatyou'reabletodoisyou'reabletowriteout a long, nastysequelstatement, andthenyou'reabletocallthatsequelstatementusingsimplythenameofthatstoreprocedure.
Soifyoucanget a limiterstosomethingelseonandthenyoudonotcangetbackto a cynicalandthenyoucan't runintoproblemslater, whenyougototypein a sequel, statementsnormallyonyouwillrunintoissuesthere.
SowewilldouseClass D B thatwillgetusintotheclassdatabase, andwewillusethesesemicolonSoas I talkedaboutbefore, thesemiColoniscurrentlythedelimiterwhenyoutypesinmycolonandthenyouhitEnter.
Nowwe'regoingtogodown, andwe'regoingtosaybegin, andthenwe'regoingtogodownonemorelevelandthatnowthisiswhere I'm goingtotypein a littlebitmoreof a nastysequelstatement.
Andsowe'regoingtopartsdotofindoorunderscore i d equalsthendoors, Docofindoorunderscore i d andthensemicolon.
So I'm gonnaselectallsorts.
Likeallcolumnsfromthepartstable.
Innerjoythroughthevendor's tableonSoparts, notvendor I.
D.
Sothere's a columnwithinthepartstablecalledVendor I D.
Andthenthatwillequalinthevendor's table.
There's a columncalledVendor I D.
Right.
Sothiswillcombinethosetwotogether.
Thenwe'regoingtogodownonemorelevel.
We'regoingtodoend, andthenwe'regoingtodo a dollarsign, dollarsign.
Andhopefullyif I didn't dosomethingstupid, thiswillwork.
Sowehit.
Enter.
Okay, query.
Okay, wehavenoerrors.
Sonowall I coulddo, insteadofhavingtotypeoutallofthisorsomethingevenmorecomplicated.
What I coulddois I cansaycallnasty.
Uh, dosome, uh, whoalmostmade a spacetakealmostmademistake.
Delivereater, uh, goesbacktobeing a semicolon.
Sonowthatthedilemmaisnowbacktobeing a semicolon, what I candois I Canyoucallthat?
I coulddonastysemicolon.
Andthenlook, I getthatjointstatementthat I hadcreatedupthere, Andsonowifthiswas a statementthat I wouldhavetorunperiodicallyinsteadofhavingtotypeallofthisinandworryingaboutfatfingeringandyou'redoingsomethingstupid, I cansimplytypeincallnastynow, Andthatwillgetmetheexactsameresults.
Sobasically, whatthisissayingisshowhowthisprocedurewascreatedon, andthenwetypeinnastybecausethat's a procedurethatwereinterestedinWedosemicolon, whichisthedelimiterAndthenwehitreturn.
Sofromhere, we'regoingtoget a wholebunchofstuffwegottasortofsortthrough.
It s o nasty.
OnlygrewbyCreativefinder.
Look, Bob, localhostsyougetthiswholeinformation.
Ah.
Thentheimportantthingisyoucomedownheretobegin.
Okay?
Sotheybegin.
Andthenwhatisthisprocedure?
Sowecanseehere?
Isthisprocedure a selectallfrompartsinnerjoinedvendorsonpartsthatvendorvendorequalsvendor I d equalsvendorsdotvendorunderscore i d AndsothisisthesequelstatementIfwe d'ohOh, andwetake a lookatthattest p thatwecreatedsoagainwecould d'ohshowcreateprocedure, Test p.
Thatwastheotherprocedurethatwecreated a semicolonas a delimiter s o fromhereagain.
Yougottasortthrough a wholebunchofthis.
Sowehavethename.
Wehavesomeotherinformationuphereforthistest P procedure.
That's howyou'reabletorun a procedureyoujustdocallwhatevertheprocedurenameis, thatshowsyouwhatproceduresareonyourdatabaseservershowedyouhowtoseewhattheprocedureactuallyis.
Itreallysuckswhenyou'reanoldtimerandhedoesn't need a dance, I guess I don't needtoread, right.
Uh, oneoftheproblemsyougetintoyouagainwiththecommandlineisremember, thesystemwillprocesswhatyoutypein, Andsoifyouhave a reallynastyalongsequelstatementandyouyouknowthatthey'resupposedtobe a comma.
Itcouldbe a realpaininaboutoneofthenicethingswiththestoreproceduresisisnormallywhenyou'reusing a database, you'regoingtointeractwithitmoreorlessthesamewayEverytimeyougoanddealwiththedatabase, right, therearegoingtobecertainsequelstatementsthey'regoingtouseoverandoverandoverandoverandoverandoverandoverandoverandoverandoveragain.
Don't forgetthatthelimiteryousetthatdeliveredher a dollarsign, dollarsignandthenyoudosomethingstupidandyoudon't setitback.
Thatcancauseyouproblems.
SoSojustjustyourememberthatasalways, I enjoyteachingthisclassandlookfortoseethenextone.
Apparently, thetypeofcontentyoujustsawisnotwhatSusan W.
WantsforthefutureofYouTube.
ThismeansthatrecommendationsbyYouTubetothischannelhavedroppedmassively, andviewsarebecoming a comicallysmall.
I hatetoask.
I usedtosay I wouldneverask, butifyoucouldsubscribelikecommonandmostimportantly, sharethevideosthatyouappreciate, thatmayhelpslowthedeathofthischannel.