Material del curso de SQL de la UNACAR 2020
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

26 lignes
382 B

  1. CREATE TABLE tabla1 (
  2. id INT PRIMARY KEY
  3. );
  4. CREATE TABLE tabla2 (
  5. id INT PRIMARY KEY
  6. );
  7. INSERT INTO tabla1(id) VALUES(1),(2),(3);
  8. INSERT INTO tabla2(id) VALUES(2),(3),(4);
  9. #union
  10. select id from tabla1
  11. union
  12. select id from tabla2
  13. #intersec
  14. select id from tabla1
  15. where id in (select id from tabla2)
  16. #except
  17. select id from tabla1
  18. where id not in (select id from tabla2)