{"id":26292274,"url":"https://github.com/natanoliveira/pivot-in-mysql","last_synced_at":"2025-03-15T01:35:15.762Z","repository":{"id":217879471,"uuid":"558993670","full_name":"natanoliveira/pivot-in-mysql","owner":"natanoliveira","description":"Instrução SQL PIVOT no MySQL","archived":false,"fork":false,"pushed_at":"2022-10-28T19:32:44.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-01-18T16:59:30.390Z","etag":null,"topics":["mysql","sql"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/natanoliveira.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-10-28T19:17:19.000Z","updated_at":"2024-01-18T16:59:33.864Z","dependencies_parsed_at":"2024-01-18T17:17:23.837Z","dependency_job_id":null,"html_url":"https://github.com/natanoliveira/pivot-in-mysql","commit_stats":null,"previous_names":["natanoliveira/pivot-in-mysql"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natanoliveira%2Fpivot-in-mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natanoliveira%2Fpivot-in-mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natanoliveira%2Fpivot-in-mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natanoliveira%2Fpivot-in-mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/natanoliveira","download_url":"https://codeload.github.com/natanoliveira/pivot-in-mysql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243672121,"owners_count":20328756,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mysql","sql"],"created_at":"2025-03-15T01:35:15.017Z","updated_at":"2025-03-15T01:35:15.751Z","avatar_url":"https://github.com/natanoliveira.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# pivot-in-mysql\nInstrução SQL \"PIVOT\" no MySQL\n\nAlguns bancos de dados (por exemplo, SQL Server) têm suporte nativo para pivôs, mas o MySQL, infelizmente, não suporta a função Pivot. Um dos métodos para contornar isso e criar uma tabela dinâmica no MySQL é usar a instrução SELECT com a expressão CASE.\n\nPara isso, você precisa criar uma instrução SELECT com a função agregada, adicionar uma instrução CASE dentro dessa função e, em seguida, adicionar uma cláusula GROUP BY.\n\nTambém é possível criar uma tabela dinâmica no MySQL usando a instrução IF dentro da função agregada.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatanoliveira%2Fpivot-in-mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatanoliveira%2Fpivot-in-mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatanoliveira%2Fpivot-in-mysql/lists"}