Advertisement
Talilo

scritp_test_sql_lite.txt

Apr 24th, 2023 (edited)
1,145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.66 KB | None | 0 0
  1. CREATE table cursos(
  2.   id integer no NULL PRIMARY KEY,
  3.   nome char[50]
  4. );
  5.  
  6.  
  7. CREATE TABLE aluno(
  8.  cpf char[11] NOT NULL PRIMARY KEY,
  9.  nome varchar[150],
  10.  data DATA,
  11.  id_cursos integer,
  12.  CONSTRAINT aluno FOREIGN KEY (id_cursos) REFERENCES cursos (id)
  13. );
  14.  
  15. INSERT into cursos VALUES(0 , "Historia");
  16. INSERT into cursos VALUES(1, "Biologia");
  17. INSERT into cursos VALUES(2, "Geografia");
  18.  
  19. SELECT * from cursos;
  20.  
  21. SELECT * from aluno;
  22.  
  23.  
  24.  
  25. drop table cursos;
  26.  
  27.  
  28. INSERT INTO aluno VALUES("15736786", " Bruno", "1998-02-02", 2);
  29. INSERT INTO aluno VALUES("154636786", " Fabio", "1990-02-02", 2);
  30. INSERT INTO aluno VALUES("157736786", "Claudio", "1999-02-02", 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement