1.9. Inserindo Dados
Sintaxe:
INSERT INTO nome-tabela (campo1, campo2, ...)
VALUES (v1a, v2a, ...)[,(v1b, v2b, ...)];
Na tabela municipio
, vamos inserir as seguintes tuplas:
INSERT INTO municipio (geocodigo, nome, geom)
VALUES ('4105409', 'Chopinzinho', ST_GeomFromText('MULTIPOLYGON(((-52.725 -25.945,-52.725 -25.643,-52.213 -25.643,-52.213 -25.945,-52.725 -25.945)))', 4674)),
('4117602', 'Palmas', ST_GeomFromText('MULTIPOLYGON(((-52.177 -26.599,-52.177 -26.243,-51.512 -26.243,-51.512 -26.599,-52.177 -26.599)))', 4674)),
('4109401', 'Guarapuava', ST_GeomFromText('MULTIPOLYGON(((-52.022 -25.682,-52.022 -24.969,-51.089 -24.969,-51.089 -25.682,-52.022 -25.682)))', 4674)),
('4117057', 'Nova Laranjeiras', ST_GeomFromText('MULTIPOLYGON(((-52.843 -25.488,-52.843 -24.963,-52.391 -24.963,-52.391 -25.488,-52.843 -25.488)))', 4674)),
('4127007', 'Teixeira Soares', ST_GeomFromText('MULTIPOLYGON(((-50.575 -25.530,-50.575 -25.089,-50.261 -25.089,-50.261 -25.530,-50.575 -25.530)))', 4674));
Na tabela contratante
, vamos inserir as seguintes tuplas:
INSERT INTO contratante (cpf, nome, genero, classificacao, data_cadastro)
VALUES ('11111111101', 'Gilberto', 'm', 'pequeno produtor', '2022-01-31'),
('22222222201', 'Karine', 'f', 'grande produtor', '2022-01-02'),
('33333333301', 'Marcos', 'm', 'médio produtor', '2021-01-02'),
('44444444401', 'Thales', 'm', 'pequeno produtor', '2022-02-08'),
('55555555501', 'Leonardo', 'm', 'grande produtor', '2023-01-10'),
('66666666601', 'Felipe', 'm', 'médio produtor', '2023-03-23');
Na tabela operacao
, vamos inserir as seguintes tuplas:
INSERT INTO operacao (valor, data_inicio, data_fim)
VALUES ('100000.54', '2022-05-01', '2022-11-30'),
('110000.45', '2023-04-01', '2023-10-30'),
('730000.00', '2022-05-01', '2022-11-30'),
('200000.99', '2021-05-01', '2021-11-30'),
('205000.98', '2022-03-01', '2022-12-31'),
('243000.97', '2023-06-01', '2023-09-30'),
('50000.12', '2022-05-01', '2022-11-30'),
('900000.73', '2023-05-01', '2023-11-30'),
('234000.56', '2023-05-01', '2023-11-30');
Na tabela contratante_operacao
, vamos inserir as seguintes tuplas:
INSERT INTO contratante_operacao (cpf, numero, DATA_ASSINATURA)
VALUES ('11111111101', 1, '2022-02-01'),
('11111111101', 2, '2023-03-02'),
('22222222201', 3, '2022-01-15'),
('33333333301', 4, '2021-01-03'),
('33333333301', 5, '2022-02-08'),
('33333333301', 6, '2023-03-09'),
('44444444401', 7, '2022-03-04'),
('11111111101', 7, '2022-03-05'),
('55555555501', 8, '2023-01-11'),
('66666666601', 9, '2023-04-01');
Na tabela gleba
, vamos inserir as seguintes tuplas:
INSERT INTO gleba (geom, operacao_numero)
VALUES (ST_GeomFromText('MULTIPOLYGON(((-52.537348 -25.896628,-52.537348 -25.893046,-52.534312 -25.893046,-52.534312 -25.896628,-52.537348 -25.896628)))', 4674), 1),
(ST_GeomFromText('MULTIPOLYGON(((-52.506973 -25.896984,-52.506973 -25.892353,-52.502695 -25.892353,-52.502695 -25.896984,-52.506973 -25.896984)))', 4674), 2),
(ST_GeomFromText('MULTIPOLYGON(((-51.527903 -25.513915,-51.527903 -25.507675,-51.522626 -25.507675,-51.522626 -25.513915,-51.527903 -25.513915)))', 4674), 3),
(ST_GeomFromText('MULTIPOLYGON(((-51.436374 -25.148933,-51.436374 -25.144785,-51.430814 -25.144785,-51.430814 -25.148933,-51.436374 -25.148933)))', 4674), 3),
(ST_GeomFromText('MULTIPOLYGON(((-52.59729 -25.103075,-52.59729 -25.100275,-52.594143 -25.100275,-52.594143 -25.103075,-52.59729 -25.103075)))', 4674), 4),
(ST_GeomFromText('MULTIPOLYGON(((-52.67221422108 -25.17219501792,-52.67221422108 -25.17097150174,-52.66956715786 -25.17097150174,-52.66956715786 -25.17219501792,-52.67221422108 -25.17219501792)))', 4674), 5),
(ST_GeomFromText('MULTIPOLYGON(((-52.600623 -25.099855,-52.600623 -25.095416,-52.594866 -25.095416,-52.594866 -25.099855,-52.600623 -25.099855)))', 4674), 6),
(ST_GeomFromText('MULTIPOLYGON(((-51.833097 -26.508778,-51.833097 -26.494549,-51.819772 -26.494549,-51.819772 -26.508778,-51.833097 -26.508778)))', 4674), 7),
(ST_GeomFromText('MULTIPOLYGON(((-51.694969 -26.578191,-51.694969 -26.573706,-51.690532 -26.573706,-51.690532 -26.578191,-51.694969 -26.578191)))', 4674), 7),
(ST_GeomFromText('MULTIPOLYGON(((-50.367539 -25.433554,-50.367539 -25.431799,-50.365782 -25.431799,-50.365782 -25.433554,-50.367539 -25.433554)))', 4674), 8),
(ST_GeomFromText('MULTIPOLYGON(((-50.357841 -25.414651,-50.357841 -25.4108759999999,-50.352926 -25.4108759999999,-50.352926 -25.414651,-50.357841 -25.414651)))', 4674), 9);