mirror of
https://github.com/ada-dmitry/DB.mephi_ada.git
synced 2026-09-23 23:50:16 +00:00
mod l1
This commit is contained in:
+19
-20
@@ -1,33 +1,32 @@
|
||||
CREATE table countries (
|
||||
id numeric(3) PRIMARY KEY NOT NULL,
|
||||
/* Лабораторная работа #1 || Вариант 4 || Антипенко */
|
||||
|
||||
name_country varchar(64) NOT NULL
|
||||
|
||||
CREATE table countries (
|
||||
id numeric(3) PRIMARY KEY NOT NULL,
|
||||
|
||||
name_country varchar(64) NOT NULL
|
||||
);
|
||||
|
||||
CREATE table schedules (
|
||||
id integer PRIMARY KEY,
|
||||
id integer PRIMARY KEY,
|
||||
|
||||
dt_dep timestamp without time zone NOT NULL,
|
||||
dt_arr timestamp without time zone NOT NULL,
|
||||
dt_dep timestamp without time zone NOT NULL,
|
||||
dt_arr timestamp without time zone NOT NULL,
|
||||
plс_of_dep varchar(2000) NOT NULL default 'Москва',
|
||||
plc_of_arr varchar(2000) NOT NULL,
|
||||
tpe varchar(9) NOT NULL
|
||||
CHECK(tpe = 'Скорый' OR tpe = 'Фирменный' OR tpe = 'Обычный'),
|
||||
|
||||
plс_of_dep varchar(2000) NOT NULL default 'Москва',
|
||||
plc_of_arr varchar(2000) NOT NULL,
|
||||
cnt_stops integer CHECK(cnt_stops > 0),
|
||||
|
||||
tpe varchar(9) NOT NULL
|
||||
CHECK(tpe = 'Скорый' OR tpe = 'Фирменный' OR tpe = 'Обычный'),
|
||||
|
||||
cnt_stops integer CHECK(cnt_stops > 0),
|
||||
|
||||
id_oper numeric(3) references countries(id) not null
|
||||
id_oper numeric(3) references countries(id) not null
|
||||
);
|
||||
|
||||
INSERT into countries
|
||||
VALUES
|
||||
(321, 'Россия');
|
||||
INSERT into countries VALUES
|
||||
(321, 'Россия');
|
||||
|
||||
INSERT into schedules
|
||||
VALUES(1, '1999-01-08 04:05:06',
|
||||
'1999-01-08 04:05:06', default, 'СПб', 'Скорый', 40, 321);
|
||||
INSERT into schedules VALUES
|
||||
(1, '1999-01-08 04:05:06', '1999-01-08 04:05:06', default, 'СПб', 'Скорый', 40, 321);
|
||||
|
||||
SELECT * FROM countries;
|
||||
SELECT * FROM schedules;
|
||||
|
||||
Reference in New Issue
Block a user