Skip to content

Commit

Permalink
Make SQL example in README easy to copy
Browse files Browse the repository at this point in the history
  • Loading branch information
kezhuw committed Dec 12, 2024
1 parent 1848075 commit 8209d40
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,33 @@ SeamDB aims to be a computation cluster to seam existing services to provide dat

## Give it a try

```bash
docker run --rm -p 5432:5432 kezhuw/seamdb
```
docker run --rm -p 5432:5432 -d kezhuw/seamdb

Wait few seconds for seamdb to up.
```bash
docker run -it --rm jbergknoff/postgresql-client postgresql://host.docker.internal/db1
```

```sql
CREATE DATABASE db1;
```

```sql
CREATE TABLE table1 (id serial PRIMARY KEY, count bigint NOT NULL, price real NOT NULL, description text);
```

```sql
INSERT INTO table1 (count, price, description) VALUES (4, 15.6, NULL), (3, 7.8, 'NNNNNN'), (8, 3.4, 'a'), (8, 2.9, 'b');
```

```sql
SELECT id, count, price description FROM table1 ORDER BY count DESC, id ASC;
```

db1=> CREATE DATABASE db1;
db1=> CREATE TABLE table1 (id serial PRIMARY KEY, count bigint NOT NULL, price real NOT NULL, description text);
db1=> INSERT INTO table1 (count, price, description) VALUES (4, 15.6, NULL), (3, 7.8, 'NNNNNN'), (8, 3.4, 'a'), (8, 2.9, 'b');
db1=> SELECT id, count, price description FROM table1 ORDER BY count DESC, id ASC;
db1=> SELECT sum(count) AS count, max(price) AS max_price, min(price) AS min_price, sum(count*price) AS sales_amount from table1 ORDER BY max(price) DESC;
```sql
SELECT sum(count) AS count, max(price) AS max_price, min(price) AS min_price, sum(count*price) AS sales_amount from table1 ORDER BY max(price) DESC;
```

## Seaming services
Expand Down

0 comments on commit 8209d40

Please sign in to comment.