Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:27:15

And We had certainly given to David and Solomon knowledge, and they said, "Praise ˹is due˺ to Allah, who has favored us over many of His believing servants."  

And verily We gave David and Solomon, his son, knowledge, of rendering ˹decisive˺ judgement between people, and ˹knowledge˺ of the speech of birds and of other things, and they said, giving thanks to God, ‘Praise be to God Who has favoured us, with prophethood and the disposal of jinn, humans and devils ˹to our service˺, over many of His believing servants’.
القرآن:٢٧:١٥

وَلَقَدْ آتَيْنَا دَاوُودَ وَسُلَيْمَانَ عِلْمًا ۖ وَقَالَا الْحَمْدُ لِلَّهِ الَّذِي فَضَّلَنَا عَلَىٰ كَثِيرٍ مِنْ عِبَادِهِ الْمُؤْمِنِينَ  

{ولقد آتينا داود وسليمان} ابنه {علما} بالقضاء بين الناس ومنطق الطير وغير ذلك {وقالا} شكراً لله {الحمد لله الذي فضلنا} بالنبوة وتسخير الجنّ والإنس والشياطين {على كثير من عباده المؤمنين}.