diff options
| author | Kamal Wickramanayake <kamal@inbox.lk> | 2026-04-26 11:44:44 +0530 |
|---|---|---|
| committer | Kamal Wickramanayake <kamal@inbox.lk> | 2026-04-26 11:44:44 +0530 |
| commit | fb5455828b4ca31355468b4866a80270b3c3e12d (patch) | |
| tree | 8dfa2bed312b660666e2a5e47962348faaa21b59 /database/postgresql/02-library | |
| parent | 59dfb39e99c603432d4ed83ff000b39433479d47 (diff) | |
Added library.sql
Diffstat (limited to 'database/postgresql/02-library')
| -rw-r--r-- | database/postgresql/02-library/library.sql | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/database/postgresql/02-library/library.sql b/database/postgresql/02-library/library.sql new file mode 100644 index 0000000..b104fbe --- /dev/null +++ b/database/postgresql/02-library/library.sql @@ -0,0 +1,29 @@ +drop table if exists borrowed_book; +drop table if exists book; +drop table if exists user_account; + +create table user_account ( + uid serial primary key, + username text unique not null, + name text, + password text +); + +insert into user_account (username, name) values ('kamal', 'Kamal Wickramanayake'); +insert into user_account (username, name) values ('tharindu', 'Tharindu Fernando'); + +create table book ( + bookid serial primary key, + name text, + author text +); + +insert into book (name, author) values ('Tasty Cooking', 'Bhagya Ratnayake'); +insert into book (name, author) values ('Smiling Kitty', 'Seema Farwin'); + + +create table borrowed_book ( + uid integer references user_account(uid) on delete restrict, + bookid integer references book(bookid) on delete restrict, + borrowed_time timestamp +); |
