Skip to content

Commit

Permalink
Create datamart_ddl.sql
Browse files Browse the repository at this point in the history
DDL-запрос на создание витрины данных.
  • Loading branch information
KirillZhul committed May 28, 2023
1 parent 4442b03 commit a9fab0c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions datamart_ddl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE TABLE analysis.dm_rfm_segments (user_id int PRIMARY KEY,
recency int CHECK(recency > 0 AND recency <= 5),
frequency int CHECK(frequency > 0 AND recency <= 5),
monetary_value int CHECK(monetary_value > 0 AND monetary_value <= 5))

ALTER TABLE analysis.dm_rfm_segments ADD CONSTRAINT dm_rfm_segments_user_id_fkey FOREIGN KEY (user_id) REFERENCES production.users(id);

0 comments on commit a9fab0c

Please sign in to comment.