Header Ads Widget

SQL Server Mathematical Functions – Full Guide (हिंदी में)

SQL Server Mathematical Functions (हिंदी में)

SQL Server Mathematical Functions – Full Guide (हिंदी में)

🔑 Memory में रखें (Definition)

SQL Server में Mathematical Functions का उपयोग numeric calculations, rounding, power, square root आदि के लिए किया जाता है। ये functions numbers के साथ calculations करने में मदद करते हैं।

🧾 Syntax

  • ROUND(number, decimal_places)
  • CEILING(number)
  • FLOOR(number)
  • ABS(number)
  • POWER(number, power)
  • SQRT(number)
  • RAND()
  • SIGN(number)
  • EXP(number)
  • LOG(number)

📋 Demo Table: Numbers

CREATE TABLE Numbers (
    ID INT,
    Value FLOAT
);

INSERT INTO Numbers VALUES
(1, 12.3456),
(2, -5.75),
(3, 0),
(4, 2.718),
(5, 100);

🧪 Examples

1️⃣ ROUND()

SELECT Value, ROUND(Value, 2) AS Rounded FROM Numbers;

2️⃣ CEILING()

SELECT Value, CEILING(Value) AS CeilingValue FROM Numbers;

3️⃣ FLOOR()

SELECT Value, FLOOR(Value) AS FloorValue FROM Numbers;

4️⃣ ABS()

SELECT Value, ABS(Value) AS AbsoluteValue FROM Numbers;

5️⃣ POWER()

SELECT Value, POWER(Value, 2) AS Squared FROM Numbers;

6️⃣ SQRT()

SELECT Value, SQRT(ABS(Value)) AS SquareRoot FROM Numbers;

7️⃣ RAND()

SELECT RAND() AS RandomNumber;

8️⃣ SIGN()

SELECT Value, SIGN(Value) AS SignValue FROM Numbers;

9️⃣ EXP()

SELECT Value, EXP(Value) AS ExpValue FROM Numbers;

🔟 LOG()

SELECT Value, LOG(Value) AS LogValue FROM Numbers WHERE Value > 0;

🧠 INTERVIEW QUESTIONS (with Answers)

  1. Q: ROUND() function क्या करता है?
    Ans: किसी संख्या को दिए गए दशमलव स्थानों तक round करता है।
  2. Q: CEILING() और FLOOR() में अंतर?
    Ans: CEILING अगली सबसे बड़ी integer देता है, FLOOR सबसे छोटी।
  3. Q: ABS() का उपयोग?
    Ans: किसी negative संख्या को positive में बदलना।
  4. Q: POWER() और SQRT() कब उपयोग करें?
    Ans: POWER किसी संख्या की power निकालता है, SQRT square root देता है।
  5. Q: RAND() कब उपयोग करें?
    Ans: Random number generate करने के लिए।

अगर यह पोस्ट पसंद आई हो तो Job Oriented Academy को लाइक, शेयर और सब्सक्राइब करें! ❤️

Post a Comment

0 Comments