You are on page 1of 2

-------------------------- Create table

create table PESSOA


(
id NUMBER,
nome VARCHAR2(1000),
tp_pessoa VARCHAR2(2),
dt_nascimento DATE,
documento VARCHAR2(21)
);

------------------------ Create table


create table PEDIDO
(
id NUMBER not null,
id_cliente NUMBER,
numero_pedido NUMBER,
dt_pedido DATE
);
-- Create/Recreate primary, unique and foreign key constraints
alter table PEDIDO
add constraint ID_PEDIDO primary key (ID)
using index
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);

-------------------------- Create table


create table ITEM_PEDIDO
(
id NUMBER not null,
id_pedido NUMBER,
descricao VARCHAR2(1000),
preco_item NUMBER,
qtd_item NUMBER,
dt_inclusao DATE
);
-- Create/Recreate primary, unique and foreign key constraints
alter table ITEM_PEDIDO
add constraint PK_ID primary key (ID)
using index
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);

You might also like