Skip to content
Daniel de Morais Compartilhe. Aprenda. Evolua.
StartDB StartDB

Banco de dados para iniciantes, by Daniel de Morais – InfoCotidiano

StartDB
StartDB

Banco de dados para iniciantes, by Daniel de Morais – InfoCotidiano

Curso PostgreSQL #28 Extract

Daniel Morais,

Neste vídeo vou mostrar como utilizar a função extract para extrair mês e ano para um relatório de vendas mensal, anual.. ou pode ser usado em estatísticas, etc.

Criando estatísticas de vendas mensais e anuais:

select 
extract (month from ped_data) as mes,
extract (year from ped_data) as ano,
cast(sum(pi2.item_quantidade * pi2.item_valor_unitario) as decimal(10,2))
from pedido p 
left join pedido_item pi2 on pi2.item_pedido = p.ped_numero
group by mes, ano
order by ano, mes 

😉 Gostou do vídeo, que tal me pagar um cafezinho?

☕ https://picpay.me/dane.infocotidiano​

Doar com PagSeguro: https://pag.ae/7W6uXEqB1

Curso PostgreSQL PostgreSQL extractextract dateextrair

Navegação de Post

Previous post
Next post

Posts recentes

  • Criptografando campos no MariaDB com AES
  • Backup Compactado MariaDB ou MySQL no Linux
  • Instalar PostgreSQL 14 no Windows 11
  • Migrando (exportar / importar ) registros de um banco de dados
  • Curso SQL Server #13 In

Categorias

  • Curso Firebird
  • Curso MySQL Server
  • Curso PostgreSQL
  • Curso SQL Server
  • Dicas
  • Dicas MySQL
  • Dicas PostgreSQL
  • Dicas SQL Server
  • Firebird
  • Inicio
  • Instalando MySQL
  • Instalando PostgreSQL
  • Mysql
  • PostgreSQL
  • SQL Server

Tags

add column agregar agregação alterar registro alter table apagar apagar registros atualizar avg between chave chave estrangeira consulta create database create table criar tabela delete drop database drop table extract filtro foreign key having in insert insert into instalar join junção key like mariadb media Mysql order postgresql primary key query select sql server subselect union update up date where

Obrigado pela visita!

©2026 StartDB | WordPress Theme by SuperbThemes