Advertisement
cdsatrian

Nomor Dokumen

Feb 26th, 2017
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.97 KB | None | 0 0
  1. DROP TABLE IF EXISTS no_dokumen;
  2. CREATE TABLE IF NOT EXISTS no_dokumen(
  3.     nomor INT AUTO_INCREMENT,
  4.     dokumen CHAR(1),
  5.     PRIMARY KEY(dokumen,nomor)
  6. ) ENGINE=MyISAM;
  7.  
  8. INSERT INTO no_dokumen(dokumen)
  9. VALUES('A'),('A'),('B'),('C'),('A'),('B'),('C'),('B'),('B');
  10.  
  11. SELECT * FROM no_dokumen;
  12. +-------+---------+
  13. | nomor | dokumen |
  14. +-------+---------+
  15. |     1 | A       |
  16. |     2 | A       |
  17. |     3 | A       |
  18. |     1 | B       |
  19. |     2 | B       |
  20. |     3 | B       |
  21. |     4 | B       |
  22. |     1 | C       |
  23. |     2 | C       |
  24. +-------+---------+
  25.  
  26. INSERT INTO no_dokumen(dokumen)
  27. VALUES('A'),('B'),('A'),('C');
  28.  
  29. +-------+---------+
  30. | nomor | dokumen |
  31. +-------+---------+
  32. |     1 | A       |
  33. |     2 | A       |
  34. |     3 | A       |
  35. |     4 | A       |
  36. |     5 | A       |
  37. |     1 | B       |
  38. |     2 | B       |
  39. |     3 | B       |
  40. |     4 | B       |
  41. |     5 | B       |
  42. |     1 | C       |
  43. |     2 | C       |
  44. |     3 | C       |
  45. +-------+---------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement