Advertisement
Guest User

Untitled

a guest
May 29th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. CREATE DOMAIN identify
  2. AS INTEGER;
  3.  
  4. CREATE DOMAIN name_custom
  5. AS VARCHAR(30);
  6.  
  7. -- CREATE DOMAIN date_a
  8. -- AS DATE
  9. -- CHECK (date_d > date_a);
  10. --
  11. -- CREATE DOMAIN date_d
  12. -- AS DATE
  13. -- CHECK (date_d > date_a);
  14.  
  15. CREATE TABLE Stations(
  16. ID_station SERIAL NOT NULL,
  17. Name_station name_custom NOT NULL
  18. );
  19.  
  20. CREATE TABLE Stops(
  21. ID_train identify NOT NULL,
  22. ID_stop SERIAL NOT NULL,
  23. ID_station identify NOT NULL,
  24. date_arrive name_custom NULL, --Время прибытия
  25. date_departure name_custom NULL, --Время отправления
  26. day_from_departure identify NULL,
  27. transit BOOLEAN,
  28. order identify NOT NULL
  29. );
  30.  
  31. -- CREATE TABLE Routes(
  32. -- ID_route SERIAL NOT NULL,
  33. -- Region name_custom NOT NULL,
  34. -- City name_custom NOT NULL
  35. -- );
  36.  
  37. CREATE TABLE Flights(
  38. ID_flight SERIAL NOT NULL,
  39. ID_train identify NOT NULL,
  40. date_start date NOT NULL,
  41. );
  42.  
  43. CREATE TABLE Tickets (
  44. ID_ticket SERIAL NOT NULL,
  45. ID_place identify NOT NULL,
  46. -- ID_route identify NOT NULL,
  47. ID_station identify NOT NULL,
  48. Stat_ID_station identify NOT NULL,
  49. date_arrival DATE NOT NULL, -- Генерирует приложение
  50. date_dispatch DATE NOT NULL, -- Генерирует приложение
  51. passport_number INTEGER NOT NULL,
  52. full_name VARCHAR(80) NOT NULL
  53. );
  54.  
  55. CREATE TABLE Places(
  56. ID_carriage identify NOT NULL,
  57. place identify NULL,
  58. ID_place SERIAL NOT NULL
  59. );
  60.  
  61. CREATE TABLE Carriages(
  62. ID_train identify NOT NULL,
  63. carriage identify NULL,
  64. ID_carriage SERIAL NOT NULL
  65. );
  66.  
  67. CREATE TABLE Trains(
  68. ID_train SERIAL NOT NULL,
  69. train_number identify NULL
  70. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement