[It was taught:] Three names are called for a person: one that his father and mother called him, one that he called himself, and one that is written in the book. Rabbi said: And we do not know which of them comes first—whether the one that he called himself, or the one that his father and mother called him. Solomon came and explained: "And the day of death than the day of one's birth" (Ecclesiastes 7:1). When a person is born, they count toward death; when he dies, they count for him toward life. When a person is born, all rejoice; when he dies, all weep. But it is not so. Rather, when a person is born, all ought to weep, because they do not know upon which station he stands; when he dies, all ought to rejoice, because they know that he departed in peace from the world. [A parable] of two ships that were setting out upon the sea: one entering the harbor, and one going out from the harbor. The one entering the harbor—all were not rejoicing over it; and the one going out from the harbor—all were rejoicing over it. A certain clever man was there. He said: I see matters in reverse. The one entering the harbor—all ought to rejoice over it, because they know that it has entered in peace from the sea; and the one going out from the harbor—all ought not to rejoice, because they do not know upon which station it stands. So too a person: when he is born, all rejoice; when he dies, all weep. But it is not so. Rather, when he is born all ought to weep, because they do not know upon which station he stands; when he dies all ought to rejoice, because they know that he departed in peace from the world. And when David was born, no creature took note of him; but once he died, all Israel took note of him. This is what is written: "And Hadad heard in Egypt that David slept with his fathers" etc. (1 Kings 11).
Why the Day of Death Outweighs the Day of Birth
Midrash Shmuel 23:6
[תני] שלשה שמות נקראו לאדם, אחד שקראו לו אביו ואמו, ואחד שקרא לעצמו, ואחד שכתב בספר, רבי אמר ואין אנן יודעין אי זה מהן יקדים, אם זה שקרא לעצמו, ואם זה שקרא לו אביו ואמו, בא שלמה ופירש ויום המות מיום הולדו (קהלת ז' א'), נולד אדם מונין למיתה, מת מונין לו לחיים, נולד אדם הכל שמחין, מת הכל בוכין, ואינה כן, אלא נולד אדם הכל צריכין לבכות, מפני שאינן יודעין על אי זה פרק הוא עומד, מת הכל צריכין לשמוח, מפני שהן יודעין שיצא בשלום מן העולם, [משל] לב' ספינות שהיו פורשות בים, אחת נכנסת ללמין, ואחת יוצאה מן (הלמים) [הלמין], זו שנכנסת ללמין לא היו הכל שמחין בה, וזו שהיא יוצאה מן הלמין היו הכל שמחין בה, פקח אחד היה שם, אמר חילופי דברים אני רואה, זו שנכנסת ללמין היו הכל צריכין לשמוח, מפני שהן יודעין שנכנס בשלום מן הים, וזו שהיא יוצאה מן הלמין לא היו צריכין הכל לשמוח, מפני שאינן יודעין על איזה פרק היא עומדת, כך אדם נולד הכל שמחין, מת הכל בוכין, ואינה כן, אלא נולד הכל צריכין לבכות, מפני שאינן יודעין על איזה פרק הוא עומד, מת הכל צריכין לשמוח, מפני שהן יודעין שיצא בשלום מן העולם, וכשנולד דוד לא הרגיש בו בריה, וכיון שמת הרגישו בו כל ישראל, הדא הוא דכתיב והדד שמע במצרים כי שכב דוד עם אבותיו וגו' (מלכים א' י"א).