

{"id":232,"date":"2024-02-16T13:43:29","date_gmt":"2024-02-16T18:43:29","guid":{"rendered":"https:\/\/sites.temple.edu\/souravdas\/?p=232"},"modified":"2024-02-16T13:43:30","modified_gmt":"2024-02-16T18:43:30","slug":"lab-4-few-hints","status":"publish","type":"post","link":"https:\/\/sites.temple.edu\/souravdas\/2024\/02\/16\/lab-4-few-hints\/","title":{"rendered":"Lab 4: Few Hints"},"content":{"rendered":"\n<p><strong>Overview of Foreign Key<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table aligncenter\"><table><thead><tr><th>StudentID<\/th><th>Name<\/th><th>Age<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>John<\/td><td>20<\/td><\/tr><tr><td>2<\/td><td>Sarah<\/td><td>22<\/td><\/tr><tr><td>3<\/td><td>Michael<\/td><td>21<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\"><br><br>Students<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-table aligncenter\"><table><thead><tr><th>CourseID<\/th><th>CourseName<\/th><th>StudentID<\/th><\/tr><\/thead><tbody><tr><td>101<\/td><td>Math<\/td><td>1<\/td><\/tr><tr><td>102<\/td><td>Physics<\/td><td>2<\/td><\/tr><tr><td>103<\/td><td>Chemistry<\/td><td>1<\/td><\/tr><tr><td>104<\/td><td>Biology<\/td><td>3<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\"><br><br>Courses<\/figcaption><\/figure>\n\n\n\n<p>In this example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In the &#8220;Students&#8221; table, &#8220;StudentID&#8221; is the primary key.<\/li>\n\n\n\n<li>In the &#8220;Courses&#8221; table, &#8220;CourseID&#8221; is the primary key, and &#8220;StudentID&#8221; is a foreign key referencing the &#8220;StudentID&#8221; column in the &#8220;Students&#8221; table.<\/li>\n<\/ul>\n\n\n\n<p class=\"has-large-font-size\">This relationship indicates that a student can enroll in multiple courses, but each course is associated with only one student.<\/p>\n\n\n\n<p><strong><span style=\"text-decoration: underline\">Hints<\/span><\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>CREATE TABLE Employee_Statistics ( Add all the columns here, also create the FK constraint);<\/li>\n\n\n\n<li>Use LEFT JOIN<\/li>\n\n\n\n<li>INSERT INTO Employee_Statistics (names of columns) <br>SELECT column names <br>FROM Table1 <br>LEFT JOIN <br>Table2 ON &#8230;.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Overview of Foreign Key StudentID Name Age 1 John 20 2 Sarah 22 3 Michael 21 Students CourseID CourseName StudentID 101 Math 1 102 Physics&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/sites.temple.edu\/souravdas\/2024\/02\/16\/lab-4-few-hints\/\">Continue reading<span class=\"screen-reader-text\">Lab 4: Few Hints<\/span><\/a><\/div>\n","protected":false},"author":35813,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-232","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"acf":[],"_links":{"self":[{"href":"https:\/\/sites.temple.edu\/souravdas\/wp-json\/wp\/v2\/posts\/232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.temple.edu\/souravdas\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.temple.edu\/souravdas\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.temple.edu\/souravdas\/wp-json\/wp\/v2\/users\/35813"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.temple.edu\/souravdas\/wp-json\/wp\/v2\/comments?post=232"}],"version-history":[{"count":1,"href":"https:\/\/sites.temple.edu\/souravdas\/wp-json\/wp\/v2\/posts\/232\/revisions"}],"predecessor-version":[{"id":233,"href":"https:\/\/sites.temple.edu\/souravdas\/wp-json\/wp\/v2\/posts\/232\/revisions\/233"}],"wp:attachment":[{"href":"https:\/\/sites.temple.edu\/souravdas\/wp-json\/wp\/v2\/media?parent=232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.temple.edu\/souravdas\/wp-json\/wp\/v2\/categories?post=232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.temple.edu\/souravdas\/wp-json\/wp\/v2\/tags?post=232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}