Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b397c67

Browse files
Adiciona capitais dos estados
1 parent 4921258 commit b397c67

File tree

1 file changed

+52
-21
lines changed

1 file changed

+52
-21
lines changed

‎dados.sql

Lines changed: 52 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
drop table if exists cidade;
77
drop table if exists estado;
8+
89
drop table if exists regiao_geografica;
910

1011
CREATE TABLE regiao_geografica (
@@ -31,6 +32,7 @@ CREATE TABLE cidade (
3132
id serial PRIMARY KEY NOT NULL,
3233
nome varchar(120) NOT NULL,
3334
estado_id int NOT NULL,
35+
capital boolean not null default false,
3436
constraint fk_cidade_estado foreign key (estado_id) references estado(id)
3537
);
3638

@@ -39,33 +41,33 @@ CREATE UNIQUE INDEX ix_cidade ON cidade (nome, estado_id);
3941
INSERT INTO regiao_geografica (nome) VALUES ('Norte'), ('Nordeste'), ('Centro-Oeste'), ('Sudeste'), ('Sul');
4042

4143
INSERT INTO estado (id, nome, uf, regiao_id, area_km2, populacao) VALUES
42-
(1, 'Acre', 'AC', 1, 164123, 829780),
43-
(2, 'Alagoas', 'AL', 2, 27848, 3125254),
44-
(3, 'Amazonas', 'AM', 1, 1559167, 3952262),
45-
(4, 'Amapá', 'AP', 1, 142470, 774268),
44+
(1, 'Acre', 'AC', 1, 164123, 829780),
45+
(2, 'Alagoas', 'AL', 2, 27848, 3125254),
46+
(3, 'Amazonas', 'AM', 1, 1559167, 3952262),
47+
(4, 'Amapá', 'AP', 1, 142470, 774268),
4648
(5, 'Bahia', 'BA', 2, 564760, 14659023),
47-
(6, 'Ceará', 'CE', 2, 148894, 8936431),
48-
(7, 'Distrito Federal', 'DF', 3, 5760, 2923369),
49-
(8, 'Espírito Santo', 'ES', 4, 46074, 4108508),
50-
(9, 'Goiás', 'GO', 3, 340203, 6950976),
51-
(10, 'Maranhão', 'MA', 2, 329642, 6800605),
49+
(6, 'Ceará', 'CE', 2, 148894, 8936431),
50+
(7, 'Distrito Federal', 'DF', 3, 5760, 2923369),
51+
(8, 'Espírito Santo', 'ES', 4, 46074, 4108508),
52+
(9, 'Goiás', 'GO', 3, 340203, 6950976),
53+
(10, 'Maranhão', 'MA', 2, 329642, 6800605),
5254
(11, 'Minas Gerais', 'MG', 4, 586521, 20732660),
53-
(12, 'Mato Grosso do Sul', 'MS', 3, 357145, 2833742),
54-
(13, 'Mato Grosso', 'MT', 3, 903207, 3784239),
55-
(14, 'Pará', 'PA', 1, 1245870, 8442962),
56-
(15, 'Paraíba', 'PB', 2, 56467, 4030961),
57-
(16, 'Pernambuco', 'PE', 2, 98067, 9051113),
58-
(17, 'Piauí', 'PI', 2, 251756, 3270174),
55+
(12, 'Mato Grosso do Sul', 'MS', 3, 357145, 2833742),
56+
(13, 'Mato Grosso', 'MT', 3, 903207, 3784239),
57+
(14, 'Pará', 'PA', 1, 1245870, 8442962),
58+
(15, 'Paraíba', 'PB', 2, 56467, 4030961),
59+
(16, 'Pernambuco', 'PE', 2, 98067, 9051113),
60+
(17, 'Piauí', 'PI', 2, 251756, 3270174),
5961
(18, 'Paraná', 'PR', 5, 199298, 11835379),
6062
(19, 'Rio de Janeiro', 'RJ', 4, 43750, 16615526),
61-
(20, 'Rio Grande do Norte','RN', 2, 52809, 3303953),
62-
(21, 'Rondônia', 'RO', 1, 237765, 1616379),
63-
(22, 'Roraima', 'RR', 1, 223644, 634805),
63+
(20, 'Rio Grande do Norte','RN', 2, 52809, 3303953),
64+
(21, 'Rondônia', 'RO', 1, 237765, 1616379),
65+
(22, 'Roraima', 'RR', 1, 223644, 634805),
6466
(23, 'Rio Grande do Sul', 'RS', 5, 281707, 11088065),
65-
(24, 'Santa Catarina', 'SC', 5, 95730, 7762154),
66-
(25, 'Sergipe', 'SE', 2, 21925, 2211868),
67+
(24, 'Santa Catarina', 'SC', 5, 95730, 7762154),
68+
(25, 'Sergipe', 'SE', 2, 21925, 2211868),
6769
(26, 'São Paulo', 'SP', 4, 248219, 46024937),
68-
(27, 'Tocantins', 'TO', 1, 277466, 1584306);
70+
(27, 'Tocantins', 'TO', 1, 277466, 1584306);
6971

7072

7173
INSERT INTO cidade (id, nome, estado_id) VALUES
@@ -5632,3 +5634,32 @@ INSERT INTO cidade (id, nome, estado_id) VALUES
56325634
(5562, 'Tupiratins', 27),
56335635
(5563, 'Wanderlândia', 27),
56345636
(5564, 'Xambioá', 27);
5637+
5638+
5639+
update cidade set capital = true where id = 94;
5640+
update cidade set capital = true where id = 147;
5641+
update cidade set capital = true where id = 256;
5642+
update cidade set capital = true where id = 209;
5643+
update cidade set capital = true where id = 616;
5644+
update cidade set capital = true where id = 756;
5645+
update cidade set capital = true where id = 882;
5646+
update cidade set capital = true where id = 78;
5647+
update cidade set capital = true where id = 977;
5648+
update cidade set capital = true where id = 1314;
5649+
update cidade set capital = true where id = 1630;
5650+
update cidade set capital = true where id = 1506;
5651+
update cidade set capital = true where id = 1383;
5652+
update cidade set capital = true where id = 2436;
5653+
update cidade set capital = true where id = 2655;
5654+
update cidade set capital = true where id = 3315;
5655+
update cidade set capital = true where id = 3582;
5656+
update cidade set capital = true where id = 2878;
5657+
update cidade set capital = true where id = 3658;
5658+
update cidade set capital = true where id = 3770;
5659+
update cidade set capital = true where id = 4382;
5660+
update cidade set capital = true where id = 4400;
5661+
update cidade set capital = true where id = 4174;
5662+
update cidade set capital = true where id = 4500;
5663+
update cidade set capital = true where id = 5353;
5664+
update cidade set capital = true where id = 5270;
5665+
update cidade set capital = true where id = 5514;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /