The Blunder

Sort by

recency

|

1905 Discussions

|

  • + 0 comments

    select ceil(abs(avg(salary) - avg(replace(salary , '0' , '')))) from employees

    You can try :))

  • + 0 comments

    below one giveing worng answer

    select ceil(avg(salary-TRIM(TRAILING '0' FROM salary))) from employees

  • + 1 comment

    SELECT ceil (ABS( (SELECT AVG(SALARY) FROM EMPLOYEES) - (SELECT AVG(CAST(REPLACE(SALARY, '0', '') AS UNSIGNED)) FROM EMPLOYEES) ))

  • + 1 comment

    Can anyone tell me where i can see all the key words (like REPLACE, CAST ..) used in the sql, the ones which are not present in tutorials from GFG, W3 etc?

  • + 0 comments
    WITH sem_zeros AS (
        SELECT
            Salary,
            CAST(REPLACE(CAST(Salary AS CHAR), "0", "") AS SIGNED) AS salario_limpo 
        FROM
            EMPLOYEES
    )
    
    SELECT
        ROUND(AVG(Salary) - AVG(salario_limpo)) + 1 AS dif_erro
    FROM
        sem_zeros