Skip to main content
adicionou 12 caracteres ao conteúdo
Fonte Link

Preciso traduzirsaber o que as seguintes queries realizam, porém estou com dúvida, pois estou começando estudar agora SQL. Vocês podem me auxiliar?

"SELECT user_id, CAST(SUM(points_per_badge) AS INT) "
        + "FROM (SELECT p.user_id AS user_id, (COUNT(1) * b.quantity) AS points_per_badge "
        + "FROM CX_PUNCTUATION p JOIN CX_BADGE b ON b.id = p.badge_id WHERE p.user_id NOT IN :ignoredUsers "
        + "GROUP BY user_id, b.quantity) AS points_per_user GROUP BY user_id ORDER BY 2 DESC, 1"

e

"SELECT p.badge_id, CAST((COUNT(1) * b.quantity) AS INT) "
            + "FROM CX_PUNCTUATION p JOIN CX_BADGE b ON b.id = p.badge_id WHERE p.user_id = :userId "
            + "GROUP BY p.badge_id, b.quantity"

Preciso traduzir as seguintes queries, porém estou com dúvida, pois estou começando estudar agora SQL. Vocês podem me auxiliar?

"SELECT user_id, CAST(SUM(points_per_badge) AS INT) "
        + "FROM (SELECT p.user_id AS user_id, (COUNT(1) * b.quantity) AS points_per_badge "
        + "FROM CX_PUNCTUATION p JOIN CX_BADGE b ON b.id = p.badge_id WHERE p.user_id NOT IN :ignoredUsers "
        + "GROUP BY user_id, b.quantity) AS points_per_user GROUP BY user_id ORDER BY 2 DESC, 1"

e

"SELECT p.badge_id, CAST((COUNT(1) * b.quantity) AS INT) "
            + "FROM CX_PUNCTUATION p JOIN CX_BADGE b ON b.id = p.badge_id WHERE p.user_id = :userId "
            + "GROUP BY p.badge_id, b.quantity"

Preciso saber o que as seguintes queries realizam, porém estou com dúvida, pois estou começando estudar agora SQL. Vocês podem me auxiliar?

"SELECT user_id, CAST(SUM(points_per_badge) AS INT) "
        + "FROM (SELECT p.user_id AS user_id, (COUNT(1) * b.quantity) AS points_per_badge "
        + "FROM CX_PUNCTUATION p JOIN CX_BADGE b ON b.id = p.badge_id WHERE p.user_id NOT IN :ignoredUsers "
        + "GROUP BY user_id, b.quantity) AS points_per_user GROUP BY user_id ORDER BY 2 DESC, 1"

e

"SELECT p.badge_id, CAST((COUNT(1) * b.quantity) AS INT) "
            + "FROM CX_PUNCTUATION p JOIN CX_BADGE b ON b.id = p.badge_id WHERE p.user_id = :userId "
            + "GROUP BY p.badge_id, b.quantity"
Fonte Link

Duvida Iniciante SQL

Preciso traduzir as seguintes queries, porém estou com dúvida, pois estou começando estudar agora SQL. Vocês podem me auxiliar?

"SELECT user_id, CAST(SUM(points_per_badge) AS INT) "
        + "FROM (SELECT p.user_id AS user_id, (COUNT(1) * b.quantity) AS points_per_badge "
        + "FROM CX_PUNCTUATION p JOIN CX_BADGE b ON b.id = p.badge_id WHERE p.user_id NOT IN :ignoredUsers "
        + "GROUP BY user_id, b.quantity) AS points_per_user GROUP BY user_id ORDER BY 2 DESC, 1"

e

"SELECT p.badge_id, CAST((COUNT(1) * b.quantity) AS INT) "
            + "FROM CX_PUNCTUATION p JOIN CX_BADGE b ON b.id = p.badge_id WHERE p.user_id = :userId "
            + "GROUP BY p.badge_id, b.quantity"