Sei sulla pagina 1di 10

National University of Computer & Emerging Sciences

Databases Systems (CS204) Assignment # 1 Falls 2011


Instructor: Muhammad Rafi
You are required to submit this assignment in three phases. The due date is mention in front of each phase. Phase No. 1 ER Modeling Phase No. 2 Relational Model Phase No. 3 Schema Refinement Note: Phase No. 1 ER Modeling ER model should be developed using any tool available for schema designing. There are few very good tools available at Netstorage Phase No. 2 Relational Model Relational model must be developed in any SQL sublanguage. The script should contain all integrity check, validation and testing code. Phase No. 3 Schema Refinement The schema refinement phase required you to go through your design again and apply normalization techniques and other optimization features. The submission will be a refine schema script. Date of Submission: 26th September 2011 Date of Submission: 10th October 2011 Date of Submission: 20th October 2011

Problem No. 1 WyFy


WyFy (Pvt.) Ltd. recently launches the wireless-based broadband internet access in Karachi, a city of more than 20 million people. They need to have a web-based CRM application which runs and improve their business. The web-application has sign-in form where they collect the information like CNIC, name, DOB, Gender, address in standard form, phone, cell, e-mail and connection type. They are offering two device types for connection a USB Shuttle which does not required additional power and USB Box which need an additional power. Each device has a manufacture id, a serial number, a device code and a connection code. The company need to keep track of which device is assigned to which user. A user can sign on via web. There are many regional office of WyFy, in the next step he has to go to the regional office to pay a connection charges which changes as per promotion. They also need one month advanced payment to give you access to internet. The user can pay the monthly charges to any such office by just mentioning the connection code, which is unique. There are two types of connections. NetSurf 512MB, which allow 10GB of download per month with a fixed charges of Rs.750/=, each additional GB cost Rs. 60/= The other connection is WyFy-Discover which support 1MB of connection and 15GB of download per month with a fixed charges of Rs. 1000/=, each additional GB cost Rs. 40/=. Each time a user connection the application keep track of several things like: time of connection, IP assigned, bytes downloaded, bytes uploaded, and time of disconnection. Each user can view on the website, how many times he has connected, what is the available download limit, last five payments he has made against his connection. The company needs a provision to support different other type of connection, different promotion- initially there are two promotions NetSurf and WyFy Discover. In each promotion there is a connection bandwidth, download limit, cost of extra download per GB, monthly changes and a promotion acceptance charges. The company has rights to waive promotion charges. The company need to identify the user who has made the maximum downloads, has connected longest time with WyFy, and the user who has not utilized there allowable download limits more than 50%. You need to develop an ER model for above requirements. The design should be flexible enough to handle all future enhancements as suggested above.

Problem No. 2 NU-Mag


The National University of Computer & Emerging Science, Karachi Campuss webmaster team came up with an idea of publishing an online magazine; all departments of the university can publish their articles in it. It is decided that all departments can have equal number of pages in each edition of the magazine. The magazine can be published any number of times every year. Every edition is identified by its cover, edition and date of publication online. Every department can submit it articles at any time, the reviewer team review and decide about the article to be published. Articles can be submitted via submission page in only MS Word format. The accepted articles are subsequently published in upcoming edition of the magazine. There are some special articles on request from the editors. The length of the articles can vary, the large articles are published in series of magazine as decided by editorial team, and you need to keep track of the number of edition in which such articles appeared. It is decided that once a large article is published as it first episode, it will continuously published in subsequent edition that is there will be no gap in series of article. An article can be written by one or more than one person. It can belong to a number of different categories. Each magazine is comprises of different sections, represented by different departments. An index is build for each magazine that shows each section along with each article with in a section. Example <NU-Mag, Edition 2.2, published online September 10, 2011> <Section -Electrical Engineering> 1. Solving the circuit <K08-0098> page 1-3 2. Whats up doc!! < K07-1102, K07-0234> page 4-6 <Section Computer Science > 1. How to win a Programming Competition <K09-0090> page 1-2 2. Arrays in C++ < Mr. Muhammad Rafi> page 3 3. XML < K07-0874> page 4-6 <Section Humanities > 1. Respect me Episode -1 <K10-0012> page 1-4 2. Linear Algebra < K09-0234> page 5-6 <Section -Business> 1. Learning Organizational Behavior Episode -2 <K09-0090> page 1-5 2. Islamic Banking < K11-0230> page 6

Problem No. 3
ShopNSaveisamailorderfirm.Itisamoderatesizedfirmcompetingwithlargerfirmsformailorder business.WhileShopNSavesellsmanyproducts,thefirmdoesnotproduceanyoftheproductssold; rather, the firm purchase products from wholesale distributors, have its label affixed to the products, andretailtheproductstocustomers. ShopNSave Pvt. Ltd is in the process of reengineering the automated order entry and product inventory management system. Your task is to use the Entity Relationship Model to develop a conceptual model of this system. Your eventual product is a model diagram of the system (for this assignmentonly)andalistoftablesandthefieldsinthetables(nextphase). CustomerTracking ShopNSavemaintainsanextensiveclientbase.IfyoueverpurchasedanythingfromShopNSave,you are almost guaranteed to be a lifetime customer of the firm. ShopNSave issues customers a credit cardwithauniquecustomeridentificationnumberassignedtoeachcustomer.Eachcreditcardhasan expirationdate,butifacustomermaintainsagoodcreditstanding,thefirmautomaticallyreissuesthe carduponexpiration.Thecreditcardservestoidentifythecustomer. The firm tracks each customers name, current address (including street, city, state, and zip code), current home telephone number, alternative telephone number (such as a work telephone number), emailaddress(ifthecustomerhasone),creditrating(acodedfieldrangingfrom1to5with1beingthe bestand5beingtheworst),creditcardexpirationdate,currentaccountbalance(thismaybenegative orpositive),creditbalancelimit(somepositivenumber),andthedateanorderwaslastplacedwiththe firm. SalesOrderProcessing Customersmaketelephonicordersbyusingtheircreditcardnumber.Typicalordersincludemorethan oneproductonanorder;forexample,acustomermayorderawasherandadryerbytelephoneonthe same order. Some orders have 50 items or more, but most orders have only a few items, sometimes only one item on an order. It is possible for customers to have several orders outstanding simultaneously.Itisalsopossibleforcustomerstohavenoordersoutstandingatapointintime. Orders are identified by ShopNSave as belonging to a single customer by their customer number (credit card number). A typical order is depicted in Figure #1. Order delivery is promised on a date agreed upon with the customer. Each order is uniquely identified by the combination of the order number and order date. The extended price field is computed as the product price times quantity ordered.HeretheproductpriceistheagreeduponpricesinceaShopNSavesalespersonmayoverride theregularpriceforanitemsoastocompleteasalethatmightotherwisebelost.

Figure#1.TypicalCustomerOrder.

ShopnSaveCustomerOrder OrderNo:1234 OrderDate:03/08/2004 CustomerNo.78691234

AhmedUsmani 123GardenStreet Karachi75412Pakistan ProductNo. Description

DeliverPromisedon:12/08/2004 Salesperson:Zone3,ID12389

Price

Quantity Ordered

Extended Price Rs.208.00 Rs.88.00

2345 2367

FlashDishWasher LuxBeautySoap

Rs.208.00 Rs.22.00

1 4

Subtotal: Discount: OrderTotal:


296.00 16.00 Rs.280/=

Thediscountamountofferedtoacustomerisafunctionoftheindividualcustomerscreditrating.Table #1givesthenormaldiscountsprovidedbyShopNSave. Table#1.SalesDiscountsProvidedasaFunctionofCustomerCreditRating.


CreditRating 1 2 3 4 5 DiscountProvided 20% 16% 12% 10% 7%

Notethatproductsmaybeorderedbymanydifferentcustomers,e.g.severaldifferentcustomersmay orderproduct#5672.Someproductsmaynotappearonanyorderthesearethe"dogs"sincenobody wantstobuythem.PeriodicallyShopNSavehasasalethatisannouncedbyaspecialmailingto customersinordertoclearinventoryof"dog"products. ShopNSavemaintainsamailordercataloglistingallproductsincludingapictureoftheproductfor manyproducts.Thefirmtrackseachproductsidentificationnumber(whichisassignedbythefirmand isunique),productdescription,anddesiredprice.Notethatthisisdifferentfromthenegotiatedprice thatappearsontheorder(eventhoughthecolumnheadingontheorderislabeledPrice,thisisstillthe negotiatedpriceforthatspecificorder). Inordertoexpeditecertainsearchesofthedatabase,itisrecommendedthattheordersubtotaland ordertotalbestored(eventhoughthetotalamountcanbecomputed).Theextendedpriceonan individuallineandtheorderdiscountneednotbestoredasthesefigurescanbecomputedeasily wheneveraviewofthedatabaseisdefined.Itisalsonecessarytotrackthequantityorderedforeach productonanorder.

DeliverytoCustomers Deliveryofproductsonanordertoacustomerisactuallyfairlycomplextotrack.First,thefirmtracks theactualdateofdeliveryofanordersoastosupportperiodassessmentsofthefirmsservicequality. Sometimesallitemsonanorderarenotdeliveredonthesamedate,i.e.,someitemsarebackordered forthecustomer;thus,itisnecessarytotrackthedeliverydateonanitembyitembasis.Thefirmwants thecomputersystemtogenerateauniquedeliverynumberforeachdelivery. Infact,thisexplanationisoversimplifiedforsomeorders.Whereanindividuallineitemquantityis greaterthanone,itispossibleforthefirmtodeliverpartofalineitemquantityinonedeliveryandpart inanotherdelivery.Figure#1showsacustomerwhohasorderedfoureachofproduct#563672,Chair, w/oarms.IfShopNSavehasthreechairsinstockatawarehouse,thechairsinstockwillbedelivered tothecustomerandonechairwillbebackorderedpendingreceiptofachairfromavendorsupplier.In fact,ifShopNSavehasthreechairsatonewarehouseandafourthchairatanotherwarehouse,the customerwillactuallyreceivetwoseparatedeliveriesofchairsonefromeachwarehouse.Inthis situation,itisnecessarytotrackthedateofeachdeliveryofalineitembyquantity.Anappropriate modelingapproachistocreateaDeliveryToCustomerentitythatcanbeusedtostoredataabouteach delivery. Vendors,ProductTracking,andWarehouses ShopNSavehasnumerouswholesalevendorswhosupplyproductsforresale.Eachvendorhasa uniquevendoridentificationnumberassignedbyShopNSave,eachvendorhasmanydifferentvendor salespersonswhomaycontactShopNSave.Itisnecessarytotrackeachofthesevendorsalespersons namesandtheirworktelephonenumber.ShopNSavealsotracksthenameoftheprimarycontact personforeachvendor,andthecontactpersonsindividualworktelephonenumberintheeventthata problemwithawholesalepurchaseorderarisesthatneedstoberesolvedwhentheoriginalsalesperson isunavailable. Notallvendorssupplyallproducts,butmostproductsaresuppliedbymorethanonevendor.Since ShopNSavedoesnotmanufacturetheirownproductseverythingispurchasedforresaleitis importanttobeabletotrackthetypicalpricesthateachvendortendstoquoteforanitem.For example,product#415672thatShopNSavesellsisavailablefromtheABCFurnitureCompanyfora wholesalepriceofRs.238.45/=ThesametablecanbepurchasedfromtheXYZFurnitureCompanyfora wholesalepriceofRs.245.90.ShopNSavepreviouslymaintainedacatalogbookofavailableitemsfor eachvendor,butwithsome2500vendors,itismuchmoreefficienttohaveproductinformationonline asthisenablesproductpricecomparisonsbypurchasingclerkswhoarecontractingwithvendorsfor stockageitems. Someproductsrequirespecialhandlingandspecialstorage.Inadditiontotheproductattributesnoted above,itisnecessarytotrackspecialhandlingandspecialstoragenotesforeachproductwiththese requirements.Specialhandlingandspecialstoragerequirementsarebothstoredascodedfieldsinthe

currentsystem,andShopNSavewishestocontinuethispractice.Currentlytwotablesexistthatstore thefulldescriptionofthespecialhandlingorspecialstoragerequirementthatisassociatedwithan individualcode. ShopNSavehasasinglesalesorderprocessingfacilityaswellas465warehousefacilitieslocated throughoutthecountry.Eachwarehousehasauniquewarehousenumberassignedtoit,butworkers tendtorefertothewarehousesbythecityinwhichtheyarestored,althoughsomecitieshavemore thanonewarehouse.Inadditiontotheidentifyingnumber,eachwarehousehasasingleaddress,city, state,andpostcode,andtelephonenumber. WheneverShopNSaveissuesapurchaseordertoreplenishwarehousestock,itisnecessarytotrack whichvendorisshippingtheordertoawarehouse.Itisalsonecessarytotracktheproductsthat comprisethepurchaseordersinceasinglepurchaseordercanbeformultipleproducts.Figure#2shows asamplepurchaseorder. TheseshipmentsrenewwarehouseinventorieswhichShopNSavemaintainsinordertofillcustomer ordersonatimelybasis.Inadditiontotheattributesmentionedpreviouslyforproductsandvendors, ShopNSaveassignsauniqueshipmentnumbertoeachshipment.Someshipmentsbyavendortoa warehouseconsistofmultipleproducts.Itisalsonecessarytotrackeachshipmentsshippingdate/time (date/timethevendorshipstheordertoShopNSave),thequantityofeachproductonashipmenttoa specificwarehouse,theestimatedshipmentarrivaldate,andtheshipmentmode(acodedattribute). Thefirmmustalsotrackthequantityactuallyonhand(instock)ofeachproductateachwarehouse,as wellasthequantitybackorderedthatisdueinasaresultofhavingissuedapurchaseordertoa vendor.

Figure#2.SamplePurchaseOrder.

ShopnSavePurchaseOrder
PurchaseOrderNo:5123345 PurchaseOrderDate:03/08/2004

VendorNo.3124056 ABCFurnitureCompany 345MainStreet,GulsaneIqbal Karachi74360Pakistan

DeliverPromisedon:13/08/2004 Deliverto: Warehouse#14 21/C,SITEAreaKarachi Pakistan

ProductNo. Description Price Quantity Ordered 15672 63634 PaymentTerms:2%10days;net30days


Extended Price 2,250.00 8,000.00

Table,Walnut Chair,w/oarms

Rs.225.00 Rs.200.00

10 40

OrderTotal:

Rs.10,250.00

SalesStaff ShopNSavetracksinformationofitsemployees.Eachemployeehasaname,address,socialsecurity number,telephonenumber,salaryamount,anddateofbirth.Someemployeessuperviseother employees.Whileitisnecessarytotrackthesupervisorforagivenemployee,thereisnoadditional informationthatthefirmtracksforsupervisors.Someemployeesdonotsuperviseanyone.No employeehasmorethanonesupervisor.Thefirmalsotrackswhetherornotanemployeeworksata warehouseoratthefirmscentralsalesprocessingfacility. ReferagaintoFigure#1.Notethatthefirmtrackswhichsalesperson(atypeofemployee)makesasale toacustomer.Thisinformationmustalsobecapturedbecausethefirmintendstoinitiateasalesperson incentiveprograminthenearfuture.Currentlysalespersonsworkforastraightsalary,butinthefuture, salespersonswillbeonasalarypluscommission. InvoicingCustomers Inadditiontotheentitiesandobjectsnotedabove,itisnecessarytobeabletostoreinformationabout thecustomerinvoice.Youmaywishtodesignanappropriateinvoiceaspartoftheexercise;however,it willnotbegraded.Designingtheinvoicewillhelpyouvisualizethedatathatmustbestoredinorderto modeltheinvoicingpartofthesystem.ShopNSavebillscustomersonanorderbyorderbasis.The invoicewouldshowappropriateinvoicedatasothatthecustomer,theproductsorderedandtheir associatedordernumberandorderdate,thequantitiesorderedanddelivered(previouslyandonthis order),andthenegotiatedpricesareidentifiedontheinvoice.Theinvoicewouldalsoshowdiscounts given,anypreviouspaymentsmade,andtheamountdueonthisinvoice(IhavediscussedanInvoice exampleintheclassaswell).Notethatanindividualordercanresultinmultipleinvoicessincesome products may be backordered and delivered at a later date, and some customers have to be billed multiple times in order to get them to pay their bill. Each invoice would have a unique number assigned as well as an invoice date. Your final solution should also enable recording customer payments on an invoice. The system should also enable updating the customer's account balance.

NOTE: All these scenarios are imaginary and design to teach ER Modeling techniques. There are chances to suffer error of omission. If you can recommend ways to make the problem more realistic without being unnecessarily burdensome with respect to the learning that takes place, please put your recommendations in writing and I will consider awarding bonus points for your thoughts and effort. You can create your own case like this I will award bonus points for the same as well.

Potrebbero piacerti anche