[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-656122-105":3,"detail-sidebar-cat-0-en-105":81,"doc-detail-656122-en":130},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":74,"head_meta":76,"extra_data":78,"updated_unix":80},105,"en","translating-entity-relationship-to-relational-tables-fall-2026-david-toman","Translating Entity-Relationship to Relational Tables - Fall 2026 - David Toman","","Database ER-to-relational translation notes for CS338 in Fall 2026 by David Toman. Covers how entity sets become tables with corresponding columns, how primary and foreign keys are chosen, and how relationship sets map either to attributes in existing tables or to separate relationship tables. Includes special handling for weak entity sets (identifying relationships and key inheritance), relationship cardinalities, and generalization approaches, with worked ER-to-schema examples and SQL DDL patterns for primary keys, foreign keys, and CHECK/trigger-related constraints.",{"@graph":14,"@context":73},[15,34,56],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/translating-entity-relationship-to-relational-tables-fall-2026-david-toman/656122/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/translating-entity-relationship-to-relational-tables-fall-2026-david-toman/656122.png","ImageObject",300,407,{"name":42,"@type":43},"Lucas Martin","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-10-31","2026-10-25",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",5,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"How does an entity set in ER translate to a relational table?","Question",{"text":63,"@type":64},"An entity set E translates to a table E, and each attribute of E becomes a column. The primary key of the entity set becomes the primary key of the table.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"What special rules apply to weak entity sets when mapping to relational tables?",{"text":68,"@type":64},"A weak entity set E translates to table E. The table must include the weak entity attributes, the attributes of the identifying relationship, and the primary key attributes of the dominating entities; these keys together determine the table’s primary key.",{"name":70,"@type":61,"acceptedAnswer":71},"How are relationship sets mapped in the relational model?",{"text":72,"@type":64},"An identifying relationship set for a weak entity typically requires no separate action. If the relationship’s general cardinality is (1,1) for a component entity set, relevant relationship attributes and remaining component primary key attributes are added to that entity’s table; otherwise the relationship maps to a separate table R.","https://schema.org",{"og:url":32,"og:type":75,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":77,"canonical":32},"index,follow",{"doc_id":79,"site_id":7},656122,1793029517,{"code":4,"msg":82,"data":83},"success",[84,88,92,96,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":85,"show_sort_weight":86,"slug":87},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":89,"show_sort_weight":90,"slug":91},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":93,"show_sort_weight":94,"slug":95},"Exam",70,"exam",{"id":55,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":102,"slug":103},6,50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":55,"slug":129},19,"General","general",{"code":4,"msg":82,"data":131},{"doc_id":79,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":101,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":115,"language":139,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":12,"update_tm":143,"read_time":144},8796095360427,"https://ap-avatar.wpscdn.com/davatar_994ba38a5ba835b3df7d355c54d3ed8d","Translating Entity-Relationship to Relational Tables  \nFall 2026  \nDavid Toman  \nSchool of Computer Science  \nUniversity of Waterloo  \nDatabases CS338  \n David Toman (University of Waterloo)  ER to Relational  1 / 39   \nRepresenting Strong Entity Sets  \nEntity set E with attributes a1 , . . . , an translates to table E with attributes a1 ,   , an  \nEntity of type E ↔ row in table E  \nPrimary key of entity set → primary key of table  \nExample:  \nStudent Major  \nStudentNum StudentName  \nStudent  \n\n|  StudentNum  | StudentName | Major |\n| --- | --- | --- |\n\n David Toman (University of Waterloo)  ER to Relational  4 / 39   \nE-R Diagram to Relational Schema  \nMain ideas:  \n Each entity set maps to a new table  \n Each attribute maps to a new table column  \n Each relationship set maps to either new table columns or to anew table  \n David Toman (University of Waterloo)  ER to Relational  3 / 39   \nRepresenting Weak Entity Sets  \nWeak entity set E translates to table E  \nColumns of table E should include  \n Attributes of the weak entity set  \n Attributes of the identifying relationship set  \n Primary key attributes of entity set for dominating entities  \nPrimary key of weak entity set → primary key of table  \n David Toman (University of Waterloo)  ER to Relational  5 / 39   \nRepresenting Weak Entity Sets (cont.)  \nExample:  \nAccount  \n\n|  AccNum | Balance |\n| --- | --- |\n\nTransaction  \n\n| TransNum | AccNum | Date | Amount |\n| --- | --- | --- | --- |\n\n David Toman (University of Waterloo)  ER to Relational  6 / 39   \nRepresenting Relationship Sets (cont.)  \n Columns of table R should include  \n Attributes of the relationship set  \n Primary key attributes of each component entity set  \n Primary key of table R determined as follows  \n If we can deduce the general cardinality constraint (0,1) for a component entity set E , then take the primary key attributes for E  \n Otherwise, choose primary key attributes of each component entity  \n David Toman (University of Waterloo)  ER to Relational  8 / 39   \nRepresenting Relationship Sets  \n If the relationship set is an identifying relationship set for a weak entity set then no action needed  \n If we can deduce the general cardinality constraint (1,1) for a component entity set E then add following columns to table E  \n Attributes of the relationship set  \n Primary key attributes of remaining component entity sets  \n Otherwise: relationship set R → table R  \n David Toman (University of Waterloo)  ER to Relational  7 / 39   \nRepresenting Relationship Sets (cont.)  \nExample:  \nTeam  \nTeamName  \nMatch  \nLocation  \n\n|  LocName | Address |\n| --- | --- |\n\n\n| HomeTeamName | VisitorTeamName | LocName | Score |\n| --- | --- | --- | --- |\n\nNote that the role name of a component entity set should be prepended to its primary key attributes, if supplied.  \n David Toman (University of Waterloo)  ER to Relational  9 / 39   \nRepresenting Generalization (Approach \\#1)  \nExample:  \nMakeAndModel  \nLicenceNum Vehicle Price  \nCOVERS  \nTonnage Truck Car MaxSpeed  \nAxelCount PassengerCount  \nTruck  \n\n| LicenceNum | MakeAndModel | Price | Tonnage | AxelCount |\n| --- | --- | --- | --- | --- |\n\nCar  \n\n| LicenceNum | MakeAndModel | Price | MaxSpeed | PassengerCount |\n| --- | --- | --- | --- | --- |\n\n David Toman (University of Waterloo)  ER to Relational  14 / 39   \nExample Translation: ER Diagram  \nCourseNum  \nTerm  \nTaughtBy  \nProfessor  \nCourse  \n(0, N)  \nSectionOf  \n(1, 1)   \nSection  \nCourseName  \nSectionNum  \n(6, 50)  \nEnrolledIn  \nStudent  \nMark  \nGPA  \nProfName  \nProfNum  \nLocation  \nStudentNum  \nStudentName  \nDavid Toman (University of Waterloo)  ER to Relational  16 / 39   \nRepresenting Generalization (Approach \\#2)  \nTreat generalization the same as specialization.  \nExample:  \nMakeAndModel  \nLicenceNum Vehicle Price  \nCOVERS  \nTonnage Truck Car MaxSpeed  \nAxelCount PassengerCount  \nVehicle  \nLicenceNum  MakeAndModel Price  \nTruck  \nLicenceNum  Tonnage AxelCount  \nCar  \n\n| LicenceNum | MaxSpeed | PassengerCount |","cbCaio031gEeTxPM","https://ap.wps.com/l/cbCaio031gEeTxPM","pdf",331798,"English","# Representing Strong Entity Sets\n# E-R Diagram to Relational Schema\n# Representing Weak Entity Sets\n## Representing Weak Entity Sets (cont.)\n# Representing Relationship Sets\n## Representing Relationship Sets (cont.)\n# Representing Relationship Sets (cont.) - Example\n# Representing Generalization (Approach #1)\n# Representing Generalization (Approach #2)\n# Defining Relations and Integrity Constraints in SQL\n## Tebles with a Primary Key\n## Foreign Key","[{\"question\":\"How does an entity set in ER translate to a relational table?\",\"answer\":\"An entity set E translates to a table E, and each attribute of E becomes a column. The primary key of the entity set becomes the primary key of the table.\"},{\"question\":\"What special rules apply to weak entity sets when mapping to relational tables?\",\"answer\":\"A weak entity set E translates to table E. The table must include the weak entity attributes, the attributes of the identifying relationship, and the primary key attributes of the dominating entities; these keys together determine the table’s primary key.\"},{\"question\":\"How are relationship sets mapped in the relational model?\",\"answer\":\"An identifying relationship set for a weak entity typically requires no separate action. If the relationship’s general cardinality is (1,1) for a component entity set, relevant relationship attributes and remaining component primary key attributes are added to that entity’s table; otherwise the relationship maps to a separate table R.\"}]","Translating Entity-Relationship to Relational Tables - Fall 2026 - David Toman | PDF",1792966526,23]