cidade varchar(80), temp_minima int, -- temperatura mínima temp_maxima int, -- temperatura máxima precipitacao real, -- precipitação data date ); Criação de tabelas
CREATE TABLE cliente
( codigo integer NOT NULL, nome character varying, CONSTRAINT pk_cliente PRIMARY KEY (codigo) ); Criação de tabelas CREATE TABLE nota ( cod_nf integer NOT NULL, valor money, cod_cliente integer NOT NULL, CONSTRAINT pk_nota PRIMARY KEY (cod_nf), CONSTRAINT fk_nota_cliente FOREIGN KEY (cod_cliente) REFERENCES cliente (codigo) ); Executar o script ● No prompt do psql ● \i nome_arquivo ● Na linha de comando ● psql –U <nome_usuario> –d <nome_banco_de_dados> –f <nome_arquivo_script>