{"id":3266,"date":"2023-10-24T10:26:42","date_gmt":"2023-10-24T02:26:42","guid":{"rendered":"https:\/\/white-night.club\/?p=3266"},"modified":"2023-11-09T11:07:46","modified_gmt":"2023-11-09T03:07:46","slug":"ad90","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/24\/ad90\/","title":{"rendered":"1075.\u00a0\u9879\u76ee\u5458\u5de5 I"},"content":{"rendered":"\n<p>\u9879\u76ee\u8868&nbsp;<code>Project<\/code>\uff1a&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+---------+\n| Column Name | Type    |\n+-------------+---------+\n| project_id  | int     |\n| employee_id | int     |\n+-------------+---------+\n\u4e3b\u952e\u4e3a (project_id, employee_id)\u3002\nemployee_id \u662f\u5458\u5de5\u8868 <code>Employee \u8868\u7684\u5916\u952e\u3002<\/code>\n<\/pre>\n\n\n\n<p>\u5458\u5de5\u8868&nbsp;<code>Employee<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+------------------+---------+\n| Column Name      | Type    |\n+------------------+---------+\n| employee_id      | int     |\n| name             | varchar |\n| experience_years | int     |\n+------------------+---------+\n\u4e3b\u952e\u662f employee_id\u3002\n<\/pre>\n\n\n\n<p>\u8bf7\u5199\u4e00\u4e2a SQL&nbsp;\u8bed\u53e5\uff0c\u67e5\u8be2\u6bcf\u4e00\u4e2a\u9879\u76ee\u4e2d\u5458\u5de5\u7684&nbsp;<strong>\u5e73\u5747&nbsp;<\/strong>\u5de5\u4f5c\u5e74\u9650\uff0c<strong>\u7cbe\u786e\u5230\u5c0f\u6570\u70b9\u540e\u4e24\u4f4d<\/strong>\u3002<\/p>\n\n\n\n<p>\u67e5\u8be2\u7ed3\u679c\u7684\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Project \u8868\uff1a\n+-------------+-------------+\n| project_id  | employee_id |\n+-------------+-------------+\n| 1           | 1           |\n| 1           | 2           |\n| 1           | 3           |\n| 2           | 1           |\n| 2           | 4           |\n+-------------+-------------+\n\nEmployee \u8868\uff1a\n+-------------+--------+------------------+\n| employee_id | name   | experience_years |\n+-------------+--------+------------------+\n| 1           | Khaled | 3                |\n| 2           | Ali    | 2                |\n| 3           | John   | 1                |\n| 4           | Doe    | 2                |\n+-------------+--------+------------------+\n\nResult \u8868\uff1a\n+-------------+---------------+\n| project_id  | average_years |\n+-------------+---------------+\n| 1           | 2.00          |\n| 2           | 2.50          |\n+-------------+---------------+\n\u7b2c\u4e00\u4e2a\u9879\u76ee\u4e2d\uff0c\u5458\u5de5\u7684\u5e73\u5747\u5de5\u4f5c\u5e74\u9650\u662f (3 + 2 + 1) \/ 3 = 2.00\uff1b\u7b2c\u4e8c\u4e2a\u9879\u76ee\u4e2d\uff0c\u5458\u5de5\u7684\u5e73\u5747\u5de5\u4f5c\u5e74\u9650\u662f (3 + 2) \/ 2 = 2.50<\/pre>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u89e3\u9898\u601d\u8def<\/p>\n<cite><em>ROUND<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u7528ROUND\u5c31\u53ef\u4ee5\u4fdd\u75592\u4f4d\u5c0f\u6570\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Write your MySQL query statement below\r\nSELECT A.project_id,ROUND(AVG(B.experience_years),2) AS average_years\r\nFROM Project AS A\r\nLEFT JOIN Employee AS B \r\nON A.employee_id=B.employee_id\r\nGROUP BY A.project_id<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1aSQL&#8211;ROUND<\/p>\n","protected":false},"author":1,"featured_media":2827,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[42,25],"tags":[38],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3266"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=3266"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3266\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/2827"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=3266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=3266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=3266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}