Solutions Manual for Database Processing Fundamentals Design and Implementation 13th Edition by Kroe

Page 1

Solutions Manual for Database Processing Fundamentals Design and Implementation 13th Edition by Kroenke Full clear download (no error formatting) at : https://downloadlink.org/p/solutions-manual-for-database-processingfundamentals-design-and-implementation-13th-edition-by-kroenke/ Test Bank for Database Processing Fundamentals Design and Implementation 13th Edition by Kroenke Full clear download (no error formatting) at : https://downloadlink.org/p/test-bank-for-database-processingfundamentals-design-and-implementation-13th-edition-by-kroenke/

INSTRUC TOR ’S MANUAL TO AC C O MPAN Y

D AV ID M. KROENKE AND D AVID J. AUER

D ata b a s e P ro c e ssing Fundamentals, D esign, and Im ple me ntation 13t h Edition

CHAPTER TWO INT RODUCTION TO STRUC TURE Q UERY L ANGUAGE


Pr ep ar ed By

Da vid J. Auer West ern Washington Uni versit y


.


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

CHA PTER OB JECTIVES T o under st and t he use of ext r acted dat a set s T o under st and t he use of ad - hoc q uer ies T o under st and t he hist ory and sig nif icance of Structur ed Q uer y Lang uag e ( SQ L) T o underst and t he basic SQ L SELECT/FRO M/W HERE f r amework as t he basis f or dat abase q uer ies T o be able t o wr it e q uer ies in SQ L t o r etr ieve dat a f r om a sing le t able T o be able t o wr it e q uer ies in SQ L t o use t he SQL SELECT , FRO M, W HERE, O RDER BY, G RO UP BY, and HAVI NG clauses T o be able t o wr it e q uer ies in SQ L t o use SQ L DIST I NCT, AND, O R, NOT, BETW EEN, LIKE, and IN keywords T o be able t o use t he SQL built - in f unct ions of SUM, CO UNT , MI N, MAX , and AVG wit h and wit hout t he use of a G RO UP BY clause T o be able t o wr it e q uer ies in SQ L t o r etr ieve dat a f r om a sing le t able but r estr ict ing t he dat a based upon data in another t able ( subq uery) T o cr eat e SQ L q uer ies that r etr ieve dat a f r om mult iple t ables using t he SQ L j oin and JO I N O N o per at ions T o cr eat e SQ L q uer ies that r etr ieve dat a f r om mult iple t ables using t he SQ L O UT ER JO I N operat ion

ERRATA T her e ar e no k nown er r or s at t his t im e. Any err ors t hat ar e discovered in t he f ut ure wil l be r epor t ed and cor r ect ed in t he O nline DBP e13 Er r a t a docum ent, which will be avai lable at htt p:/ / www. p ear sonhig her ed.com/k r oenk e.

TEACH ING SUGG ESTIONS Database f iles t o illustr ate t he examples in t he chapt er and solut ion dat abase f iles f or your use a r e available in t he I nst r uct or ’s Resource Cent er on t he t ext ’s W eb sit e ( www. pearsonhig her ed. com /kr oenk e ). T he best way f or st udents t o under st and SQ L is by using it. Have your st udents work t hroug h t he Revie w Q uest ions, Pr oj ect Q uest ions and t he Marcia’s Dr y Cleaning and Morg an Impor t ing Pr oj ect Q uest ions in an act ual dat abase. St udent s can cr eat e dat abases in Micr osof t Access wit h basic t ables, r elationships and dat a f rom t he m ater ial in t he book. SQ L scr


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La age ipts f orngu Micr o sof t SQ L Server, O r acle Database and MySQ L versions of Cape Codd, W PC, MDC and MI are available in the I nst r uct or’s Resource Cent er on t he t ext ’s W eb sit e ( www. pearsonhig her ed. com/kr oenk e).


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

Micr osof t Access dat abase f iles f or Cape Codd and t he NASDAQ dat a ( NDX . accdb), t og ether wit h SQ L scr ipts f or Micr osof t SQ L Server, O r acle Database and MySQ L versions of Cape Codd, MDC and MI are available f or st udent use in t he St udent Resour ces on t he t ext ’s W eb sit e ( www. pearsonhig her ed. com/kr oenk e). T he SQ L processors in the various DBMSs are very f ussy about char acter set s used f or SQ L st at ement s. T hey want t o see plain ASCI I t ext , not f ancy f onts. T his is part icularly t r ue of t he sing le q uot at ion ( ' ) used t o desig nat e char act er st r ing s, but I ’ve also had problems wit h t he m inus sig n. If your st udents are having problems g ett ing a “ pr operly str uctur ed SQ L st ate m ent ” t o r un, look closely f or t his t ype of problem. T her e is a usef ul t eaching t echniq ue which wil l all ow you t o dem onst r at e the SQ L q uer ies in t he t ext using Micr osof t SQ L Server if you have it available. O pen t he Micr osof t SQ L Server Manag ement St udio, and cr eate a new SQ L Server dat abase nam ed Cape- Codd. I n t he Micr osof t SQ L Server Manag ement St udio, u se t he SQ L st atem ents in t he *. sq l t ext f ile DBP- e13- MSSQ L-Cape- Codd - Cr eat e- Tables.sql t o cr eat e t he RET AI L_O RDER, O RDER_IT EM and SKU_DAT A t ables [t he W AR EHO USE and I NVENT O RY t ables, used in t he Review Q uest ions, ar e also cr eat ed]. I n t he Micr osof t SQ L Server Manag ement St udio, u se t he SQ L st atem ents *. sq l t ext f ile DBP- e13- MSSQ L- Cape-Dodd- I nser tData.sql t o populate t he RET AI L_ORDER, O RDER_IT EM and SKU_DAT A t ables [ t he W AREHO USE and INVENT O RY t ables, used in t he Revie w Q uest ions, ar e also populated] . I n t he Micr osof t SQ L Server Manag ement S t udio, open t he *. sq l t ext f ile DBP- e13- MSSQ L- Cape-Codd - Q uer y - Set - CH02. sql. T his f ile cont ain s all t he q uer ies shown in t he Chapter 2 t ext. Hig hlig ht t he q uer y you want t o r un and click t he Execut e Q uer y but t on t o display t he r esult s of t he q uer y. An example of t his is shown in t he f ollowing scr eenshot. All of t he *. sq l t ext f iles needed t o do t h is ar e available in t he I nstr uct or’s Resource Cent er on t he t ext ’s W eb sit e ( www. pearsonhig her ed. com/kr oenk e).


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

Micr osof t Access 20 13 does not suppor t all SQ L -92 ( and newer) const r ucts. W hile t his c hapt er st ill consider s Micr osof t Access as t he DBMS m ost lik ely t o be used by st udent s at t his point in t he cour se, t her e are some Revie w Q uestions and Proj ect Q uestions t hat use t he O RDER BY clause wit h aliased com put ed columns t hat wil l not r un in Access ( see Review Q uest ions 2. 42 – 2.44 and Pr oj ect Q uest ions 2. 63. e – 2. 63.g). T he corr ect solutions f or t hese q uest ions were obt ained using Micr osof t SQ L Server 2012. T he Micr osof t Access r esult s wit hout t he O RDER BY clause ar e also shown, so you can assig n t hese problems wit hout t he O RDER BY par t of t he q uest ions. Micr osof t Access 2013 does not suppor t SQ L wil dcar d char act er s ( see Revie w Q uest ions 2.36 – 2. 38), alt houg h it does have equiva lent wildcar d char acters as descr ibed in t he chapt er . T he corr ect so lutions f or t hese q uest ions were obt ained using Micr osof t SQ L Server 2012. For t hose st udent s who are used t o procedural lang uag es, t hey m ay have som e init ial dif f icult y wit h a lang uag e t h at does set pr ocessing lik e SQ L. T hese st udent s are accust om ed t o pr ocessing r ows (r ecords) r at her t han set s. It is t im e we ll spent t o m ak e sur e they under st and t hat SQ L processes t ables at a t im e, not r ows at a t ime.


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu St udent s age m ay have some tr ouble under st anding the G RO UP BY clause. If you can explain it in t er m s of t r adi t ional cont r ol br eak log ic ( sort r ows on a k ey then process t he r ows unt il the value of t he k ey changes) , t hey will ha ve less t rouble.


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

T his also explains wh y t he G RO UP BY clause wil l present t he r ows sort ed even t houg h you do not use an O RDER BY clause. At t his point, st udents f am iliar wit h Micr osof t Access will wonder wh y t hey are lear ning SQ L. They have m ade q uer ies in Micr osof t Access using Micr osof t Access' s version of Query- By- E xample ( Q BE), and t her ef or e never had t o under st and t he SQ L. I n m any cases, t hey will not k now t hat Micr osof t Access g ener ates SQ L code wh en you cr eat e a q uer y in desig n view. It is wort h let t ing t hem k now t his is done and even showing t hem t he SQ L cr eat ed f or and under lying a Micr osof t Access q uer y. I t is also im port ant f or student s t o under st and t hat , in m any cases, t he Query - By- Example f orm s such as Micr osof t Access’ desig n vie w can be very inef f icient . Also, t he Q BE f or ms ar e not available f r om wit hin an application pr ogram such as Java or C, and so SQ L m ust be wr it t en. It has been our exper ience t hat a r eview of a Cartesian Pr oduct f r om an alg ebr a class is t im e well spent. Show st udent s what will happen if a W HERE st atement is lef t of f of a j oin. T he f ollo wing example wil l work . Assum e you cr eat e f our t ables wit h f ive colu m ns each and 100 r ows each. How m any columns and r ows will be displa yed by t he st atem ent: SELECT * FROM TABLE1, TABLE2, TABLE3, TABLE4; T he r esult is 20 columns ( not bad) but 100,000, 000 r ows ( 100 * 100 = 10, 000, 10, 000 * 100 = 1,0 00, 000, 1, 000,000 * 100 = 100, 000,000) . T his happens because t he JO I N is not q ualif ied. If t hey understand Car t esian product s then t hey wi ll under st and how t o f ix a JO I N wher e t he result s ar e m uch t oo large. Note t hat in t he Marcia' s Dr y Cleaning proj ect, wh ere in som e previous edit ions we have used t ables nam ed O RDER and O RDER_IT EM, we have changed t hese t able nam e s t o I NVO I CE and I NVO I CE_ITE M. W e did t his because O RDER is an SQ L r eserved word ( par t of O RDER BY) . T her ef ore, when the t able nam e O RDER is used as par t of a q uer y, i t m ay need t o be (" m ust be" in Access 2013) enclosed in delim it ers as [O RDER] if t he q uer y is g oing t o run corr ect ly. T he t opic of r eserved words and delim iters is discussed in m or e det ail in Chapt ers 6 and 7. Howe ver, now is a g ood t ime t o intr oduce it t o your st udent s. Note t hat Micr osof t Access SQ L r eq uir es t he I NNER JOI N syntax instead of t he st andar d SQ L syntax JOI N used by Micr osof t SQL Server, Or acle Dat abase and MySQ L


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

ANSWERS TO REVIEW QUESTIONS 2.1 W hat is a business intell igence ( BI ) syst em? A busi nes s i ntell i gence ( BI) syst em, i s a syst em use d to suppor t mana gement dec isi ons by pr oduci ng i nf or mat i on f or ass essment , anal ysi s, pl anning and c ontr ol. 2.2 W hat is an ad- hoc query? An ad -hoc que r y i s a quer y cr eat ed by t he user as nee ded, r at her t han a qu er y pr ogr ammed i nt o an appli cat ion. 2.3 W hat does SQ L st and f or , and w hat is SQ L? SQL st ands f or St ruct ured Quer y Language . SQL i s t he uni versa l quer y l anguage f or r el ati onal DBMS pr oducts. 2.4 W hat does SKU st and f or , and w hat is an SKU? SK U st ands f or st ock kee ping uni t . An SK U is a an i denti fi er use d t o l abel and dist ingui sh eac h i t em sol d by a bus iness. 2.5 Summ ar i ze how dat a w er e alt er ed and f ilt er ed in cr eat ing t he Cape Codd dat a extr act ion. Dat a f r om t he Cape Codd oper at i onal r et ai l sa les databas e wer e used t o cr eat e a r et ail sal es ext ract i on dat abase wit h t hree tables : RET AIL_ORDE R, ORDER_ IT EM and SKU_DAT A. T he RETAIL_ORDER t abl e use s onl y a few of t he col umns i n the oper at ional dat abas e. T he st r uct ur e of t he t abl e i s: RET AI L_O RDER (O r derNumber, St or eNumb er , St oreZip, Or der Mont h, Or der Year, O r derT otal) For t hi s t abl e, t he ori gi nal col umn Or der Dat e ( i n t he dat a for mat MM/ DD/ YYYY [04/ 26/ 2013]) was convert ed i nto t he c ol umns Orde r Mont h ( i n a Charac t er (12) f or mat so t hat ea ch mont h i s spe ll ed out [ Apri l] ) and Order Year (i n an Int eger f or mat wit h eac h yea r appeari ng as a f our -di gi t yea r [ 2013]). We al so not e t hat t he OrderT ot al col umn i ncl udes t ax, shi ppi ng and ot her char ges t hat do not appe ar in t he dat a extr act . T hus, it does not equal t he sum of t he r el ated ExtendedPri ce c ol umn i n t he ORDER_IT EM t abl e disc ussed bel ow. T he O RDER_ITEM t abl e use s an e xt rac t of t he i tems pur chas ed f or each order . T he str uct ur e of t he t abl e i s:


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu(O age O RDER_IT EM r der Number, SKU, Q uantity, Pr ice, Ext endedPr ice)

For t hi s t abl e, t her e i s one row f or ea ch SK U ass oci at ed wi t h a gi ven Order Number , repres enti ng one r ow f or ea ch t ype of it em pur cha se d i n a specif i c or der .


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

T he SKU_DATA t abl e uses a n ext ract of t he it em i dent if yi ng and de scr ibi ng dat a i n t he c ompl et e ope r at ional table. T he str uct ure of t he table i s: SKU_DAT A ( SKU, SKU_Descript ion, Departm ent , Buyer) For t hi s t abl e, t her e i s one row t o desc ri be ea ch SK U, repr ese nt i ng one part icular it em t hat i s sol d by Cape Codd. 2.6 Explain, in gener al t erm s, t he r elationsh ips of t he RETAI L_O RDER, O RDER_ITEM, and SKU_DATA t ables. In gene r al , eac h sa le in RET AIL_ORDER r el at es t o one or mor e rows in ORDER_ IT EM t hat det ai l t he it ems s ol d i n t he spe ci fi c or der . Each r ow i n ORDER_ IT EM i s as sociated with a spe ci fi c SK U i n t he SK U _DAT A t abl e. T hus one SKU ma y be a ss oci ated once wi t h eac h spe ci fi c or der number , but ma y al so be as soci at ed wi th man y di f f er ent or der number s ( as l ong as i t appear s onl y once i n eac h or der ) . Usi ng t he Mi cr osoft Acc ess Rel at i onship wi ndow, t he rel at i onshi ps ( i ncl udi ng t he addit i onal r elati onshi ps with t he INV ENT ORY and WAREHOUSE t abl es des cr ibed af ter Revi ew Ques ti on 2.15) ar e shown i n Figur e 2-24 and l ook l i ke t hi s:

Figur e 2 - 23 – The Cape Codd Dat abase w it h t he W AREHO USE and I NVENTORY t ables In t r adi ti o nal dat abas e t er ms ( which wil l be di sc uss ed in Chapter 6) Or der Number and SK U i n ORDER_ IT EM are f or ei gn keys t hat provi de t he li nks t o t he RET AIL_ORDE R and SK U_DAT A t abl es r espect i vel y. Usi ng an under li ne t o show pri mar y ke ys a nd it ali cs t o show f or ei gn k eys, t he t abl es and t hei r r elati onshi ps a re s hown as:


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

RET AI L_O RDER (O r derNumber , St or eNumber , St oreZip, Or der Mont h, Or der Year, O r derT otal) O RDER_IT EM (O r der Number, SKU, Q uantity, Pr ice, Ext endedPr ice) SKU_DAT A ( SKU, SKU_Descript ion, Departm ent , Buyer) 2.7 Summ ar i ze t he backgr ound of SQ L. SQL was devel oped by IB M i n t he l at e 1970s, and i n 1992 it was endor se d as a nat ional standar d by t he Amer i ca n Nat i onal St andar ds Inst i t ut e ( ANSI) . T hat ver si on i s ca ll ed SQL -92. T her e is a l ater versi on cal l ed SQL3 that has some obj ect -or i ent ed concepts, but SQL3 has not rec ei ved much c ommer ci al at t enti on. 2.8 W hat is SQ L- 92? How does it r elate t o t he SQ L st atem ent s in t his chapt er? SQL -92 i s t he ver si on of SQL endor sed as a nati onal st andar d by t he Amer i ca n Nat ion al Sta ndar ds Inst i t ut e ( ANSI) i n 1992. It i s t he ver si on of SQL support ed by most commonl y use d dat abas e mana ge ment syst ems. T he SQL st atement s in t he chapt er are ba sed on SQL -92 and t he SQL st andar ds t hat f ol l owed and modi fi ed i t . 2.9 W hat f eat ures have been added t o SQ L in versions subsequent t o t he SQL - 92? V er sions of SQL subse quent t o SQL -92 have e xt ended f eat ur es or added new feat ur es to SQL, t he most i mpor tant of whi ch , f or our pur pose s, i s suppor t f or Ext ensibl e Mar kup Language ( XML) . 2.10 W hy is SQ L descr i bed as a dat a sublanguage? A dat a sublanguage c onsi sts onl y of l anguage s tat ement s for defi ni ng and pr oce ssing a da t abas e. T o obt ai n a f ul l pr ogr ammi ng l anguage, SQL st atement s must be embedde d i n scr ipt i ng l anguages suc h as V BScr i pt or i n pr ogr ammi ng l ang uages suc h as J ava or C#. 2.11 W hat does DML st and f or ? W hat ar e DML st atem ent s? DML stands f or dat a manipul at i on l anguage . DML st atement s ar e used for queryi ng and modi f yi ng dat a. 2.12 W hat does DDL st and f or ? W hat ar e DDL st at ement s? DDL st ands f or dat a def initi on language . DDL st atement s are us ed f or cr eat i ng tabl es , r elati onshi ps a nd ot her dat abas e quer yi ng and modi f ying dat a.


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

2.13 W hat is t he SQ L SELECT/FRO M/W HERE f ramew ork? T he SQL SELECT/FROM/WHERE fr amework i s t he bas is f or queri es i n SQL. In t his f r amework: T he SQL SELECT claus e spec if ies whi ch col umns a re t o be l isted i n t he quer y r esul ts. T he SQL FROM cl ause s peci fi es whi ch t abl es ar e t o be use d i n the quer y. T he SQL WHERE cl ause spec if ies whi ch r ows ar e t o be li sted i n t he quer y r esults. 2.14 Explain how Micr o sof t Access uses SQ L. Mi cr osof t Acc ess uses SQL, but gener all y hi des t he SQL fr om t he use r . For exa mpl e, Mi cr osoft Acc es s automat i cal l y gene rat es SQL and sends it t o t he Micr osoft Acces s’ s i nter nal Acces s Dat abase Engi ne ( ADE, whi ch i s a vari ant of t he Mi cr osof t J et engi ne) ever y ti me you r un a quer y, pr oce ss a for m or crea t e a repor t . T o go beyond el ement ar y dat abase pr oces sing, you nee d t o know how t o use SQL in Mi cr osoft Acc ess . 2.15 Explain how ent erpr ise - class DBMS products use SQ L. Ente rpri se -cl ass DBMS pr oduct s, whi ch i ncl ude Mi cr osof t SQ L Ser ver , Or acl e Cor porati on’s Or ac le Database and MySQL , and IBM’ s DB2, r equir e you t o know and use SQL. Al l dat a mani pul ati on i s expres sed in SQL in these pr oduct s. The Cape Codd O ut door Spor ts sale extr action database has been m odif ied t o include tw o addit ional t ables, t he I NVENTORY t able and t he W AREHO USE t able. The t able schem as f or t hese t ables, t oget her w ith t he SKU t able, are as follow s: RET AI L_O RDER (O r derNumber , St or eNumber , St oreZip, Or der Mont h, Or der Ye ar, O r derT otal) O RDER_IT EM (O r der Number, SKU, Q uantity, Pr ice, Ext endedPr ice) SKU_DAT A ( SKU, SKU_Descript ion, Departm ent , Buyer) W AREHO USE (W arehouseI D , W arehouseCit y, W arehouseSt ate, Manager, Sq uar ef eet ) I NVENTORY (War ehouseID , SKU, SKU_Description, Q uant it yO nHand, Q uantityO nO r der ) The f ive t ables in t he r evised Cape Codd dat abase schem a ar e show n in Figur e 2 - 24. The column char acter ist ics f or t he W AREHO USE t able ar e show n in Figur e 2 -25, and t he column char acter ist ics f or t he I NVENTORY t able ar e show n in Figur e 2- 26. The data f or t he W AREHO USE t able ar e show n in Figur e 2 - 27, and t he dat a f or t he I NVENTORY t able are show n in Figur e 2- 28.


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

Figur e 2 - 24 – The Cape Codd Dat abase w it h t he W AREHO USE and I NVENTORY t ables

Figur e 2 - 25 - Column Charact er ist ics f or t he W AREHO USE Table

Figur e 2 - 26 - Column Charact er ist ics f or t he I NVENTORY Table


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

Figur e 2 - 27 - Cape Codd O ut door Sport s WAREHO USE Data

Figur e 2 - 28 - Cape Codd O ut door Sport s I NVENTORY Data


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

I f at all possible, you should r un your SQ L solutions t o t he f ollow ing questions against an act ual dat abase. A Micr osof t Access dat abase nam ed Cape - Codd.accdb is available on our W eb sit e ( www . pear sonhighered. com/ kr oenke) t hat cont ains all t he t ables and dat a for t he Cape Codd O utdoor Spor t s sales data extr act dat abase. Also available on our Web site ar e SQ L scr ipt s f or cr eat ing and populating the t ables f or t he Cape Codd dat abase in Micr osof t SQ L Server , Or acle Database, and MySQ L. NOT E: Al l ans wer s bel ow show the c or r ect SQL st at ement , as well as SQL stat ement s modi f i ed f or Micr osoft Acc ess 2013 when ne eded. Whe never poss ibl e, all res ul ts were obtai ned by r unning t he SQL st at ements i n Micr osoft Acc ess 2013, and the c or re spondi ng scree n shot s of t he r es ul ts ar e s hown bel ow. As e xpl ained i n the t ext , some quer i es c annot be run in Mi cr osof t Acc es s 2013, and for t hose queri es t he corr ect r es ul t was obt ained usi ng Mi crosoft SQL Ser ver 2012. T he SQL st at ement s shown shoul d r un wit h l it tle, i f any, modi f i cati on needed f or Or acl e Dat abase 11g Relea se 2 and MySQL 5.6 . Soluti ons t o Pr oj ect Questions 2.1 7 – 2.55 ar e cont ained i n t he Micr osoft Acces s dat abas e DBP- e13 -IM- CH02 - Cape - Codd.acc db whi ch i s a vail abl e on t he t ext ’ s Web sit e ( www.pea rsonhi gher ed.com/ kr oenke ). If your st udents a re usi ng a DBMS ot her than Micr osoft Acc ess , t he SQL code t o cr eat e a nd popul at e t he Cape Codd databa se i s avai lable i n t he *.sql scr ipt f il es f or S QL Ser ver 2012 , Or acl e Dat abase 11g, and MySQL 5.5 in t he Inst r uct or ’s Resour ce Center on t he t ext’ s Web s it e ( www.pea rsonhi gher ed.com/ kr oenke ). 2.16 There is an intent ional f law in t he design of t he INVENTORY t able used in t hese exer cises. This f law w as pur posely included in t he I NVENTORY t ables so that you can answ er som e of t he f ollow ing quest ions using only t hat t able. Compar e t he SKU and I NVENTORY t ables, and det er m ine w hat design f law is included in I NVENTORY. Specif ically, w hy did w e include it? T he fl aw is t he i ncl usi on of t he SK U_Descri pti on att ribut e i n t he INV ENT ORY tabl e. This at tr ibute dupl i cates t he SKU_Des cri pti on att ri but e a nd dat a i n t he SK U_DAT A t abl e, wher e t he at tr ibute ri ght f ul l y be longs. By dupl i cat ing SK U_Des cr i pt i on i n t he INV ENT ORY t able, we can as k you t o l ist t he SK U and i t s associ ated desc ri pt i on in a s ingl e table quer y agai nst the INV ENT ORY t abl e. Ot herwi se , a t wo t abl e quer y woul d be r equir ed. If t hese t abl e s wer e i n a pr odu ct ion dat abas e, we woul d el i mi nat e the INV ENTORY.SK U_Des cr i pt i on column.


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

Use only t he I NVENTORY t able t o answ er Review Q uest ions 2. 17 t hrough 2. 39: 2.17 Wr it e an SQ L st at ement t o display SKU and SKU_Descript ion. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). SELECT SKU, SKU_Description FROM INVENTORY;


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

T he questi on does not ask f or uni que SK U and SK U_Des cri pti on data, but coul d be obtai ned by usi ng: SELECT UNIQUE SKU, SKU_Description FROM INVENTORY;


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

2.18 Wr it e an SQ L st at ement t o display SKU_Descript ion and SKU. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oe nke ). SELECT SKU_Description, SKU FROM INVENTORY;


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

T he questi on does not ask f or uni que SK U and SK U_Des cri pti on data, but coul d be obtai ned by usi ng: SELECT UNIQUE SKU_Description, SKU FROM INVENTORY;

2.19 Wr it e an SQ L st at ement t o display War ehous eID. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). SELECT Warehouse ID FROM INVENTORY;


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

2.20 Wr it e an SQ L st at ement t o display unique War ehouse I Ds . SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). SELECT DISTINCT Warehouse ID FROM INVENTORY;

2.21 Wr it e an SQ L st at ement t o display all of t he colum ns w it hout using t he SQ L ast erisk (* ) w ildcar d char act er. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). SELECT WarehouseID , SKU , SKU_Description , QuantityOnHand , QuantityOnOrder FROM INVENTORY ;


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

2.22 Wr it e an SQ L st at ement t o display all of t he colum ns using t he SQ L ast erisk ( *) w ildcar d char acter . SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oe nke ). SELECT * FROM INVENTORY;


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

2.23 Wr it e an SQ L st at ement t o display all dat a on product s having a Q uant it yO nHand great er t han 0. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). SELECT * FROM INVENTORY WHERE QuantityOnHand >0;


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

2.24 Wr it e an SQ L st at ement t o display t he SKU and SKU_Descript ion f or pr oducts having Q uantityO nHand equal to 0. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). SELECT SKU, SKU_Description FROM INVENTORY WHERE QuantityOnHand =0;

2.25 Wr it e an SQ L st at ement t o display t he SKU, SKU_Descript ion, and War ehouse f or products having Q uant it yO nHand equal t o 0. So rt t he r esults in ascending order by W ar ehouseID. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). SELECT SKU, SKU_Description, Warehouse ID FROM INVENTORY WHERE QuantityOnHand =0 ORDER BY Warehouse ID ;


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

2.26 Wr it e an SQ L st at ement t o display t he SKU, SKU_Descript ion, and War ehouse ID f or products having Q uant it yO nHand gr eat er t han 0. Sort t he r esult s in descending order by W ar ehouseI D and ascending order by SKU . SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). SELECT SKU , SKU_Description , WarehouseID FROM INVENTORY WHERE QuantityOnHand > 0 ORDER BY WarehouseID DESC , SKU ;


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

2.27 Wr it e an SQ L st at ement t o display SKU, SKU_Descript ion, and War ehouseID f or all products t hat have a Q uant it yO nHand equal t o 0 and a Q uantit yO nOr der great er t han 0. Sort t he r esult s in descending order by War ehouseID and in ascending order by SK U. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). SELECT SKU , SKU_Description , WarehouseID FROM INVENTORY WHERE QuantityOnHand = 0 AND QuantityOnOrder > 0 ORDER BY WarehouseID DESC , SKU ;

2.28 Wr it e an SQ L st at ement t o display SKU, SKU_Descript ion, and War ehouseID f or all products t hat have a Q uant it yO nHand equal t o 0 or a Q uant it yO nO r der equal t o 0. Sor t t he r esult s in descending order by W ar ehouseID and in ascending or der by SKU. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). SELECT SKU , SKU_Description , WarehouseID FROM INVENTORY WHERE QuantityOnHand = 0 OR QuantityOnOrder = 0 ORDER BY WarehouseID DESC , SKU ;


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

2.29 Wr it e an SQ L st at ement t o display t he SKU, SKU_Descript ion, W arehouseID, and Q uantityO nHand f or all pr oducts having a Q uantityO nHand gr eat er t han 1 and less t han 10. Do not use t he BETW EEN keyw ord. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). SELECT SKU , SKU_Description , WarehouseID , QuantityOnHand FROM INVENTORY WHERE QuantityOnHand > 1 AND QuantityOnhand < 10 ;


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

2.30 Wr it e an SQ L st at ement t o display t he SKU, SKU_Descript ion, W arehouseID, and Q uantityO nHand f or all pr oducts having a Q uantityO nHand gr eat er t han 1 and less t han 10. Use t he BETW EEN keyw ord. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). SELECT SKU , SKU_Description , WarehouseID , QuantityOnHand FROM INVENTORY WHERE QuantityOnHand BETWEEN 2 AND 9 ;

2.31 Wr it e an SQ L st at ement t o show a unique SKU and SKU_Descript ion f or all products having an SKU descr iption st ar t ing w it h ‘Half - dom e ’. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). Not e that , as di scus sed i n Chapt er 2, Micr osoft Acces s 2013 uses wil dcar d char acter s t hat dif fer f r om t he SQL st andar d . For Mi cr osof t SQL Ser ver , Or ac le Database and MySQL: SELECT DISTINCT SKU , SKU_Description FROM INVENTORY WHERE SKU_Description LIKE 'Half - dome%' ;

For Mi cr osof t Acce ss: SELECT DISTINCT SKU , SKU_Description FROM INVENTORY WHERE SKU_Description LIKE 'Half - dome*' ;


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age

2.32 Wr it e an SQ L st at ement t o show a unique SKU and SKU_Descript ion f or all products having a descr iption t hat includes t he w or d ' Clim b'. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he Mi cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). Not e that , as di scus sed i n Chapt er 2, Micr osoft Acces s 2013 uses wil dcar d char acter s t hat dif fe r f r om t he SQL st andar d . For Mi cr osof t SQL Ser ver , Or ac le Database and MySQL: SELECT DISTINCT SKU , SKU_Description FROM INVENTORY WHERE SKU_Description LIKE '%Climb%' ;

For Mi cr osof t Acce ss: SELECT DISTINCT SKU , SKU_Description FROM INVENTORY WHERE SKU_Description LIKE '*Climb*' ;

2.33 Wr it e an SQ L st at ement t o show a unique SKU and SKU_Descript ion f or all products having a ‘d ’ in t he t hir d posit ion fr om t he left in SKU_Descript ion. SQL Sol uti ons t o Pr oj ect Ques ti ons 2.17 – 2.52 ar e cont ai ned i n t he M i cr osoft Acce ss databa se DBP- e13 -IM- CH02 - Cape -Codd - RQ.accdb which is avai l abl e on t he t ext ’s Web si t e ( www.pea rsonhi gher ed.com/ kr oenke ). Not e that , as di scus sed i n Chapt er 2, Micr osoft Acces s 2013 uses wil dcar d char acter s t hat dif fer f r om t he SQL st andar d . For Mi cr osof t SQL Ser ver , Or ac le Database and MySQL: SELECT DISTINCT SKU , SKU_Description FROM INVENTORY WHERE SKU_Description LIKE ' d%' ;

For Mi cr osof t Acce ss:


Chapt er T wo – Intr oduc t ion to S tr uc tured Q uer y La ngu age for Database Processing Fundamentals Design

Solutions Manual and Implementation 13th Edition by Kroenke Full clear download (no error formatting) at : https://downloadlink.org/p/solutions-manual-for-database-processingfundamentals-design-and-implementation-13th-edition-by-kroenke/ Test Bank for Database Processing Fundamentals Design and Implementation 13th Edition by Kroenke Full clear download (no error formatting) at : https://downloadlink.org/p/test-bank-for-database-processing-fundamentalsdesign-and-implementation-13th-edition-by-kroenke/ database processing fundamentals design and implementation 13th edition pdf database processing fundamentals design and implementation 14th edition pdf database processing 13th edition pdf download database processing fundamentals design and implementation 14th edition solutions database processing fundamentals design and implementation 14th edition pdf download database processing fundamentals design and implementation solution manual database processing fundamentals design and implementation answers database processing 13th edition solutions pdf


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.