[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-656120-105":3,"detail-sidebar-cat-0-en-105":81,"doc-detail-656120-en":130,"doc-similar-656120":162},{"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","cscb20-worksheet-database-schema-and-relational-algebra-exercises","CSCB20 Worksheet - Database Schema and Relational Algebra Exercises","","Worksheet providing practice on database schema diagrams and relational algebra query expressions. It introduces relations, primary keys, and the process of drawing foreign key constraints, then summarizes core relational algebra operators including selection, projection, natural join, Cartesian product, union, and example symbolism. The exercises ask for results of composed relational algebra expressions over given university, employee, branch, customer, loan, and account schemas, including identifying primary/foreign keys and writing queries that filter by city, salary, company, and branch attributes.",{"@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/exam/","Exam",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/cscb20-worksheet-database-schema-and-relational-algebra-exercises/656120/",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/cscb20-worksheet-database-schema-and-relational-algebra-exercises/656120.png","ImageObject",300,407,{"name":42,"@type":43},"Patrick","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-25","2026-10-25",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",7,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"How do you determine primary keys in the given database schemas?","Question",{"text":63,"@type":64},"The worksheet states that primary keys should be underlined (bold in the example solution) and that interpretation may be required, encouraging agreement among students.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"What does the selection and projection operator do in relational algebra?",{"text":68,"@type":64},"Selection returns rows that satisfy a predicate, while projection outputs specified attributes and removes duplicate tuples from the result.",{"name":70,"@type":61,"acceptedAnswer":71},"How can you form queries to find employees living in Miami with salary above a threshold?",{"text":72,"@type":64},"Use selection on the employee and works relations, then combine conditions (city='Miami' and salary>100000) and project the required attributes, as shown in the worksheet’s relational algebra expressions.","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},656120,1793091238,{"code":4,"msg":82,"data":83},"success",[84,88,92,95,100,105,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":29,"show_sort_weight":93,"slug":94},70,"exam",{"id":96,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},5,"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":102,"show_sort_weight":103,"slug":104},6,"Technology",50,"technology",{"id":55,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},"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":96,"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":33,"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":96,"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,"preview_page_count":33,"preview_urls":145},549758146520,"https://ap-avatar.wpscdn.com/avatar/80002397d8c0411e94?_k=1775819394049821470","CSCB20 Worksheet { database schema and relational algebra 1  \n1 Database Schema Diagrams  \nWe will use the university sample relational schema de􀀌ned in lectures. The following schema diagram illustrates all the relations in the database. Each relation has primary keys underlined. Draw arrows to show all foreign key constraints.  \n2 Relational Algebra  \nWe use relational algebra to specify queries on a database. This is the formal mathematical notational. Later we will see how this translates into SQL.  \nSummary of Relational Algebra  \n1 Diagrams and examples taken from Database System Concepts 6th Edition  \n\n| Symbol (Name) | Example of Use |\n| --- | --- |\n| ! | !salary>=85000 (instructor) |\n| (Selection) | Return rows of the input relation that satisfy the predicate. |\n| ! | !ID , salary (instructor) |\n| (Projection) | Output speciﬁed attributes from all rows of the input relation. Remove duplicate tuples from the output. |\n| ✶ | instructor ✶ department |\n| (Natural join) | Output pairs of rows from the two input relations that have the same value on all attributes that have the same name. |\n| × | instructor × department |\n| (Cartesian product) | Output all pairs of rows from the two input relations (regardless of whether or not they have the same values on common attributes) |\n| ∪ | !name (instructor) ∪ !name (student) |\n| (Union) | Output the union of tuples from the two input relations. |\n\n2.1 Lets practice...  \nThe university schema and relations are at the end of this handout.  \n1. What is the result of 􀀛 s  id=ID (student 􀀂 advisor)?  \n2. Explain what each of the following expressions do:  \n(a) 􀀛 year􀀕2009(takes) on student  \n(b) 􀀛 year􀀕2009(takes on student)  \n(c) 􀀅 ID, name, course  id(student on takes)  \n3. Suppose we have the following relational database:  \nemployee (person name, street, city)  \nworks(person name, company name, salary)  \ncompany (company name, city)  \n(a) Find the names of all employees who live in city `Miami'.  \n􀀅 person  name (􀀛 city='Miami'(employee))  \n(b) Find the names of all employees whose salary is greater than $100,000 .  \n􀀅 person  name (􀀛 salary>100000(works))  \n(c) Find the names of all employees who live in `Miami' and whose salary is greater than $100,000 .  \n􀀅 person  name (􀀛 city='Miami'^salary>100000(employee on works))  \n(d) Find the names of all employees who work for \\First Bank Corporation\".  \n􀀅 person  name (􀀛 company  name=`First Bank Corporation'(works))  \n(e) Find the names and cities of residence of all employees who work for \\First Bank Corporation\".  \n􀀅 person  name;city (􀀛 company  name=`First Bank Corporation'(works on employee))  \n(f) Find the names, street address, and cities of residence of all employees who work for \\First Bank Corporation\" and earn more than $10,000 .  \n􀀅 person  name;street;city (􀀛 company  name=`First Bank Corporation'^salary>10000(employee on works))  \n4. Suppose we have the following relational database:  \nbranch(branch name, branch   city, assets)  \ncustomer(customer name, customer street, custromer city)  \nloan(loan number, branch name, amount)  \nborrower(customer name, loan number)  \naccount(account number, branch name, balance)  \ndepositor(custromer name, account number)  \n(a) Underline appropriate primary keys.  \nPrimary keys are bold font. Note that some of this is up to interpretation of the database  \n-feel free to discuss and come to some agreement. A sample solution might be:  \nbranch(branch name, branch   city, assets)  \ncustomer(customer name, customer street, customer city) ** customer names may not be unique**  \nloan(loan number, branch name, amount) ** assume that loan numbers are across all branches  \nborrower(customer name, loan number)  \naccount(account number, branch name, balance)  \ndepositor(customer name, account number)  \n(b) Given your choice of primary keys, identify appropriate foreign keys. Draw a relation diagram to indicate foreign keys.  \ntry having the students draw a box for each schema and then draw the rela","cbCaioWFuqFCURl2","https://ap.wps.com/l/cbCaioWFuqFCURl2","pdf",615749,"English","# Database Schema Diagrams\n## Relational Algebra Summary\n# Lets practice\n## Exercises on Given University Schema\n## Exercises on Employee/Works/Company Schema\n## Exercises on Branch/Customer/Loan Schema\n## University Relations and Schemas","[{\"question\":\"How do you determine primary keys in the given database schemas?\",\"answer\":\"The worksheet states that primary keys should be underlined (bold in the example solution) and that interpretation may be required, encouraging agreement among students.\"},{\"question\":\"What does the selection and projection operator do in relational algebra?\",\"answer\":\"Selection returns rows that satisfy a predicate, while projection outputs specified attributes and removes duplicate tuples from the result.\"},{\"question\":\"How can you form queries to find employees living in Miami with salary above a threshold?\",\"answer\":\"Use selection on the employee and works relations, then combine conditions (city='Miami' and salary\\u003e100000) and project the required attributes, as shown in the worksheet’s relational algebra expressions.\"}]","CSCB20 Worksheet - Database Schema and Relational Algebra Exercises | PDF",1792966480,13,[146,150,154,158],{"page_no":22,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/4c9e7b19bd5e25d4f35699dc8af4924d.webp",983,1272,{"page_no":26,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/d6d3cdd24839db5954ec6eb6f3886f70.webp",982,1270,{"page_no":30,"url":155,"width":156,"height":157},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/a207814f7a0707d02a8ac5c489a6005b.webp",981,1269,{"page_no":33,"url":159,"width":160,"height":161},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/e90768da8c7b76bf2e54a45737e5cb6f.webp",980,1268,{"list":163,"token":11},[164,171,178,184,191,197,203,209,215,222],{"doc_id":165,"doc_title":166,"file_type":137,"home_preview_img_url":167,"slug":168,"view_count":169,"category_name":29,"create_tm":170},391746,"SQL TOP50 - Important Interview Questions & Answers","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917704632/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796201339&Signature=aHQQjKfE1ZpqrxHOy6dY0pRl5zU%3D","sql-top50-important-interview-questions-answers",15,1790358325,{"doc_id":172,"doc_title":173,"file_type":137,"home_preview_img_url":174,"slug":175,"view_count":176,"category_name":29,"create_tm":177},656144,"Databases Exam - 22 March 2019 - Exam Instructions and Questions","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229975301640/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796201339&Signature=P4Z4zF4cKQ9FD9op78KMPwFjihY%3D","databases-exam-22-march-2019-exam-instructions-and-questions",17,1792966704,{"doc_id":179,"doc_title":180,"file_type":137,"home_preview_img_url":181,"slug":182,"view_count":115,"category_name":29,"create_tm":183},497965,"Test of Basic Knowledge of SQL - SQL practice test questions and answer key","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229930310506/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796201339&Signature=eQAWBsZ9e6IA1DFmu1jcU2Aqmak%3D","test-of-basic-knowledge-of-sql-sql-practice-test-questions-and-answer-key",1790972537,{"doc_id":185,"doc_title":186,"file_type":137,"home_preview_img_url":187,"slug":188,"view_count":189,"category_name":29,"create_tm":190},151076,"Computer science Higher level Paper 2 - Databases and application questions - Exam instructions","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229869770740/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796201339&Signature=dcPJ%2BOjuwnz%2FSPjGJ0v3rxO%2B3Uw%3D","computer-science-higher-level-paper-2-databases-and-application-questions-exam-instructions",16,1787832388,{"doc_id":192,"doc_title":193,"file_type":137,"home_preview_img_url":194,"slug":195,"view_count":22,"category_name":29,"create_tm":196},763504,"sample SQL questions with answers","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230047479583/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796201339&Signature=xELM4cGAbCWKvOEFOmRtpEoLeDg%3D","sample-sql-questions-with-answers",1796034068,{"doc_id":198,"doc_title":199,"file_type":137,"home_preview_img_url":200,"slug":201,"view_count":115,"category_name":29,"create_tm":202},656087,"ER Model Notes - Database Design Concepts","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229975299846/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796201339&Signature=2aR0NYVVNPJPd6t3Id8A8Kd04C4%3D","er-model-notes-database-design-concepts",1792966230,{"doc_id":204,"doc_title":205,"file_type":137,"home_preview_img_url":206,"slug":207,"view_count":22,"category_name":29,"create_tm":208},763506,"10.4 SQL","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230047154836/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796201339&Signature=LiJYkQDTYOc9hEeC3yQYy1hRYCs%3D","104-sql",1796034070,{"doc_id":210,"doc_title":211,"file_type":137,"home_preview_img_url":212,"slug":213,"view_count":115,"category_name":29,"create_tm":214},656091,"ER Models - Database Design with Entity Relationship Models - CS460 Databases for Data Scientists","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229975299870/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796201339&Signature=Yy51W514qglU0qG6PGoKLDVOE4I%3D","er-models-database-design-with-entity-relationship-models-cs460-databases-for-data-scientists",1792966238,{"doc_id":216,"doc_title":217,"file_type":137,"home_preview_img_url":218,"slug":219,"view_count":220,"category_name":29,"create_tm":221},678108,"DATABASE MANAGEMENT SYSTEM - LECTURE NOTES - UNIT 1 INTRODUCTION TO DATABASE MANAGEMENT SYSTEM AND ENTITY RELATIONSHIP MODEL","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229994799943/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796201339&Signature=yVPQ6QjiiTCSO7zOtHZCnCxsbVU%3D","database-management-system-lecture-notes-unit-1-introduction-to-database-management-system-and-entity-relationship-model",12,1793784450,{"doc_id":223,"doc_title":224,"file_type":137,"home_preview_img_url":225,"slug":226,"view_count":101,"category_name":29,"create_tm":227},646217,"MySQL® for Beginners - SQL-4401 Rev 2.1","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229971804199/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796201339&Signature=mfWtezodqDeB%2FAuJ2ybHFsGBwJA%3D","mysql-for-beginners-sql-4401-rev-21",1792753729]