Advertisement
iTermic

AULA 2

Aug 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.87 KB | None | 0 0
  1.     1. Criar a tabela
  2.  
  3. CREATE TABLE cliente (
  4. código NUMBER,
  5. nome VARCHAR(50) NOT NULL,
  6. endereço VARCHAR(50) NOT NULL,
  7. estado VARCHAR(5) NOT NULL,
  8. data_cadastro DATE NULL,
  9. PRIMARY KEY (código));
  10.  
  11.     2. Criar uma SEQUENCE incremento para gerar o Código
  12.  
  13. CREATE SEQUENCE codigo
  14. INCREMENT BY 1
  15. START WITH 1
  16. maxvalue 999
  17. nocycle;
  18.  
  19.     3. Fazer 5 inserções
  20.  
  21. INSERT INTO cliente VALUES(codigo.NEXTVAL,'Geraldo Gaspar','Rua das Cobras Amarelas','SP','22/01/2019');
  22. INSERT INTO cliente VALUES(codigo.NEXTVAL,'Gabriel Chifrudo','Rua das Cobras Vermelhas','SP','23/04/2019');
  23. INSERT INTO cliente VALUES(codigo.NEXTVAL,'Gustavo Gaspar','Rua das Cobras Verdes','SP','25/04/2017');
  24. INSERT INTO cliente VALUES(codigo.NEXTVAL,'Boeing Sete Meia Sete','Torres Gemeas','NY','11/09/2001');
  25. INSERT INTO cliente VALUES(codigo.NEXTVAL,'Cleberson Broxinha','Cobras Rosas','SP','27/07/2012');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement