MySQL + SQL · Lesson 62

ROUND, CEIL और FLOOR Functions

Numbers Rounding

ये तीन control करते हैं कि decimal numbers कैसे round हों।

हर एक कैसे काम करता है

FunctionनियमExample
ROUND(x,n)nearest, n decimalsROUND(7.456,1) → 7.5
CEIL(x)हमेशा ऊपरCEIL(7.1) → 8
FLOOR(x)हमेशा नीचेFLOOR(7.9) → 7

Example

SELECT ROUND(AVG(marks),2) AS avg2,
       CEIL(AVG(marks)) AS rounded_up,
       FLOOR(AVG(marks)) AS rounded_down
FROM students;

सारांश

  • ROUND = nearest; CEIL = ऊपर; FLOOR = नीचे।
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

💻 लाइव कोड एडिटर

इस पेज के प्रोग्राम यहीं तैयार हैं — चलाएँ, बदलें और सीखें। कुछ भी इंस्टॉल किए बिना।
OneCompiler द्वारा संचालित। कोड एडिटर में अपने आप आ जाता है — Run दबाकर आउटपुट देखें। अगर एडिटर न खुले तो नए टैब में खोलें.