-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.sql
32 lines (27 loc) · 840 Bytes
/
script.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
-- Database: CalcDatabase
-- DROP DATABASE "CalcDatabase";
CREATE DATABASE "CalcDatabase"
WITH
OWNER = postgres
ENCODING = 'UTF8'
LC_COLLATE = 'ru_RU.UTF-8'
LC_CTYPE = 'ru_RU.UTF-8'
TABLESPACE = pg_default
CONNECTION LIMIT = -1;
CREATE TABLE users (
id BIGSERIAL NOT NULL PRIMARY KEY,
login text UNIQUE NOT NULL,
password text NOT NULL,
account_balance INTEGER NOT NULL
);
CREATE TABLE sessions (
id BIGSERIAL NOT NULL PRIMARY KEY,
user_id INTEGER REFERENCES users NOT NULL,
date timestamp without time zone NOT NULL,
expression text NOT NULL,
result_of_expression text NOT NULL
);
INSERT INTO users(login, password, account_balance)
VALUES ('belousotroll', 'pass', 15),
('gladkikh', 'daniil', 10),
('sappyk', 'sappyk', 5);