{"id":37667791,"url":"https://github.com/albertov5/tec-data-07-sql","last_synced_at":"2026-01-16T12:00:41.606Z","repository":{"id":55583106,"uuid":"523142208","full_name":"AlbertoV5/tec-data-07-sql","owner":"AlbertoV5","description":"Data Analytics Bootcamp","archived":false,"fork":false,"pushed_at":"2022-08-16T01:19:32.000Z","size":17038,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-03-04T18:11:46.169Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlbertoV5.png","metadata":{"files":{"readme":"readme.html","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-09T23:54:19.000Z","updated_at":"2022-08-16T01:15:16.000Z","dependencies_parsed_at":"2022-08-15T03:40:19.147Z","dependency_job_id":null,"html_url":"https://github.com/AlbertoV5/tec-data-07-sql","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/AlbertoV5/tec-data-07-sql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbertoV5%2Ftec-data-07-sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbertoV5%2Ftec-data-07-sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbertoV5%2Ftec-data-07-sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbertoV5%2Ftec-data-07-sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlbertoV5","download_url":"https://codeload.github.com/AlbertoV5/tec-data-07-sql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbertoV5%2Ftec-data-07-sql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-16T12:00:23.325Z","updated_at":"2026-01-16T12:00:41.566Z","avatar_url":"https://github.com/AlbertoV5.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003c!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"\u003e\n\u003chtml xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\"\u003e\n\u003chead\u003e\n\u003c!-- 2022-08-15 Mon 20:13 --\u003e\n\u003cmeta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /\u003e\n\u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /\u003e\n\u003ctitle\u003eChallenge\u003c/title\u003e\n\u003cmeta name=\"author\" content=\"Alberto Valdez\" /\u003e\n\u003cmeta name=\"generator\" content=\"Org Mode\" /\u003e\n\u003clink rel=\"stylesheet\" type=\"text/css\" href=\"https://albertov5.github.io/org-html-themes/src/readtheorg_theme/css/htmlize.css\"/\u003e\n\u003clink rel=\"stylesheet\" type=\"text/css\" href=\"https://albertov5.github.io/org-html-themes/src/readtheorg_theme/css/readtheorg.css\"/\u003e\n\u003cscript src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"https://albertov5.github.io/org-html-themes/src/lib/js/jquery.stickytableheaders.min.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"https://albertov5.github.io/org-html-themes/src/readtheorg_theme/js/readtheorg.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\u003cdiv id=\"content\" class=\"content\"\u003e\n\u003ch1 class=\"title\"\u003eChallenge\u003c/h1\u003e\n\u003cdiv id=\"table-of-contents\" role=\"doc-toc\"\u003e\n\u003ch2\u003eTable of Contents\u003c/h2\u003e\n\u003cdiv id=\"text-table-of-contents\" role=\"doc-toc\"\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"#orgf945cb1\"\u003eRetirement Analysis of Pewlett Hackard\u003c/a\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"#orgc48fcc4\"\u003eOverview\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#orgcaa2f01\"\u003eResults\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#orgb1270d7\"\u003eSummary\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#org68454dd\"\u003eClosing Thoughts\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\u003cdiv id=\"outline-container-orgf945cb1\" class=\"outline-2\"\u003e\n\u003ch2 id=\"orgf945cb1\"\u003eRetirement Analysis of Pewlett Hackard\u003c/h2\u003e\n\u003cdiv class=\"outline-text-2\" id=\"text-orgf945cb1\"\u003e\n\u003c/div\u003e\n\u003cdiv id=\"outline-container-orgc48fcc4\" class=\"outline-3\"\u003e\n\u003ch3 id=\"orgc48fcc4\"\u003eOverview\u003c/h3\u003e\n\u003cdiv class=\"outline-text-3\" id=\"text-orgc48fcc4\"\u003e\n\u003cp\u003e\nIn this analysis we made a series of queries to our database to obtain key information about the employees that are soon to retire from Pewlett Hackard.\n\u003c/p\u003e\n\n\u003cp\u003e\nOur database contains a few tables with many relations to the employee id. This is our database diagram:\n\u003c/p\u003e\n\n\n\u003cdiv id=\"orgf65b8ab\" class=\"figure\"\u003e\n\u003cp\u003e\u003cimg src=\"./EmployeeDB.png\" alt=\"EmployeeDB.png\" width=\"400px\" /\u003e\n\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\u003cdiv id=\"outline-container-orgcaa2f01\" class=\"outline-3\"\u003e\n\u003ch3 id=\"orgcaa2f01\"\u003eResults\u003c/h3\u003e\n\u003cdiv class=\"outline-text-3\" id=\"text-orgcaa2f01\"\u003e\n\u003cp\u003e\n1.- All current employees that are nearing retirement, which means all those who were born between 1962 and 1965 and are currently employeed in the company.\n\u003c/p\u003e\n\u003cdiv class=\"org-src-container\"\u003e\n\u003cpre class=\"src src-sql\"\u003e\u003cspan style=\"color: #339CDB;\"\u003eSELECT\u003c/span\u003e * \u003cspan style=\"color: #339CDB;\"\u003eFROM\u003c/span\u003e retirement_titles\n\u003cspan style=\"color: #339CDB;\"\u003eLIMIT\u003c/span\u003e \u003cspan style=\"color: #B5CEA8; font-weight: bold;\"\u003e3\u003c/span\u003e;\n\u003c/pre\u003e\n\u003c/div\u003e\n\n\u003ctable\u003e\u003ctr\u003e\u003cth\u003eemp_no\u003c/th\u003e\u003cth\u003efirst_name\u003c/th\u003e\u003cth\u003elast_name\u003c/th\u003e\u003cth\u003etitle\u003c/th\u003e\u003cth\u003efrom_date\u003c/th\u003e\u003cth\u003eto_date\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e10001\u003c/td\u003e\u003ctd\u003eGeorgi\u003c/td\u003e\u003ctd\u003eFacello\u003c/td\u003e\u003ctd\u003eSenior Engineer\u003c/td\u003e\u003ctd\u003e1986-06-26\u003c/td\u003e\u003ctd\u003e9999-01-01\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e10004\u003c/td\u003e\u003ctd\u003eChirstian\u003c/td\u003e\u003ctd\u003eKoblick\u003c/td\u003e\u003ctd\u003eEngineer\u003c/td\u003e\u003ctd\u003e1986-12-01\u003c/td\u003e\u003ctd\u003e1995-12-01\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e10004\u003c/td\u003e\u003ctd\u003eChirstian\u003c/td\u003e\u003ctd\u003eKoblick\u003c/td\u003e\u003ctd\u003eSenior Engineer\u003c/td\u003e\u003ctd\u003e1995-12-01\u003c/td\u003e\u003ctd\u003e9999-01-01\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003cp\u003e\n2.- We filtered the previous result to make sure that we only get the latest title of each employee that is nearing retirement, that means that it is their current title.\n\u003c/p\u003e\n\u003cdiv class=\"org-src-container\"\u003e\n\u003cpre class=\"src src-sql\"\u003e\u003cspan style=\"color: #339CDB;\"\u003eSELECT\u003c/span\u003e * \u003cspan style=\"color: #339CDB;\"\u003eFROM\u003c/span\u003e unique_titles\n\u003cspan style=\"color: #339CDB;\"\u003eLIMIT\u003c/span\u003e \u003cspan style=\"color: #B5CEA8; font-weight: bold;\"\u003e3\u003c/span\u003e;\n\u003c/pre\u003e\n\u003c/div\u003e\n\n\u003ctable\u003e\u003ctr\u003e\u003cth\u003eemp_no\u003c/th\u003e\u003cth\u003efirst_name\u003c/th\u003e\u003cth\u003elast_name\u003c/th\u003e\u003cth\u003etitle\u003c/th\u003e\u003cth\u003efrom_date\u003c/th\u003e\u003cth\u003eto_date\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e10001\u003c/td\u003e\u003ctd\u003eGeorgi\u003c/td\u003e\u003ctd\u003eFacello\u003c/td\u003e\u003ctd\u003eSenior Engineer\u003c/td\u003e\u003ctd\u003e1986-06-26\u003c/td\u003e\u003ctd\u003e9999-01-01\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e10004\u003c/td\u003e\u003ctd\u003eChirstian\u003c/td\u003e\u003ctd\u003eKoblick\u003c/td\u003e\u003ctd\u003eSenior Engineer\u003c/td\u003e\u003ctd\u003e1995-12-01\u003c/td\u003e\u003ctd\u003e9999-01-01\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e10005\u003c/td\u003e\u003ctd\u003eKyoichi\u003c/td\u003e\u003ctd\u003eMaliniak\u003c/td\u003e\u003ctd\u003eSenior Staff\u003c/td\u003e\u003ctd\u003e1996-09-12\u003c/td\u003e\u003ctd\u003e9999-01-01\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003cp\u003e\n3.- We can then count how many employees per title are retiring.\n\u003c/p\u003e\n\u003cdiv class=\"org-src-container\"\u003e\n\u003cpre class=\"src src-sql\"\u003e\u003cspan style=\"color: #339CDB;\"\u003eSELECT\u003c/span\u003e * \u003cspan style=\"color: #339CDB;\"\u003eFROM\u003c/span\u003e retiring_titles\n\u003cspan style=\"color: #339CDB;\"\u003eLIMIT\u003c/span\u003e \u003cspan style=\"color: #B5CEA8; font-weight: bold;\"\u003e3\u003c/span\u003e;\n\u003c/pre\u003e\n\u003c/div\u003e\n\n\u003ctable\u003e\u003ctr\u003e\u003cth\u003etitle\u003c/th\u003e\u003cth\u003eEmployee Count\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003eSenior Engineer\u003c/td\u003e\u003ctd\u003e25916\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003eSenior Staff\u003c/td\u003e\u003ctd\u003e24926\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003eEngineer\u003c/td\u003e\u003ctd\u003e9285\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003cp\u003e\n4.- Finally, we will look for all current employees that can qualify for the mentorship program, which means that is all those born in 1965.\n\u003c/p\u003e\n\n\u003cdiv class=\"org-src-container\"\u003e\n\u003cpre class=\"src src-sql\"\u003e\u003cspan style=\"color: #339CDB;\"\u003eSELECT\u003c/span\u003e * \u003cspan style=\"color: #339CDB;\"\u003eFROM\u003c/span\u003e mentorship_eligibilty\n\u003cspan style=\"color: #339CDB;\"\u003eLIMIT\u003c/span\u003e \u003cspan style=\"color: #B5CEA8; font-weight: bold;\"\u003e3\u003c/span\u003e;\n\u003c/pre\u003e\n\u003c/div\u003e\n\n\u003ctable\u003e\u003ctr\u003e\u003cth\u003eemp_no\u003c/th\u003e\u003cth\u003efirst_name\u003c/th\u003e\u003cth\u003elast_name\u003c/th\u003e\u003cth\u003ebirth_date\u003c/th\u003e\u003cth\u003efrom_date\u003c/th\u003e\u003cth\u003eto_date\u003c/th\u003e\u003cth\u003etitle\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e10095\u003c/td\u003e\u003ctd\u003eHilari\u003c/td\u003e\u003ctd\u003eMorton\u003c/td\u003e\u003ctd\u003e1965-01-03\u003c/td\u003e\u003ctd\u003e1994-03-10\u003c/td\u003e\u003ctd\u003e9999-01-01\u003c/td\u003e\u003ctd\u003eSenior Staff\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e10122\u003c/td\u003e\u003ctd\u003eOhad\u003c/td\u003e\u003ctd\u003eEsposito\u003c/td\u003e\u003ctd\u003e1965-01-19\u003c/td\u003e\u003ctd\u003e1998-08-06\u003c/td\u003e\u003ctd\u003e9999-01-01\u003c/td\u003e\u003ctd\u003eTechnique Leader\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e10291\u003c/td\u003e\u003ctd\u003eDipayan\u003c/td\u003e\u003ctd\u003eSeghrouchni\u003c/td\u003e\u003ctd\u003e1965-01-23\u003c/td\u003e\u003ctd\u003e1987-03-30\u003c/td\u003e\u003ctd\u003e9999-01-01\u003c/td\u003e\u003ctd\u003eSenior Staff\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\n\u003cdiv id=\"outline-container-orgb1270d7\" class=\"outline-3\"\u003e\n\u003ch3 id=\"orgb1270d7\"\u003eSummary\u003c/h3\u003e\n\u003cdiv class=\"outline-text-3\" id=\"text-orgb1270d7\"\u003e\n\u003cp\u003e\nWe can count the number of employees that are leaving the company by summing the rows in our \u003ccode\u003eretiring_titles\u003c/code\u003e table.\n\u003c/p\u003e\n\n\u003cdiv class=\"org-src-container\"\u003e\n\u003cpre class=\"src src-sql\"\u003e\u003cspan style=\"color: #339CDB;\"\u003eSELECT\u003c/span\u003e \u003cspan style=\"color: #C586C0;\"\u003eSUM\u003c/span\u003e(\"Employee \u003cspan style=\"color: #C586C0;\"\u003eCount\u003c/span\u003e\")\n\u003cspan style=\"color: #339CDB;\"\u003eFROM\u003c/span\u003e retiring_titles;\n\u003c/pre\u003e\n\u003c/div\u003e\n\n\u003ctable\u003e\u003ctr\u003e\u003cth\u003esum\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e72458\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003cp\u003e\nThat means we will need to fill 72,458 positions in the company once those employees retire.\n\u003c/p\u003e\n\n\u003cp\u003e\nWe want to check if there are enough employees that qualify for the mentorship program. So we can get the sum from our other table.\n\u003c/p\u003e\n\u003cdiv class=\"org-src-container\"\u003e\n\u003cpre class=\"src src-sql\"\u003e\u003cspan style=\"color: #339CDB;\"\u003eSELECT\u003c/span\u003e \u003cspan style=\"color: #C586C0;\"\u003eCOUNT\u003c/span\u003e(emp_no)\n\u003cspan style=\"color: #339CDB;\"\u003eFROM\u003c/span\u003e mentorship_eligibilty;\n\u003c/pre\u003e\n\u003c/div\u003e\n\n\u003ctable\u003e\u003ctr\u003e\u003cth\u003ecount\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e1549\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003cp\u003e\nThere are only 1,549 employees in the mentorship program. Which seems like a low number of employees, so we may need to invest further in training of the next generation of Pewlett Hackard employees once the 52-55 generation retires.\n\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\u003cdiv id=\"outline-container-org68454dd\" class=\"outline-3\"\u003e\n\u003ch3 id=\"org68454dd\"\u003eClosing Thoughts\u003c/h3\u003e\n\u003cdiv class=\"outline-text-3\" id=\"text-org68454dd\"\u003e\n\u003cp\u003e\nSQL queries are a very powerful way to get information of the data in our database without needing big transformations or processing. The most powerful feature is probably the relations between the different tables, as you can construct fairly complex and powerful queries to fetch any arrangement of data you want.\n\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"postamble\" class=\"status\"\u003e\n\u003cp class=\"author\"\u003eAuthor: Alberto Valdez\u003c/p\u003e\n\u003cp class=\"date\"\u003eCreated: 2022-08-15 Mon 20:13\u003c/p\u003e\n\u003c/div\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertov5%2Ftec-data-07-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbertov5%2Ftec-data-07-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertov5%2Ftec-data-07-sql/lists"}