Skip to content

Commit b8b97d1

Browse files
committed
New docs on expressions and constants
1 parent d3f9c83 commit b8b97d1

22 files changed

+1472
-451
lines changed

_data/sidebar_doc.yml

Lines changed: 45 additions & 214 deletions
Original file line numberDiff line numberDiff line change
@@ -57,198 +57,62 @@ entries:
5757
url: /install-client-drivers.html
5858

5959
thirdlevel:
60-
- title: SQL Statements
60+
- title: Program SQL queries
6161
thirdlevelitems:
6262

63-
- title: Overview
64-
url: /sql-statements.html
65-
66-
- title: <code>ADD COLUMN</code>
67-
url: /add-column.html
68-
69-
- title: <code>ADD CONSTRAINT</code>
70-
url: /add-constraint.html
71-
72-
- title: <code>ALTER COLUMN</code>
73-
url: /alter-column.html
74-
75-
- title: <code>ALTER TABLE</code>
76-
url: /alter-table.html
77-
78-
- title: <code>ALTER VIEW</code>
79-
url: /alter-view.html
80-
81-
- title: <code>BEGIN</code>
82-
url: /begin-transaction.html
83-
84-
- title: <code>COMMIT</code>
85-
url: /commit-transaction.html
86-
87-
- title: <code>CREATE DATABASE</code>
88-
url: /create-database.html
89-
90-
- title: <code>CREATE INDEX</code>
91-
url: /create-index.html
92-
93-
- title: <code>CREATE TABLE</code>
94-
url: /create-table.html
95-
96-
- title: <code>CREATE TABLE AS</code>
97-
url: /create-table-as.html
98-
99-
- title: <code>CREATE USER</code>
100-
url: /create-user.html
101-
102-
- title: <code>CREATE VIEW</code>
103-
url: /create-view.html
104-
105-
- title: <code>DELETE</code>
106-
url: /delete.html
107-
108-
- title: <code>DROP COLUMN</code>
109-
url: /drop-column.html
110-
111-
- title: <code>DROP CONSTRAINT</code>
112-
url: /drop-constraint.html
113-
114-
- title: <code>DROP DATABASE</code>
115-
url: /drop-database.html
116-
117-
- title: <code>DROP INDEX</code>
118-
url: /drop-index.html
119-
120-
- title: <code>DROP TABLE</code>
121-
url: /drop-table.html
122-
123-
- title: <code>DROP VIEW</code>
124-
url: /drop-view.html
125-
126-
- title: <code>EXPLAIN</code>
127-
url: /explain.html
128-
129-
- title: <code>GRANT</code>
130-
url: /grant.html
131-
132-
- title: <code>INSERT</code>
133-
url: /insert.html
134-
135-
- title: <code>RENAME COLUMN</code>
136-
url: /rename-column.html
137-
138-
- title: <code>RENAME DATABASE</code>
139-
url: /rename-database.html
140-
141-
- title: <code>RENAME INDEX</code>
142-
url: /rename-index.html
143-
144-
- title: <code>RENAME TABLE</code>
145-
url: /rename-table.html
146-
147-
- title: <code>RELEASE SAVEPOINT</code>
148-
url: /release-savepoint.html
149-
150-
- title: <code>REVOKE</code>
151-
url: /revoke.html
152-
153-
- title: <code>ROLLBACK</code>
154-
url: /rollback-transaction.html
155-
156-
- title: <code>SAVEPOINT</code>
157-
url: /savepoint.html
158-
159-
- title: <code>SELECT</code>
160-
url: /select.html
161-
162-
- title: <code>SET DATABASE</code>
163-
url: /set-database.html
164-
165-
- title: <code>SET TIME ZONE</code>
166-
url: /set-time-zone.html
167-
168-
- title: <code>SET TRANSACTION</code>
169-
url: /set-transaction.html
170-
171-
- title: <code>SHOW ALL</code>
172-
url: /show-all.html
63+
- title: Query and Update Statements
64+
url: /sql-statements.html#query-and-update-statements
17365

174-
- title: <code>SHOW COLUMNS</code>
175-
url: /show-columns.html
66+
- title: Table Expressions
67+
url: /table-expressions.html
17668

177-
- title: <code>SHOW CONSTRAINTS</code>
178-
url: /show-constraints.html
69+
- title: Constant Values
70+
url: /sql-constants.html
17971

180-
- title: <code>SHOW CREATE TABLE</code>
181-
url: /show-create-table.html
72+
- title: Value Expressions
73+
url: /sql-expressions.html
18274

183-
- title: <code>SHOW CREATE VIEW</code>
184-
url: /show-create-view.html
75+
- title: Built-in Functions and Operators
76+
url: /functions-and-operators.html
18577

186-
- title: <code>SHOW DATABASE</code>
187-
url: /show-database.html
188-
189-
- title: <code>SHOW DATABASES</code>
190-
url: /show-databases.html
191-
192-
- title: <code>SHOW GRANTS</code>
193-
url: /show-grants.html
194-
195-
- title: <code>SHOW INDEX</code>
196-
url: /show-index.html
197-
198-
- title: <code>SHOW TABLES</code>
199-
url: /show-tables.html
200-
201-
- title: <code>SHOW TIME ZONE</code>
202-
url: /show-time-zone.html
203-
204-
- title: <code>SHOW TRANSACTION</code>
205-
url: /show-transaction.html
206-
207-
- title: <code>SHOW USERS</code>
208-
url: /show-users.html
209-
210-
- title: <code>TRUNCATE</code>
211-
url: /truncate.html
78+
- title: Data Types
79+
url: /data-types.html
21280

213-
- title: <code>UPDATE</code>
214-
url: /update.html
81+
- title: Information Schema
82+
url: /information-schema.html
21583

216-
- title: <code>UPSERT</code>
217-
url: /upsert.html
84+
- title: Keywords & Identifiers
85+
url: /keywords-and-identifiers.html
21886

219-
- title: SQL Grammar
220-
url: /sql-grammar.html
87+
- title: SQL Grammar
88+
url: /sql-grammar.html
22189

222-
thirdlevel:
223-
- title: Constraints
90+
- title: Use Transactions
22491
thirdlevelitems:
22592

22693
- title: Overview
227-
url: /constraints.html
94+
url: /transactions.html
22895

229-
- title: Check
230-
url: /check.html
96+
- title: Transaction Management Statements
97+
url: /sql-statements.html#transaction-management-statements
23198

232-
- title: Default Value
233-
url: /default-value.html
99+
- title: Automatic and Manual Retries
100+
url: /transactions.html#transaction-retries
234101

235-
- title: Foreign Keys
236-
url: /foreign-key.html
102+
- title: Priorities
103+
url: /transactions.html#transaction-priorities
237104

238-
- title: Not Null
239-
url: /not-null.html
240-
241-
- title: Primary Key
242-
url: /primary-key.html
243-
244-
- title: Unique
245-
url: /unique.html
105+
- title: Isolation Levels
106+
url: /transactions.html#isolation-levels
246107

247108
- title: Data Definition
248109
thirdlevelitems:
249110

250-
- title: Keywords & Identifiers
251-
url: /keywords-and-identifiers.html
111+
- title: Data Definition Statements
112+
url: /sql-statements.html#data-definition-statements
113+
114+
- title: Column Constraints
115+
url: /constraints.html
252116

253117
- title: Indexes
254118
url: /indexes.html
@@ -265,53 +129,20 @@ entries:
265129
- title: <code>NULL</code> Handling
266130
url: /null-handling.html
267131

268-
- title: Data Types
132+
- title: Information Schema
133+
url: /information-schema.html
134+
135+
- title: Privileges
269136
thirdlevelitems:
270137

271138
- title: Overview
272-
url: /data-types.html
273-
274-
- title: <code>INT</code>
275-
url: /int.html
276-
277-
- title: <code>SERIAL</code>
278-
url: /serial.html
279-
280-
- title: <code>DECIMAL</code>
281-
url: /decimal.html
282-
283-
- title: <code>FLOAT</code>
284-
url: /float.html
285-
286-
- title: <code>BOOL</code>
287-
url: /bool.html
139+
url: /privileges.html
288140

289-
- title: <code>DATE</code>
290-
url: /date.html
141+
- title: Privilege Management Statements
142+
url: /sql-statements.html#privilege-management-statements
291143

292-
- title: <code>TIMESTAMP</code>
293-
url: /timestamp.html
294-
295-
- title: <code>INTERVAL</code>
296-
url: /interval.html
297-
298-
- title: <code>STRING</code>
299-
url: /string.html
300-
301-
- title: <code>BYTES</code>
302-
url: /bytes.html
303-
304-
- title: Privileges
305-
url: /privileges.html
306-
307-
- title: Functions and Operators
308-
url: /functions-and-operators.html
309-
310-
- title: Transactions
311-
url: /transactions.html
312-
313-
- title: Information Schema
314-
url: /information-schema.html
144+
- title: Create and Manage Users
145+
url: /create-and-manage-users.html
315146

316147
- title: Deploy
317148
items:
@@ -346,7 +177,7 @@ entries:
346177

347178
- title: Overview
348179
url: /orchestration.html
349-
180+
350181
- title: Kubernetes
351182
url: /orchestrate-cockroachdb-with-kubernetes.html
352183

@@ -425,7 +256,7 @@ entries:
425256

426257
- title: SQL
427258
url: /sql.html
428-
259+
429260
- title: Distributed Transactions
430261
url: /distributed-transactions.html
431262

bool.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,29 @@ summary: The BOOL data type stores Boolean values of false or true.
44
toc: false
55
---
66

7-
The `BOOL` [data type](data-types.html) stores a Boolean value of `false` or `true`.
7+
The `BOOL` [data type](data-types.html) stores a Boolean value of `false` or `true`.
88

99
<div id="toc"></div>
1010

1111
## Aliases
1212

13-
In CockroachDB, `BOOLEAN` is an alias for `BOOL`.
13+
In CockroachDB, `BOOLEAN` is an alias for `BOOL`.
1414

15-
## Format
15+
## Syntax
1616

17-
When inserting into a `BOOL` column, format the value as `false` or `true` (case-insensitive).
17+
There are two predefined
18+
[named constants](sql-constants.html#named-constants) for `BOOL`:
19+
`TRUE` and `FALSE` (the names are case-insensitive).
1820

19-
Alternately, you can cast `0` or `1` as a `BOOL`:
21+
Alternately, a boolean value can be obtained by coercing a numeric
22+
value: zero is coerced to `FALSE`, and any non-zero value to `TRUE`.
2023

2124
- `CAST(0 AS BOOL)` (false)
22-
- `CAST(1 AS BOOL)` (true)
25+
- `CAST(123 AS BOOL)` (true)
2326

2427
## Size
2528

26-
A `BOOL` value is 1 byte in width, but the total storage size is likely to be larger due to CockroachDB metadata.
29+
A `BOOL` value is 1 byte in width, but the total storage size is likely to be larger due to CockroachDB metadata.
2730

2831
## Examples
2932

@@ -69,4 +72,4 @@ Type | Details
6972

7073
## See Also
7174

72-
[Data Types](data-types.html)
75+
[Data Types](data-types.html)

0 commit comments

Comments
 (0)