Eduversity.bd — Learn with Us, Achieve Your Dreams

এসকিউএল (SQL) — MCQ প্রশ্ন

আইটি ও প্রোগ্রামিং MCQ (ওপেন) · আইটি ও প্রোগ্রামিং। এই অধ্যায়ে মোট 58টি প্রশ্ন আছে। নিচে প্রথম 10টি প্রশ্ন ও অপশন দেওয়া হলো; সঠিক উত্তর সার্ভারে যাচাই হয়।

এই অধ্যায়ে সব প্রশ্নে অনুশীলন করুন

  1. Which SQL clause is used to group rows that have the same values in specified columns into summary rows?

    1. ORDER BY
    2. WHERE
    3. GROUP BY
    4. HAVING

    উত্তর যাচাই করতে প্র্যাকটিসে যান।

  2. Which aggregate function returns the number of rows in a group, including rows with NULL values?

    1. COUNT(column)
    2. COUNT(*)
    3. SUM(1)
    4. COUNT(DISTINCT column)

    উত্তর যাচাই করতে প্র্যাকটিসে যান।

  3. What is the primary difference between the WHERE and HAVING clauses?

    1. WHERE filters groups, HAVING filters rows
    2. WHERE filters rows before grouping, HAVING filters groups after grouping
    3. WHERE works with aggregate functions, HAVING does not
    4. There is no difference; they are interchangeable

    উত্তর যাচাই করতে প্র্যাকটিসে যান।

  4. Which aggregate function calculates the average value of a numeric column?

    1. MEAN()
    2. AVERAGE()
    3. AVG()
    4. SUM() / COUNT(*)

    উত্তর যাচাই করতে প্র্যাকটিসে যান।

  5. Can you use an aggregate function like SUM() directly in a WHERE clause?

    1. Yes, always
    2. No, aggregate functions are not allowed in WHERE; use HAVING instead
    3. Only in MySQL
    4. Only if you also use GROUP BY

    উত্তর যাচাই করতে প্র্যাকটিসে যান।

  6. What does COUNT(DISTINCT department_id) return?

    1. Total number of rows in the table
    2. Number of non-NULL department_id values
    3. Number of unique non-NULL department_id values
    4. Number of NULL department_id values

    উত্তর যাচাই করতে প্র্যাকটিসে যান।

  7. If a SELECT statement includes a column that is not in the GROUP BY clause and not inside an aggregate function, what happens in standard SQL?

    1. Returns the first value encountered
    2. Returns NULL for that column
    3. Throws an error
    4. Automatically adds the column to GROUP BY

    উত্তর যাচাই করতে প্র্যাকটিসে যান।

  8. Which clause is used to filter groups based on a condition involving an aggregate function?

    1. WHERE
    2. GROUP BY
    3. HAVING
    4. FILTER

    উত্তর যাচাই করতে প্র্যাকটিসে যান।

  9. How does the SUM() aggregate function handle NULL values in the column?

    1. Treats NULL as 0
    2. Ignores NULL values
    3. Returns NULL for the entire sum
    4. Throws an error

    উত্তর যাচাই করতে প্র্যাকটিসে যান।

  10. What is the result of the following query? SELECT department_id, AVG(salary) FROM employees GROUP BY department_id HAVING AVG(salary) > 50000;

    1. All departments with their average salary
    2. Only departments where the average salary exceeds 50000
    3. Error: HAVING cannot use AVG
    4. Only employees with salary > 50000

    উত্তর যাচাই করতে প্র্যাকটিসে যান।

← আগের অধ্যায়পরের অধ্যায় →