Skip to content

Commit 219ce70

Browse files
Improve documentation for DEFAULT column values
Signed-off-by: Ngoc Nguyen <[email protected]>
1 parent 8314eec commit 219ce70

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

docs/src/main/sphinx/connector/memory.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ CREATE TABLE example.default.nation AS
2525
SELECT * from tpch.tiny.nation;
2626
```
2727

28+
Create the table orders, adding a table comment, adding a column comment and a column with default value:
29+
30+
```
31+
CREATE TABLE IF NOT EXISTS orders (
32+
orderkey bigint,
33+
orderstatus varchar,
34+
totalprice double COMMENT 'Price in cents.',
35+
orderdate date,
36+
status varchar default 'created'
37+
)
38+
COMMENT 'A table to keep track of orders.'
39+
```
40+
2841
Insert data into a table in the Memory connector:
2942

3043
```

docs/src/main/sphinx/sql/alter-table.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ Add column `zip` to the `users` table:
9292
ALTER TABLE users ADD COLUMN zip varchar;
9393
```
9494

95+
Add column `zip` to the `users` table with default value as `90210`:
96+
97+
```
98+
ALTER TABLE users ADD COLUMN zip varchar DEFAULT '90210';
99+
```
100+
95101
Add column `zip` to the `users` table if table `users` exists and column `zip`
96102
not already exists:
97103

docs/src/main/sphinx/sql/create-table.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,15 @@ WITH (format = 'ORC')
7171
```
7272

7373
Create the table `orders` if it does not already exist, adding a table comment
74-
and a column comment:
74+
and a column comment and a column with default value:
7575

7676
```
7777
CREATE TABLE IF NOT EXISTS orders (
7878
orderkey bigint,
7979
orderstatus varchar,
8080
totalprice double COMMENT 'Price in cents.',
81-
orderdate date
81+
orderdate date,
82+
status varchar default 'created'
8283
)
8384
COMMENT 'A table to keep track of orders.'
8485
```

0 commit comments

Comments
 (0)