This commit is contained in:
ada-dmitry
2023-09-27 11:27:46 +03:00
parent 56a072f009
commit ffaf9c6a08
+6 -7
View File
@@ -1,3 +1,6 @@
/* Лабораторная работа #1 || Вариант 4 || Антипенко */
CREATE table countries ( CREATE table countries (
id numeric(3) PRIMARY KEY NOT NULL, id numeric(3) PRIMARY KEY NOT NULL,
@@ -9,10 +12,8 @@ CREATE table schedules (
dt_dep timestamp without time zone NOT NULL, dt_dep timestamp without time zone NOT NULL,
dt_arr timestamp without time zone NOT NULL, dt_arr timestamp without time zone NOT NULL,
plс_of_dep varchar(2000) NOT NULL default 'Москва', plс_of_dep varchar(2000) NOT NULL default 'Москва',
plc_of_arr varchar(2000) NOT NULL, plc_of_arr varchar(2000) NOT NULL,
tpe varchar(9) NOT NULL tpe varchar(9) NOT NULL
CHECK(tpe = 'Скорый' OR tpe = 'Фирменный' OR tpe = 'Обычный'), CHECK(tpe = 'Скорый' OR tpe = 'Фирменный' OR tpe = 'Обычный'),
@@ -21,13 +22,11 @@ CREATE table schedules (
id_oper numeric(3) references countries(id) not null id_oper numeric(3) references countries(id) not null
); );
INSERT into countries INSERT into countries VALUES
VALUES
(321, 'Россия'); (321, 'Россия');
INSERT into schedules INSERT into schedules VALUES
VALUES(1, '1999-01-08 04:05:06', (1, '1999-01-08 04:05:06', '1999-01-08 04:05:06', default, 'СПб', 'Скорый', 40, 321);
'1999-01-08 04:05:06', default, 'СПб', 'Скорый', 40, 321);
SELECT * FROM countries; SELECT * FROM countries;
SELECT * FROM schedules; SELECT * FROM schedules;