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:43:9

And if you should ask them, "Who has created the heavens and the earth?" they would surely say, "They were created by the Exalted in Might, the Knowing."  

And if (wa-la-in: the lām is for oaths) you ask them, ‘Who created the heavens and the earth?’ they will surely say (the indicative nūn has been omitted because of the other nūn coming after it, and likewise the wāw ˹replaced by the damma in -lunna˺, because of two unvowelled consonants coming together), ‘The Mighty, the Knower created them’ — ˹this would have to be˺ their eventual response, that is to say, God ˹created them˺, Lord of Might and Knowledge. God, exalted be He, adds:
القرآن:٤٣:٩

وَلَئِنْ سَأَلْتَهُمْ مَنْ خَلَقَ السَّمَاوَاتِ وَالْأَرْضَ لَيَقُولُنَّ خَلَقَهُنَّ الْعَزِيزُ الْعَلِيمُ  

{ولئن} لام قسم {سألتهم من خلق السماوات والأرض ليقولنَّ} حذف منه نون الرفع لتوالي النونات وواو الضمير لالتقاء الساكنين {خلقهن العزيز العليم} آخر جوابهم أي الله ذو العزة والعلم، زاد تعالى:

See similar narrations below:

Collected by Qurʾān
quran:31:25

And if you asked them, "Who created the heavens and earth?" they would surely say, "Allah." Say, "˹All˺ praise is ˹due˺ to Allah "; but most of them do not know.  

And if (wa-la-in, the lām is for oaths) you were to ask them, ‘Who created the heavens and the earth?’, they will surely say, ‘God’ (la-yaqūlunna, ‘they will surely say’, the indicative nūn has been omitted because of the like ˹sc. the nūn˺ coming after it, and likewise the wāw of the ˹plural˺ person, because of two unvocalised consonants coming together). Say: ‘Praise be to God’, for the manifestation of the definitive argument against them by the affirmation of the Oneness ˹of God˺. Nay, but most of them do not realise, that this ˹affirmation˺ is an obligation upon them.
القرآن:٣١:٢٥

وَلَئِنْ سَأَلْتَهُمْ مَنْ خَلَقَ السَّمَاوَاتِ وَالْأَرْضَ لَيَقُولُنَّ اللَّهُ ۚ قُلِ الْحَمْدُ لِلَّهِ ۚ بَلْ أَكْثَرُهُمْ لَا يَعْلَمُونَ  

{ولئن} لام قسم {سألتهم من خلق السموات والأرض ليقولن الله} حذف منه نون الرفع لتوالي الأمثال، وواو الضمير لالتقاء الساكنين {قل الحمد لله} على ظهور الحجة عليهم بالتوحيد {بل أكثرهم لا يعلمون} وجوبه عليهم.