Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. /*==============================================================*/
  2. /* DBMS name: PostgreSQL 9.x */
  3. /* Created on: 19.10.2018 09:47:58 */
  4. /*==============================================================*/
  5.  
  6.  
  7. drop index VERLEGT_FK;
  8.  
  9. drop index BUCH_PK;
  10.  
  11. drop table BUCH;
  12.  
  13. drop index VERLAG_PK;
  14.  
  15. drop table VERLAG;
  16.  
  17. /*==============================================================*/
  18. /* Table: BUCH */
  19. /*==============================================================*/
  20. create table BUCH (
  21. ISBN VARCHAR(15) not null,
  22. NAME VARCHAR(50) not null,
  23. TITEL VARCHAR(50) null,
  24. AUFLAGE INT4 null,
  25. EHRSCHEINUNGSJAHR DATE null,
  26. SPRACHE VARCHAR(3) null,
  27. constraint PK_BUCH primary key (ISBN)
  28. );
  29.  
  30. /*==============================================================*/
  31. /* Index: BUCH_PK */
  32. /*==============================================================*/
  33. create unique index BUCH_PK on BUCH (
  34. ISBN
  35. );
  36.  
  37. /*==============================================================*/
  38. /* Index: VERLEGT_FK */
  39. /*==============================================================*/
  40. create index VERLEGT_FK on BUCH (
  41. NAME
  42. );
  43.  
  44. /*==============================================================*/
  45. /* Table: VERLAG */
  46. /*==============================================================*/
  47. create table VERLAG (
  48. NAME VARCHAR(50) not null,
  49. ADRESSE VARCHAR(50) null,
  50. constraint PK_VERLAG primary key (NAME)
  51. );
  52.  
  53. /*==============================================================*/
  54. /* Index: VERLAG_PK */
  55. /*==============================================================*/
  56. create unique index VERLAG_PK on VERLAG (
  57. NAME
  58. );
  59.  
  60. alter table BUCH
  61. add constraint FK_BUCH_VERLEGT_VERLAG foreign key (NAME)
  62. references VERLAG (NAME)
  63. on delete restrict on update restrict;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement