{"id":105,"date":"2013-12-12T00:10:05","date_gmt":"2013-12-12T00:10:05","guid":{"rendered":"http:\/\/opentextbc.ca\/dbdesign01\/?post_type=back-matter&#038;p=105"},"modified":"2014-10-23T17:39:58","modified_gmt":"2014-10-23T17:39:58","slug":"appendix-b-erd-exercises","status":"publish","type":"back-matter","link":"https:\/\/opentextbc.ca\/dbdesign01\/back-matter\/appendix-b-erd-exercises\/","title":{"raw":"Appendix B Sample ERD Exercises ","rendered":"Appendix B Sample ERD Exercises"},"content":{"raw":"<h2>Exercise 1<\/h2>\r\n<h3>Manufacturer<\/h3>\r\nA manufacturing company produces products. The following product information is stored: product name, product ID and quantity on hand. These products are made up of many components. Each component can be supplied by one or more suppliers. The following component information is kept: component ID, name, description, suppliers who supply them, and products in which they are used. Use Figure B.1 for this exercise.\r\n\r\nCreate an ERD to show how you would track this information.\r\n\r\nShow entity names, primary keys, attributes for each entity, relationships between the entities and cardinality.\r\n<h3>Assumptions<\/h3>\r\n<ul>\r\n\t<li>A supplier can exist without providing components.<\/li>\r\n\t<li>A component does not have to be associated with a supplier.<\/li>\r\n\t<li>A component does not have to be associated with a product. Not all components are used in products.<\/li>\r\n\t<li>A product cannot exist without components.<\/li>\r\n<\/ul>\r\n<h3>ERD Answer<\/h3>\r\nComponent(<span style=\"text-decoration: underline\">CompID<\/span>, CompName, Description) PK=CompID\r\n\r\nProduct(<span style=\"text-decoration: underline\">ProdID,<\/span> ProdName, QtyOnHand) PK=ProdID\r\n\r\nSupplier(S<span style=\"text-decoration: underline\">uppID<\/span>, SuppName) PK = SuppID\r\n\r\nCompSupp(<span style=\"text-decoration: underline\">CompID, SuppID<\/span>) PK = CompID, SuppID\r\n\r\nBuild(<span style=\"text-decoration: underline\">CompID, ProdID<\/span>, QtyOfComp) PK= CompID, ProdID\r\n\r\n[caption id=\"attachment_103\" align=\"aligncenter\" width=\"300\"]<a href=\"http:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2013\/12\/Ch-16-Component-Product-ERD-Answer-300x160.jpg\"><img src=\"http:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2013\/12\/Ch-16-Component-Product-ERD-Answer-300x160.jpg\" alt=\"Ch-16-Component-Product-ERD-Answer-300x160\" class=\"wp-image-103 size-full\" height=\"160\" width=\"300\" \/><\/a> Figure B.1 by A. Watt.[\/caption]\r\n\r\n&nbsp;\r\n<h2>Exercise 2<\/h2>\r\n<h3>Car Dealership<\/h3>\r\nCreate an ERD for a car dealership. The dealership sells both new and used cars, and it operates a service facility (see Figure B.2). Base your design on the following business rules:\r\n<ul>\r\n\t<li>A salesperson may sell many cars, but each car is sold by only one salesperson.<\/li>\r\n\t<li>A customer may buy many cars, but each car is bought by\u00a0only one customer.<\/li>\r\n\t<li>A salesperson writes a single invoice for each car he or she sells.<\/li>\r\n\t<li>A customer gets an invoice for each car he or she buys.<\/li>\r\n\t<li>A customer may come in just to have his or her car serviced; that is, a customer\u00a0need not buy a car to be classified as a customer.<\/li>\r\n\t<li>When a customer takes one or more cars in for repair or service, one service ticket is written for each car.<\/li>\r\n\t<li>The car dealership maintains a service history for each of the cars serviced. The service\u00a0 records are referenced by the car\u2019s serial number.<\/li>\r\n\t<li>A car brought in for service can be worked on by many mechanics, and each mechanic may work on many cars.<\/li>\r\n\t<li>A car that is serviced may or may not need parts (e.g., adjusting a carburetor or\u00a0cleaning a fuel injector nozzle does not require providing new\u00a0parts).<\/li>\r\n<\/ul>\r\n<h3>ERD Answer<\/h3>\r\n<a href=\"http:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2014\/10\/carDealership.png\"><img src=\"http:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2014\/10\/carDealership.png\" alt=\"carDealership\" class=\"aligncenter wp-image-1092\" height=\"418\" width=\"500\" \/><\/a>","rendered":"<h2>Exercise 1<\/h2>\n<h3>Manufacturer<\/h3>\n<p>A manufacturing company produces products. The following product information is stored: product name, product ID and quantity on hand. These products are made up of many components. Each component can be supplied by one or more suppliers. The following component information is kept: component ID, name, description, suppliers who supply them, and products in which they are used. Use Figure B.1 for this exercise.<\/p>\n<p>Create an ERD to show how you would track this information.<\/p>\n<p>Show entity names, primary keys, attributes for each entity, relationships between the entities and cardinality.<\/p>\n<h3>Assumptions<\/h3>\n<ul>\n<li>A supplier can exist without providing components.<\/li>\n<li>A component does not have to be associated with a supplier.<\/li>\n<li>A component does not have to be associated with a product. Not all components are used in products.<\/li>\n<li>A product cannot exist without components.<\/li>\n<\/ul>\n<h3>ERD Answer<\/h3>\n<p>Component(<span style=\"text-decoration: underline\">CompID<\/span>, CompName, Description) PK=CompID<\/p>\n<p>Product(<span style=\"text-decoration: underline\">ProdID,<\/span> ProdName, QtyOnHand) PK=ProdID<\/p>\n<p>Supplier(S<span style=\"text-decoration: underline\">uppID<\/span>, SuppName) PK = SuppID<\/p>\n<p>CompSupp(<span style=\"text-decoration: underline\">CompID, SuppID<\/span>) PK = CompID, SuppID<\/p>\n<p>Build(<span style=\"text-decoration: underline\">CompID, ProdID<\/span>, QtyOfComp) PK= CompID, ProdID<\/p>\n<figure id=\"attachment_103\" aria-describedby=\"caption-attachment-103\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2013\/12\/Ch-16-Component-Product-ERD-Answer-300x160.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2013\/12\/Ch-16-Component-Product-ERD-Answer-300x160.jpg\" alt=\"Ch-16-Component-Product-ERD-Answer-300x160\" class=\"wp-image-103 size-full\" height=\"160\" width=\"300\" srcset=\"https:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2013\/12\/Ch-16-Component-Product-ERD-Answer-300x160.jpg 300w, https:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2013\/12\/Ch-16-Component-Product-ERD-Answer-300x160-65x34.jpg 65w, https:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2013\/12\/Ch-16-Component-Product-ERD-Answer-300x160-225x120.jpg 225w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-103\" class=\"wp-caption-text\">Figure B.1 by A. Watt.<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<h2>Exercise 2<\/h2>\n<h3>Car Dealership<\/h3>\n<p>Create an ERD for a car dealership. The dealership sells both new and used cars, and it operates a service facility (see Figure B.2). Base your design on the following business rules:<\/p>\n<ul>\n<li>A salesperson may sell many cars, but each car is sold by only one salesperson.<\/li>\n<li>A customer may buy many cars, but each car is bought by\u00a0only one customer.<\/li>\n<li>A salesperson writes a single invoice for each car he or she sells.<\/li>\n<li>A customer gets an invoice for each car he or she buys.<\/li>\n<li>A customer may come in just to have his or her car serviced; that is, a customer\u00a0need not buy a car to be classified as a customer.<\/li>\n<li>When a customer takes one or more cars in for repair or service, one service ticket is written for each car.<\/li>\n<li>The car dealership maintains a service history for each of the cars serviced. The service\u00a0 records are referenced by the car\u2019s serial number.<\/li>\n<li>A car brought in for service can be worked on by many mechanics, and each mechanic may work on many cars.<\/li>\n<li>A car that is serviced may or may not need parts (e.g., adjusting a carburetor or\u00a0cleaning a fuel injector nozzle does not require providing new\u00a0parts).<\/li>\n<\/ul>\n<h3>ERD Answer<\/h3>\n<p><a href=\"http:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2014\/10\/carDealership.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2014\/10\/carDealership.png\" alt=\"carDealership\" class=\"aligncenter wp-image-1092\" height=\"418\" width=\"500\" srcset=\"https:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2014\/10\/carDealership.png 997w, https:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2014\/10\/carDealership-300x250.png 300w, https:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2014\/10\/carDealership-65x54.png 65w, https:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2014\/10\/carDealership-225x188.png 225w, https:\/\/opentextbc.ca\/dbdesign01\/wp-content\/uploads\/sites\/11\/2014\/10\/carDealership-350x292.png 350w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n","protected":false},"author":1,"menu_order":2,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"back-matter-type":[26],"contributor":[],"license":[],"class_list":["post-105","back-matter","type-back-matter","status-publish","hentry","back-matter-type-appendix"],"_links":{"self":[{"href":"https:\/\/opentextbc.ca\/dbdesign01\/wp-json\/pressbooks\/v2\/back-matter\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opentextbc.ca\/dbdesign01\/wp-json\/pressbooks\/v2\/back-matter"}],"about":[{"href":"https:\/\/opentextbc.ca\/dbdesign01\/wp-json\/wp\/v2\/types\/back-matter"}],"author":[{"embeddable":true,"href":"https:\/\/opentextbc.ca\/dbdesign01\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":19,"href":"https:\/\/opentextbc.ca\/dbdesign01\/wp-json\/pressbooks\/v2\/back-matter\/105\/revisions"}],"predecessor-version":[{"id":1121,"href":"https:\/\/opentextbc.ca\/dbdesign01\/wp-json\/pressbooks\/v2\/back-matter\/105\/revisions\/1121"}],"metadata":[{"href":"https:\/\/opentextbc.ca\/dbdesign01\/wp-json\/pressbooks\/v2\/back-matter\/105\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/opentextbc.ca\/dbdesign01\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"back-matter-type","embeddable":true,"href":"https:\/\/opentextbc.ca\/dbdesign01\/wp-json\/pressbooks\/v2\/back-matter-type?post=105"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/opentextbc.ca\/dbdesign01\/wp-json\/wp\/v2\/contributor?post=105"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/opentextbc.ca\/dbdesign01\/wp-json\/wp\/v2\/license?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}