TrabalhosGratuitos.com - Trabalhos, Monografias, Artigos, Exames, Resumos de livros, Dissertações
Pesquisar

Banco De Dados, Floricultura

Exames: Banco De Dados, Floricultura. Pesquise 860.000+ trabalhos acadêmicos

Por:   •  6/10/2014  •  317 Palavras (2 Páginas)  •  919 Visualizações

Página 1 de 2

create schema exercicio_floricultura;

set search_path to 'exercicio_floricultura';

create table tb_cliente(

rg integer not null,

nome character varying (255) not null,

telefone character (8) not null,

endereco character varying (255) not null,

constraint tb_client_pkey primary key (rg)

);

create table tb_categoria(

codigo integer not null,

descricao character varying (255) not null,

constraint tb_categoria_pkey primary key (codigo)

);

create table tb_produto(

codigo integer not null,

preco float not null,

descricao character varying (255),

codigo_categoria integer not null,

constraint tb_produto_pkey primary key (codigo),

constraint tb_produto_fkey foreign key(codigo_categoria) references tb_categoria (codigo)

);

select * from tb_produto tb_produto

inner join tb_categoria tb_categoria on tb_categoria.codigo = tb_produto.codigo_categoria

select * from tb_categoria

insert into tb_cateoria values (1, 'Eletrodomésticos');

insert into tb_cateoria values (2, 'Roupas');

select * from tb_produto

insert into tb_cateoria values (2, 'qualquer coisa' 2);

create view visao_categoria_produto

as

(select tb_produto.codigo as codigo_produto,

tb_produto.preco, tb_produto.descricao,

tb_produto.codigo_categoria, tb_categoria.codigo,

tb_categoria.descricao as descricao_categoria from tb_produto tb_produto

inner join tb_categoria tb_categoria on

tb_categoria.codigo = tb_produto.codigo_categoria)

loja

create table tb_cliente(

numero_associado integer not null,

nome character varying (255) not nul,

telefone character(8) not null,

constraint tb_cliente_pkey primary key(

);

create table tb_ator(

numero integer not null,

nome character varying (255) not null,

constraint tb_ator_pkey primary key (numero)

);

create table tb_filme(

numero integer not null,

titulo character varying (255) not null,

categoria character varying (255) not null,

constraint tb_filme_pkey primary key (numero)

);

create table tb_dvd(

numero integer not null,

numero_filme integer not null,

constraint

...

Baixar como (para membros premium)  txt (3.5 Kb)  
Continuar por mais 1 página »
Disponível apenas no TrabalhosGratuitos.com