Merge lp:~drizzle-developers/drizzle/major-docs-cleanup into lp:drizzle
- major-docs-cleanup
- Merge into 7.2
Proposed by
Henrik Ingo
Status: | Merged |
---|---|
Merge reported by: | Brian Aker |
Merged at revision: | not available |
Proposed branch: | lp:~drizzle-developers/drizzle/major-docs-cleanup |
Merge into: | lp:drizzle |
Diff against target: |
2830 lines (+153/-1799) 44 files modified
docs/alter_schema.rst (+1/-6) docs/alter_table.rst (+1/-13) docs/commit.rst (+1/-42) docs/create_index.rst (+1/-12) docs/create_schema.rst (+4/-3) docs/create_table.rst (+1/-2) docs/ddl.rst (+2/-2) docs/delete.rst (+1/-7) docs/distinct.rst (+2/-32) docs/dml.rst (+1/-1) docs/drop_index.rst (+1/-5) docs/flush.rst (+6/-6) docs/functions/aggregatefunctions.rst (+10/-105) docs/functions/control_flow.rst (+1/-77) docs/functions/current_time_functions.rst (+1/-78) docs/functions/date_trunc.rst (+1/-27) docs/functions/datetime.rst (+3/-36) docs/functions/extract_date_functions.rst (+1/-150) docs/functions/logical.rst (+2/-193) docs/functions/overview.rst (+1/-1) docs/functions/string.rst (+52/-49) docs/functions/string/comparative.rst (+6/-47) docs/functions/string/conversion.rst (+4/-90) docs/functions/string/length.rst (+3/-18) docs/functions/string/modification.rst (+1/-114) docs/functions/string/other.rst (+14/-59) docs/functions/string/position.rst (+2/-111) docs/groupby.rst (+2/-78) docs/having.rst (+2/-58) docs/insert.rst (+1/-34) docs/join.rst (+1/-54) docs/load_data_infile.rst (+1/-36) docs/orderby.rst (+2/-47) docs/queries.rst (+3/-12) docs/rename.rst (+2/-12) docs/resources/ascii_chart.rst (+1/-100) docs/savepoints.rst (+3/-3) docs/start_transaction.rst (+1/-1) docs/string_data_types.rst (+4/-5) docs/tables.rst (+1/-11) docs/transactional.rst (+1/-1) docs/update.rst (+1/-17) docs/uuid_data_type.rst (+1/-11) docs/where.rst (+2/-33) |
To merge this branch: | bzr merge lp:~drizzle-developers/drizzle/major-docs-cleanup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Trunk | Pending | ||
Review via email: mp+110974@code.launchpad.net |
Commit message
Description of the change
Removing most of what Marisa wrote for the manual, as discussed on Drizzle Day. Marking the missing parts with 'TODO'. Someone else than me needs to rewrite the missing parts. See commit message for details.
Unfortunately we need to push this to trunk (and the published manual) now. Hopefully someone can get some basic content back in soon.
This also needs to be backported to 7.1 and 7.0.
To post a comment you must log in.
Revision history for this message
Brian Aker (brianaker) wrote : | # |
Revision history for this message
Brian Aker (brianaker) wrote : | # |
And it does :)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'docs/alter_schema.rst' |
2 | --- docs/alter_schema.rst 2011-11-06 00:00:03 +0000 |
3 | +++ docs/alter_schema.rst 2012-06-19 08:53:18 +0000 |
4 | @@ -1,12 +1,7 @@ |
5 | ALTER SCHEMA |
6 | ============ |
7 | |
8 | -ALTER SCHEMA changes the definition of a schema. |
9 | - |
10 | -You must own the schema to use ALTER SCHEMA. To rename a schema you |
11 | -must also have the CREATE privilege for the database. To alter the |
12 | -owner, you must also be a direct or indirect member of the new owning |
13 | -role, and you must have the CREATE privilege for the database: |
14 | +'TODO' |
15 | |
16 | .. code-block:: mysql |
17 | |
18 | |
19 | === modified file 'docs/alter_table.rst' |
20 | --- docs/alter_table.rst 2011-02-13 20:11:55 +0000 |
21 | +++ docs/alter_table.rst 2012-06-19 08:53:18 +0000 |
22 | @@ -1,16 +1,4 @@ |
23 | ALTER TABLE |
24 | =========== |
25 | |
26 | -An ALTER statement modifies the definition (structure) of a table inside Drizzle. |
27 | -The types of objects that can be altered depends on which RDBMS is being used. |
28 | - |
29 | -The ALTER TABLE statement is used to change a table definition by: |
30 | - |
31 | -1) Adding, dropping, modifying table columns |
32 | -2) Adding and dropping constraints |
33 | -3) Enabling and Disabling constraints |
34 | -4) Rename a table |
35 | - |
36 | -.. todo:: |
37 | - |
38 | - add something about current implementation: i.e. write blocking copying alter table. |
39 | +'TODO' |
40 | \ No newline at end of file |
41 | |
42 | === modified file 'docs/commit.rst' |
43 | --- docs/commit.rst 2011-03-08 03:47:42 +0000 |
44 | +++ docs/commit.rst 2012-06-19 08:53:18 +0000 |
45 | @@ -3,45 +3,4 @@ |
46 | |
47 | COMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE] |
48 | |
49 | -Calling COMMIT will cause the current transaction to save itself. |
50 | - |
51 | -A COMMIT statement ends a transaction within Drizzle and makes all |
52 | -changes visible to other users. The order of events is typically to |
53 | -issue a START TRANSACTION statement, execute one or more SQL |
54 | -statements, and then issue a COMMIT statement. Alternatively, a |
55 | -ROLLBACK statement can be issued, which undoes all the work performed |
56 | -since START TRANSACTION was issued. A COMMIT statement will also |
57 | -release any existing savepoints that may be in use. |
58 | - |
59 | -For example, DML statements do not implicitly commit the current |
60 | -transaction. If a user's DML statements have been used to update some |
61 | -data objects, and the updates need to be permanently recorded in the |
62 | -database, you can use the COMMIT command. |
63 | - |
64 | -An example: |
65 | - |
66 | -.. code-block:: mysql |
67 | - |
68 | - START TRANSACTION; |
69 | - |
70 | - INSERT INTO popular_sites (url, id) |
71 | - VALUES ('flickr.com', 07); |
72 | - |
73 | - INSERT INTO popular_sites (url, id) |
74 | - VALUES ('twitter.com', 10); |
75 | - |
76 | - SELECT * FROM popular_sites; |
77 | - |
78 | -+-----+---------------+-------+---------------------+ |
79 | -| id | url | notes | accessed | |
80 | -+=====+===============+=======+=====================+ |
81 | -| 07 | flickr.com | NULL | 2011-02-03 08:33:31 | |
82 | -+-----+---------------+-------+---------------------+ |
83 | -| 10 | twitter.com | NULL | 2011-02-03 08:39:16 | |
84 | -+-----+---------------+-------+---------------------+ |
85 | - |
86 | -Then to save the information just inserted, simply issue the COMMIT command: |
87 | - |
88 | -.. code-block:: mysql |
89 | - |
90 | - COMMIT; |
91 | +'TODO' |
92 | \ No newline at end of file |
93 | |
94 | === modified file 'docs/create_index.rst' |
95 | --- docs/create_index.rst 2011-03-08 03:47:42 +0000 |
96 | +++ docs/create_index.rst 2012-06-19 08:53:18 +0000 |
97 | @@ -5,15 +5,4 @@ |
98 | |
99 | CREATE [UNIQUE] INDEX index_name [USING {BTREE | HASH}] ON table_name (column_name [length] [ASC | DESC], ...); |
100 | |
101 | -An example: |
102 | - |
103 | -.. code-block:: mysql |
104 | - |
105 | - CREATE INDEX table_1_index ON table_1 (a,b); |
106 | - |
107 | -This would create an index on table_t named table_1_index that converged |
108 | -columns a and b. |
109 | - |
110 | -Fast index creation (where a storage engine can create or drop indexes |
111 | -without copying and rebuilding the contents of the entire table) is |
112 | -not implemented yet for Drizzle, but it is slated for the future. |
113 | +'TODO' |
114 | \ No newline at end of file |
115 | |
116 | === modified file 'docs/create_schema.rst' |
117 | --- docs/create_schema.rst 2011-07-13 02:17:59 +0000 |
118 | +++ docs/create_schema.rst 2012-06-19 08:53:18 +0000 |
119 | @@ -1,7 +1,8 @@ |
120 | CREATE SCHEMA |
121 | ============== |
122 | |
123 | -CREATE SCHEMA enters a new schema into the current database. The schema name used must be distinct from the name of any existing schema. |
124 | +TODO |
125 | + |
126 | |
127 | .. code-block:: mysql |
128 | |
129 | @@ -11,7 +12,7 @@ |
130 | engine_options |
131 | -------------- |
132 | |
133 | -You can specify the storage engine to use for creating the schema. Please note, there is currently only one engine. |
134 | +TODO |
135 | |
136 | :: |
137 | |
138 | @@ -20,7 +21,7 @@ |
139 | collate |
140 | ------- |
141 | |
142 | -There are default settings for character sets and collations at four levels: server, database, table, and column. The COLLATE clause specifies the default database collation. |
143 | +TODO |
144 | |
145 | :: |
146 | |
147 | |
148 | === modified file 'docs/create_table.rst' |
149 | --- docs/create_table.rst 2011-07-13 02:17:59 +0000 |
150 | +++ docs/create_table.rst 2012-06-19 08:53:18 +0000 |
151 | @@ -1,8 +1,7 @@ |
152 | CREATE TABLE |
153 | ============ |
154 | |
155 | -A CREATE statement in SQL creates an object inside of Drizzle. One of |
156 | -the most common CREATE commands is the CREATE TABLE command. |
157 | +'TODO' |
158 | |
159 | .. code-block:: mysql |
160 | |
161 | |
162 | === modified file 'docs/ddl.rst' |
163 | --- docs/ddl.rst 2010-12-04 02:38:29 +0000 |
164 | +++ docs/ddl.rst 2012-06-19 08:53:18 +0000 |
165 | @@ -1,7 +1,7 @@ |
166 | -Data Description Language |
167 | +Data Definition Language |
168 | ========================= |
169 | |
170 | -The Data Definition Language (DDL) is used to define data and their relationships to other data. It is primarily used to create and destroy databases and database objects. |
171 | +'TODO' |
172 | |
173 | .. toctree:: |
174 | :maxdepth: 2 |
175 | |
176 | === modified file 'docs/delete.rst' |
177 | --- docs/delete.rst 2011-02-23 13:08:09 +0000 |
178 | +++ docs/delete.rst 2012-06-19 08:53:18 +0000 |
179 | @@ -1,10 +1,4 @@ |
180 | Deleting Data |
181 | ============= |
182 | |
183 | -In Drizzle you can make use of DELETE in order to delete a single record (or multiple records) of data from a table. |
184 | - |
185 | -A typical query might be: |
186 | - |
187 | -.. code-block:: mysql |
188 | - |
189 | - DELETE FROM table_1; |
190 | +'TODO' |
191 | \ No newline at end of file |
192 | |
193 | === modified file 'docs/distinct.rst' |
194 | --- docs/distinct.rst 2011-10-23 16:01:37 +0000 |
195 | +++ docs/distinct.rst 2012-06-19 08:53:18 +0000 |
196 | @@ -1,9 +1,7 @@ |
197 | DISTINCT |
198 | ======== |
199 | |
200 | -In a table, columns may contain more than one of the same value. |
201 | - |
202 | -Sometimes it's helpful to list only the different, distinct values in a table; in this case the DISTINCT keyword can be used. |
203 | +'TODO' |
204 | |
205 | SQL SELECT DISTINCT Syntax: |
206 | |
207 | @@ -12,32 +10,4 @@ |
208 | SELECT DISTINCT column_name(s) |
209 | FROM table_name |
210 | |
211 | -**SELECT DISTINCT Example** |
212 | - |
213 | -The "Persons" table: |
214 | - |
215 | -+---------+------------+----------+----------+--------+ |
216 | -|Id |LastName |FirstName |Address | City | |
217 | -+=========+============+==========+==========+========+ |
218 | -| 1 | Larson | Sue |3 Cherry | Chicago| |
219 | -+---------+------------+----------+----------+--------+ |
220 | -| 2 | Roberts | Teri |21 Brown | Chicago| |
221 | -+---------+------------+----------+----------+--------+ |
222 | -| 3 | Peterson | Kari |30 Mell | Reno | |
223 | -+---------+------------+----------+----------+--------+ |
224 | - |
225 | -In order to select distinct values from the column named "City" from the table above, use the following SELECT statement: |
226 | - |
227 | -.. code-block:: mysql |
228 | - |
229 | - SELECT DISTINCT City FROM Persons; |
230 | - |
231 | -The result-set will look like this: |
232 | - |
233 | -+--------+ |
234 | -|City | |
235 | -+========+ |
236 | -|Chicago | |
237 | -+--------+ |
238 | -|Reno | |
239 | -+--------+ |
240 | +'TODO' |
241 | \ No newline at end of file |
242 | |
243 | === modified file 'docs/dml.rst' |
244 | --- docs/dml.rst 2011-03-17 16:33:45 +0000 |
245 | +++ docs/dml.rst 2012-06-19 08:53:18 +0000 |
246 | @@ -1,7 +1,7 @@ |
247 | Data Manipulation Language |
248 | ========================== |
249 | |
250 | -The Data Manipulation Language (DML) is made up of SQL statements that modify stored data but not the database schema or database objects. Each SQL DML statement is a declarative command, rather than imperative. |
251 | +'TODO' |
252 | |
253 | .. toctree:: |
254 | :maxdepth: 2 |
255 | |
256 | === modified file 'docs/drop_index.rst' |
257 | --- docs/drop_index.rst 2011-02-23 13:08:09 +0000 |
258 | +++ docs/drop_index.rst 2012-06-19 08:53:18 +0000 |
259 | @@ -1,10 +1,6 @@ |
260 | DROP INDEX |
261 | ============ |
262 | |
263 | -This drops a given index on the named table. |
264 | - |
265 | -.. code-block:: mysql |
266 | - |
267 | - DROP INDEX table_1_index ON table_1; |
268 | +'TODO' |
269 | |
270 | Drizzle does not currently support fast drop index. |
271 | |
272 | === modified file 'docs/flush.rst' |
273 | --- docs/flush.rst 2011-02-23 14:17:23 +0000 |
274 | +++ docs/flush.rst 2012-06-19 08:53:18 +0000 |
275 | @@ -1,7 +1,7 @@ |
276 | FLUSH |
277 | ===== |
278 | |
279 | -The FLUSH statement clears or reloads different internal caches. One variant acquires a lock. |
280 | +'TODO' |
281 | |
282 | .. code-block:: mysql |
283 | |
284 | @@ -12,18 +12,18 @@ |
285 | |
286 | * TABLES table_name [, table_name] |
287 | |
288 | -(closes all specified tables, forces those tables in use to be closed, and flushes the query cache for the named tables) |
289 | +'TODO' |
290 | |
291 | * TABLES WITH READ LOCK |
292 | |
293 | -(closes all open tables and locks all tables for all databases with a global read lock*) |
294 | +'TODO' |
295 | |
296 | * LOGS |
297 | |
298 | -(closes and reopens all log files--if binary logging is enabled, the sequence number of the binary log file is incremented by one relative to the previous file) |
299 | +'TODO' |
300 | |
301 | * STATUS |
302 | |
303 | -(adds the current thread's session status variable values to the global values and resets the session values to zero) |
304 | +'TODO' |
305 | |
306 | -To release a FLUSH TABLES WITH READ LOCK, you must issue an UNLOCK TABLES. |
307 | +'TODO' (how to release a lock) |
308 | |
309 | === modified file 'docs/functions/aggregatefunctions.rst' |
310 | --- docs/functions/aggregatefunctions.rst 2011-02-28 14:09:50 +0000 |
311 | +++ docs/functions/aggregatefunctions.rst 2012-06-19 08:53:18 +0000 |
312 | @@ -1,27 +1,20 @@ |
313 | Aggregate Functions |
314 | =================== |
315 | |
316 | -SQL group (aggregate) functions operate on sets of values. If you use an aggregate function in a statement containing no GROUP BY clause, it is equivalent to grouping on all rows. |
317 | - |
318 | -General syntax for aggregate functions is: |
319 | - |
320 | -.. code-block:: mysql |
321 | - |
322 | - SELECT "function type" ("column_name") |
323 | - FROM "table_name"; |
324 | +'TODO' |
325 | |
326 | The following are examples of aggregate functions: |
327 | |
328 | -:ref:`avg`: Return the average value of the argument. (Does not work with temporal values unless first converted to numeric values.) |
329 | +:ref:`avg`: 'TODO' |
330 | |
331 | :ref:`count` |
332 | -(DISTINCT): Return the count of a number of different values |
333 | +(DISTINCT): 'TODO' |
334 | |
335 | -:ref:`count`: Return a count of the number of rows returned |
336 | +:ref:`count`: 'TODO' |
337 | |
338 | -:ref:`group_concat`: Return a concatenated string |
339 | +:ref:`group_concat`: 'TODO' |
340 | |
341 | -:ref:`max`: Return the maximum or minim values |
342 | +:ref:`max`: 'TODO' |
343 | |
344 | |
345 | .. _avg: |
346 | @@ -29,113 +22,25 @@ |
347 | AVG |
348 | --- |
349 | |
350 | -The AVG function returns the average value for the specified column in a table. To find the average session time for users and GROUP BY last_name: |
351 | - |
352 | -.. code-block:: mysql |
353 | - |
354 | - SELECT last_name, AVG(session_length) |
355 | - -> FROM session_details GROUP BY last_name; |
356 | - |
357 | -AVG() returns NULL if there are no matching rows. |
358 | - |
359 | +'TODO' |
360 | |
361 | .. _count: |
362 | |
363 | COUNT |
364 | ----- |
365 | |
366 | -Take the following "Nodes" table, where 'nodes' are user-contributed content: |
367 | - |
368 | -+--------+-------------------+------------+----------------+-------------------+ |
369 | -|NodeID |ContributionDate |NodeSize |NodePopularity |UserName | |
370 | -+========+===================+============+================+===================+ |
371 | -|1 |12/22/2010 |160 |2 |Smith | |
372 | -+--------+-------------------+------------+----------------+-------------------+ |
373 | -|2 |08/10/2010 |190 |2 |Johnson | |
374 | -+--------+-------------------+------------+----------------+-------------------+ |
375 | -|3 |07/13/2010 |500 |5 |Baldwin | |
376 | -+--------+-------------------+------------+----------------+-------------------+ |
377 | -|4 |07/15/2010 |420 |2 |Smith | |
378 | -+--------+-------------------+------------+----------------+-------------------+ |
379 | -|5 |12/22/2010 |1000 |4 |Wood | |
380 | -+--------+-------------------+------------+----------------+-------------------+ |
381 | -|6 |10/2/2010 |820 |4 |Smith | |
382 | -+--------+-------------------+------------+----------------+-------------------+ |
383 | - |
384 | -The SQL COUNT function returns the number of rows in a table satisfying the criteria specified in the WHERE clause. If we want to count the number of nodes made by user Smith, we will use the following SQL COUNT expression: |
385 | - |
386 | -.. code-block:: mysql |
387 | - |
388 | - SELECT COUNT * FROM Nodes |
389 | - WHERE UserName = "Smith"; |
390 | - |
391 | -In the above statement, the COUNT keyword returns the number 3, because the user Smith has 3 total nodes. |
392 | - |
393 | -If you don't specify a WHERE clause when using the COUNT keyword, your statement will simply return the total number of rows in the table, which would be 6 in this example: |
394 | - |
395 | -.. code-block:: mysql |
396 | - |
397 | - SELECT COUNT * FROM Nodes; |
398 | - |
399 | +'TODO' |
400 | |
401 | .. _group_concat: |
402 | |
403 | GROUP CONCAT |
404 | ------------- |
405 | |
406 | -GROUP_CONCAT returns a string result with the concatenated non-NULL values from a group. |
407 | - |
408 | -For example, without GROUP_CONCAT, this query: |
409 | - |
410 | -.. code-block:: mysql |
411 | - |
412 | - SELECT id,client_id FROM services WHERE id = 3; |
413 | - |
414 | -Returns: |
415 | - |
416 | -+----+-----------+ |
417 | -| id | client_id | |
418 | -+====+===========+ |
419 | -| 3 | 7 | |
420 | -+----+-----------+ |
421 | -| 3 | 8 | |
422 | -+----+-----------+ |
423 | -| 3 | 9 | |
424 | -+----+-----------+ |
425 | - |
426 | -But using GROUP_CONCAT in an alternate query: |
427 | - |
428 | -.. code-block:: mysql |
429 | - |
430 | - SELECT id,GROUP_CONCAT(client_id) FROM services WHERE id = 3 GROUP BY id; |
431 | - |
432 | -Will return: |
433 | - |
434 | -+----+-------------------------+ |
435 | -| id | GROUP_CONCAT(client_id) | |
436 | -+====+=========================+ |
437 | -| 3 | 7,8,9 | |
438 | -+----+-------------------------+ |
439 | - |
440 | +'TODO' |
441 | |
442 | .. _max: |
443 | |
444 | MAX and MIN |
445 | ------------ |
446 | |
447 | -MAX returns the maximum value in a group. In cases where MAX is passed a string argument, it will return the maximum string value. |
448 | - |
449 | -MIN returns the minimum value of a group. Like MAX, MIN returns the minimum string value string value. |
450 | - |
451 | -MAX and MIN return NULL if there are no matching rows. |
452 | - |
453 | -.. code-block:: mysql |
454 | - |
455 | - SELECT product_id, MIN(price), MAX(price) |
456 | - FROM inventory |
457 | - GROUP BY product_id; |
458 | - |
459 | -.. note:: |
460 | - |
461 | - For ``ENUM`` columns :program:`Drizzle` uses the highest and lowest string |
462 | - values for ``MIN`` and ``MAX`` rather than relative position. |
463 | +'TODO' |
464 | \ No newline at end of file |
465 | |
466 | === modified file 'docs/functions/control_flow.rst' |
467 | --- docs/functions/control_flow.rst 2011-09-15 13:23:48 +0000 |
468 | +++ docs/functions/control_flow.rst 2012-06-19 08:53:18 +0000 |
469 | @@ -1,80 +1,4 @@ |
470 | Control Flow Functions |
471 | ====================== |
472 | |
473 | -There are four control flow functions: |
474 | - |
475 | -* CASE |
476 | -* IF/ELSE |
477 | -* IFNULL |
478 | -* NULLIF |
479 | - |
480 | -Control flow functions return a value for each row processed, which represents the result of the comparison or condition specified. They can be used in ``SELECT``, ``WHERE``, ``ORDER BY``, and ``GROUP BY`` statements. |
481 | - |
482 | -CASE |
483 | ----- |
484 | - |
485 | -There are two basic examples of the ``CASE`` statment: |
486 | - |
487 | - 1. :: |
488 | - |
489 | - CASE value WHEN [compare_value] THEN result [WHEN [compare_value] THEN result ...] [ELSE result] END |
490 | - |
491 | -In this version, result is returned when value is equal to compare_value. If nothing is matched, the result after ``ELSE`` is returned, or ``NULL`` is returned if there is no ``ELSE`` part. |
492 | - |
493 | - 2. :: |
494 | - |
495 | - CASE WHEN [condition] THEN result [WHEN [condition] THEN result ...] [ELSE result] END |
496 | - |
497 | -In this version, if [condition] is true, result is returned. If nothing is matched, the result after ``ELSE`` is returned, or ``NULL`` is returned if there is no ``ELSE`` part. |
498 | - |
499 | -When [condition] is for equal comparison (=), this example syntax returns the same result as the first example. |
500 | - |
501 | -IF/ELSE |
502 | ---------- |
503 | - |
504 | -This type of control flow function checks IF a condition is satisfied (i.e. the Boolean expression returns TRUE), the IF SQL statement will execute. IF the condition is not satisfied (i.e. the Boolean expression returns FALSE), the ELSE SQL statement is executed. |
505 | - |
506 | -Syntax for IF/ELSE: :: |
507 | - |
508 | - IF ( Boolean_expression ) |
509 | - BEGIN |
510 | - SQL statement |
511 | - END |
512 | - ELSE |
513 | - BEGIN |
514 | - SQL statement |
515 | - END |
516 | - |
517 | - |
518 | -IFNULL |
519 | -------- |
520 | - |
521 | -Given IFNULL(arg1,arg2), if arg1 is not NULL, IFNULL() returns arg1; it otherwise returns arg2. IFNULL() returns a numeric or string value, depending on how it's used. |
522 | - |
523 | -.. code-block:: mysql |
524 | - |
525 | - SELECT IFNULL(2,0); |
526 | - -> 2 |
527 | - |
528 | - SELECT IFNULL(NULL,1); |
529 | - -> 1 |
530 | - |
531 | - SELECT IFNULL(1/0,10); |
532 | - -> 10 |
533 | - |
534 | - SELECT IFNULL(1/0,'yes'); |
535 | - -> 'yes' |
536 | - |
537 | -NULLIF |
538 | -------- |
539 | - |
540 | -NULLIF(arg1,arg2) returns NULL if arg1 = arg2 is true, otherwise returns arg1. |
541 | - |
542 | -.. code-block:: mysql |
543 | - |
544 | - SELECT NULLIF(1,1); |
545 | - -> NULL |
546 | - |
547 | - SELECT NULLIF(1,2); |
548 | - -> 1 |
549 | - |
550 | +'TODO' |
551 | |
552 | === modified file 'docs/functions/current_time_functions.rst' |
553 | --- docs/functions/current_time_functions.rst 2012-03-06 00:19:38 +0000 |
554 | +++ docs/functions/current_time_functions.rst 2012-06-19 08:53:18 +0000 |
555 | @@ -1,81 +1,4 @@ |
556 | CURRENT TIME FUNCTIONS |
557 | ======================= |
558 | |
559 | - |
560 | -current_date |
561 | -------------- |
562 | - |
563 | -Returns the current date as a value in 'YYYY-MM-DD' or YYYYMMDD format, depending on whether the function is used in a string or numeric context. |
564 | - |
565 | -.. code-block:: mysql |
566 | - |
567 | - SELECT CURDATE(); |
568 | - -> '2011-02-13' |
569 | - SELECT CURDATE() + 0; |
570 | - -> 20110213 |
571 | - |
572 | -.. _now: |
573 | - |
574 | -now() |
575 | ------- |
576 | - |
577 | -NOW returns the current date and time. The return value will be expressed as 'YYYY-MM-DD HH:MM:SS:mmmmmm' or YYYYMMDDHHMMSS.uuuuuu, depending on whether the function is used in a string or numeric context. The value is expressed in the current time zone (Drizzle timezone is always UTC). |
578 | - |
579 | -.. code-block:: mysql |
580 | - |
581 | - SELECT NOW(); |
582 | - -> '2011-02-15 13:40:06:002203' |
583 | - SELECT NOW() + 0; |
584 | - -> 20110215134006.002203 |
585 | - |
586 | -NOW returns a constant time that indicates the time at which the statement began to execute. |
587 | - |
588 | -.. code-block:: mysql |
589 | - |
590 | - SELECT NOW(), SLEEP(2), NOW(); |
591 | - |
592 | -Returns: |
593 | - |
594 | -+----------------------------+----------+----------------------------+ |
595 | -| NOW() | SLEEP(2) | NOW() | |
596 | -+============================+==========+============================+ |
597 | -| 2011-02-20 20:15:09:002203 | 0 | 2011-02-20 20:15:09:002203 | |
598 | -+----------------------------+----------+----------------------------+ |
599 | - |
600 | -SYSDATE, however, returns the exact time at which the function was invoked. |
601 | - |
602 | -.. code-block:: mysql |
603 | - |
604 | - SELECT SYSDATE(), SLEEP(2), SYSDATE(); |
605 | - |
606 | -Returns: |
607 | - |
608 | -+---------------------+----------+---------------------+ |
609 | -| SYSDATE() | SLEEP(2) | SYSDATE() | |
610 | -+=====================+==========+=====================+ |
611 | -| 2011-02-20 20:15:09 | 0 | 2011-02-20 20:15:11 | |
612 | -+---------------------+----------+---------------------+ |
613 | - |
614 | -When using replication, the binary log will include SET TIMESTAMP entries so that a database can be restored from the binary log. In doing this, values from NOW will be adjusted to the same times as when the original SQL statements were executed. SYSDATE entries will be unaffected by SET TIMESTAMP entries. |
615 | - |
616 | -current_timestamp |
617 | ------------------- |
618 | - |
619 | -See :ref:`now` |
620 | - |
621 | -CURRENT_TIMESTAMP() is a synonym for NOW(). |
622 | - |
623 | -localtime |
624 | ------------ |
625 | - |
626 | -See :ref:`now` |
627 | - |
628 | -LOCALTIME() is a synonym for NOW(). |
629 | - |
630 | -localtimestamp |
631 | ---------------- |
632 | - |
633 | -See :ref:`now` |
634 | - |
635 | -LOCALTIMESTAMP() is a synonym for NOW(). |
636 | - |
637 | +'TODO' |
638 | \ No newline at end of file |
639 | |
640 | === modified file 'docs/functions/date_trunc.rst' |
641 | --- docs/functions/date_trunc.rst 2011-03-11 15:54:41 +0000 |
642 | +++ docs/functions/date_trunc.rst 2012-06-19 08:53:18 +0000 |
643 | @@ -1,30 +1,4 @@ |
644 | DATE TRUNC |
645 | =========== |
646 | |
647 | -DATE_TRUNC truncates a date to a specified precision. The idea is similar to the trunc function for numbers. |
648 | - |
649 | -The syntax is: date_trunc(text, source) |
650 | - |
651 | -Valid values for *text* are: |
652 | - |
653 | -* microseconds |
654 | -* milliseconds |
655 | -* second |
656 | -* minute |
657 | -* hour |
658 | -* day |
659 | -* week |
660 | -* month |
661 | -* quarter |
662 | -* year |
663 | -* decade |
664 | -* century |
665 | -* millennium |
666 | - |
667 | -In this example, 'source' is a TIMESTAMP value with microsecond precision: |
668 | - |
669 | -.. code-block:: mysql |
670 | - |
671 | - date_trunc('hour', timestamp '2011-02-26 10:35:44:712005') |
672 | - |
673 | -Returns: 2011-02-26 10:00:00 |
674 | +'TODO' |
675 | \ No newline at end of file |
676 | |
677 | === modified file 'docs/functions/datetime.rst' |
678 | --- docs/functions/datetime.rst 2012-03-23 21:25:52 +0000 |
679 | +++ docs/functions/datetime.rst 2012-06-19 08:53:18 +0000 |
680 | @@ -13,21 +13,7 @@ |
681 | |
682 | For examples of the following, see :doc:`current_time_functions`. |
683 | |
684 | -+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+ |
685 | -|Name |Return Type |Description | |
686 | -+===================================+=====================================+=================================================================+ |
687 | -|current_date |date |Current date | |
688 | -+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+ |
689 | -|current_timestamp |timestamp with time zone* |Current date and time (start of current transaction) | |
690 | -+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+ |
691 | -|localtime |time |Current time of day | |
692 | -+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+ |
693 | -|localtimestamp |timestamp |Current date and time (start of current transaction) | |
694 | -+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+ |
695 | -|now() |timestamp with time zone* |Current date and time (start of current transaction) | |
696 | -+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+ |
697 | -|statement_timestamp() |timestamp with time zone* |Current date and time (start of current statement) | |
698 | -+-----------------------------------+-------------------------------------+-----------------------------------------------------------------+ |
699 | +'TODO' |
700 | |
701 | Drizzle timezone is always UTC. |
702 | |
703 | @@ -36,17 +22,7 @@ |
704 | |
705 | For examples of the following, see :doc:`extract_date_functions`. |
706 | |
707 | -+--------------------------------+-----------------------+---------------------------------------+ |
708 | -|Name |Return Type |Description | |
709 | -+================================+=======================+=======================================+ |
710 | -|extract(field from timestamp) |double precision |Get subfield | |
711 | -+--------------------------------+-----------------------+---------------------------------------+ |
712 | -|extract(field from interval) |double precision |Get subfield | |
713 | -+--------------------------------+-----------------------+---------------------------------------+ |
714 | -|date_part(text, timestamp) |double precision |Get subfield (equivalent to extract) | |
715 | -+--------------------------------+-----------------------+---------------------------------------+ |
716 | -|date_part(text, interval) |double precision |Get subfield (equivalent to extract) | |
717 | -+--------------------------------+-----------------------+---------------------------------------+ |
718 | +'TODO' |
719 | |
720 | |
721 | DATE TRUNC |
722 | @@ -54,13 +30,4 @@ |
723 | |
724 | For an example of the following, see :doc:`date_trunc`. |
725 | |
726 | -+--------------------------------+-----------------------+---------------------------------------+ |
727 | -|Name |Return Type |Description | |
728 | -+================================+=======================+=======================================+ |
729 | -|date_trunc(text, timestamp) |timestamp |Truncate to specified precision | |
730 | -+--------------------------------+-----------------------+---------------------------------------+ |
731 | - |
732 | - |
733 | - |
734 | - |
735 | - |
736 | +'TODO' |
737 | \ No newline at end of file |
738 | |
739 | === modified file 'docs/functions/extract_date_functions.rst' |
740 | --- docs/functions/extract_date_functions.rst 2011-09-15 18:01:36 +0000 |
741 | +++ docs/functions/extract_date_functions.rst 2012-06-19 08:53:18 +0000 |
742 | @@ -8,153 +8,4 @@ |
743 | |
744 | EXTRACT(field FROM source) |
745 | |
746 | -The EXTRACT function retrieves subfields such as day or hour from date/time values. The source value has to be a value expression of type *timestamp*, *time*, *date*, or *interval*. |
747 | - |
748 | -*Field* is an identifier or string that identifies the field to extract from the source value. The extract function returns values of type *double precision*. |
749 | - |
750 | -Examples |
751 | --------- |
752 | - |
753 | -The following field names are available: |
754 | - |
755 | -day |
756 | -^^^ |
757 | - |
758 | -.. code-block:: mysql |
759 | - |
760 | - SELECT EXTRACT(DAY FROM TIMESTAMP '2011-02-16 20:38:40'); |
761 | - |
762 | -Day of the month. |
763 | - |
764 | -*Result: 16* |
765 | - |
766 | -decade |
767 | -^^^^^^ |
768 | - |
769 | -.. code-block:: mysql |
770 | - |
771 | - SELECT EXTRACT(DECADE FROM TIMESTAMP '2001-02-16 20:38:40'); |
772 | - |
773 | -The year, divided by 10. |
774 | - |
775 | -*Result: 200* |
776 | - |
777 | -dow |
778 | -^^^ |
779 | - |
780 | -.. code-block:: mysql |
781 | - |
782 | - SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40'); |
783 | - |
784 | -The day of the week (Sunday is 0, Saturday is 6) |
785 | - |
786 | -*Result: 5* |
787 | - |
788 | -doy |
789 | -^^^ |
790 | - |
791 | -.. code-block:: mysql |
792 | - |
793 | - SELECT EXTRACT(DOY FROM TIMESTAMP '2001-02-16 20:38:40'); |
794 | - |
795 | -The day of the year (1 - 365/366) |
796 | - |
797 | -*Result: 47* |
798 | - |
799 | -hour |
800 | -^^^^ |
801 | - |
802 | -.. code-block:: mysql |
803 | - |
804 | - SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 20:38:40'); |
805 | - |
806 | -The hour field (0 - 23) |
807 | - |
808 | -*Result: 20* |
809 | - |
810 | -minute |
811 | -^^^^^^ |
812 | - |
813 | -.. code-block:: mysql |
814 | - |
815 | - SELECT EXTRACT(MINUTE FROM TIMESTAMP '2001-02-16 20:38:40'); |
816 | - |
817 | -The minutes field (0 - 59) |
818 | - |
819 | -*Result: 38* |
820 | - |
821 | -month |
822 | -^^^^^ |
823 | - |
824 | -For timestamp values, the number of the month within the year (1 - 12). |
825 | -For interval values, the number of months (0 - 11). |
826 | - |
827 | -.. code-block:: mysql |
828 | - |
829 | - SELECT EXTRACT(MONTH FROM TIMESTAMP '2010-12-29 08:45:27'); |
830 | - |
831 | -*Result: 12* |
832 | - |
833 | -.. code-block:: mysql |
834 | - |
835 | - SELECT EXTRACT(MONTH FROM INTERVAL '3 years 4 months'); |
836 | - |
837 | -*Result: 4* |
838 | - |
839 | -.. code-block:: mysql |
840 | - |
841 | - SELECT EXTRACT(MONTH FROM INTERVAL '3 years 13 months'); |
842 | - |
843 | -*Result: 1* |
844 | - |
845 | -quarter |
846 | -^^^^^^^ |
847 | - |
848 | -.. code-block:: mysql |
849 | - |
850 | - SELECT EXTRACT(QUARTER FROM TIMESTAMP '2010-12-29 08:45:27'); |
851 | - |
852 | -The quarter of the year (1 - 4) containing the date. |
853 | - |
854 | -*Result: 4* |
855 | - |
856 | -second |
857 | -^^^^^^ |
858 | - |
859 | -.. code-block:: mysql |
860 | - |
861 | - SELECT EXTRACT(SECOND FROM TIMESTAMP '2010-12-29 08:45:27'); |
862 | - |
863 | -The seconds field, including fractional parts (0 - 59) |
864 | - |
865 | -*Result: 27* |
866 | - |
867 | -timezone |
868 | -^^^^^^^^ |
869 | - |
870 | -The time zone offset from UTC, measured in seconds. |
871 | - |
872 | -week |
873 | -^^^^ |
874 | - |
875 | -Returns the week number that a day is in. Weeks are numbered according to ISO 8601:1988. |
876 | - |
877 | -ISO 8601:1988 means that if the week containing January 1 has four or more days in the new year, then it is week 1; otherwise it is the last week of the previous year, and the next week is week 1. The ISO-8601 week starts on Monday. |
878 | - |
879 | -It's possible for early January dates to be part of the 52nd or 53rd week of the previous year. For example, 2011-01-01 was part of the 52nd week of year 2010. |
880 | - |
881 | -.. code-block:: mysql |
882 | - |
883 | - SELECT EXTRACT(WEEK FROM TIMESTAMP '2010-01-25 12:44:06'); |
884 | - |
885 | -*Result: 4* |
886 | - |
887 | -year |
888 | -^^^^ |
889 | - |
890 | -.. code-block:: mysql |
891 | - |
892 | - SELECT EXTRACT(YEAR FROM TIMESTAMP '2009-02-16 20:38:40'); |
893 | - |
894 | -*Result: 2009* |
895 | - |
896 | +'TODO' |
897 | \ No newline at end of file |
898 | |
899 | === modified file 'docs/functions/logical.rst' |
900 | --- docs/functions/logical.rst 2011-02-23 13:08:09 +0000 |
901 | +++ docs/functions/logical.rst 2012-06-19 08:53:18 +0000 |
902 | @@ -17,167 +17,28 @@ |
903 | ============================== ================================ |
904 | |
905 | |
906 | +'TODO' |
907 | + |
908 | .. _and: |
909 | |
910 | AND |
911 | --- |
912 | |
913 | -This logical operator AND: |
914 | - |
915 | -* evaluates to 1 if all operands are nonzero and not NULL |
916 | -* evaluates to 0 if one or more operands are 0 |
917 | -* otherwise returns NULL |
918 | - |
919 | -.. code-block:: mysql |
920 | - |
921 | - SELECT 1 && 1; |
922 | - -> 1 |
923 | - SELECT 1 && 0; |
924 | - -> 0 |
925 | - SELECT 1 && NULL; |
926 | - -> NULL |
927 | - SELECT 0 && NULL; |
928 | - -> 0 |
929 | - SELECT NULL && 0; |
930 | - -> 0 |
931 | - |
932 | -AND can be used to select rows that satisfy all the conditions given in a statement. For Example, to find the names of the students between the age 20 to 25 years, the query would be like: |
933 | - |
934 | -.. code-block:: mysql |
935 | - |
936 | - SELECT first_name, last_name, age |
937 | - FROM user_details |
938 | - WHERE age >= 20 AND age <= 25; |
939 | - |
940 | -The output would be: |
941 | - |
942 | -+---------------+------------------+-------+ |
943 | -|first_name |last_name |age | |
944 | -+===============+==================+=======+ |
945 | -|Mary |Bean |20 | |
946 | -+---------------+------------------+-------+ |
947 | -|Henry |Catson |22 | |
948 | -+---------------+------------------+-------+ |
949 | -|Sheila |Donaldson |25 | |
950 | -+---------------+------------------+-------+ |
951 | - |
952 | -The logical "AND" operator selects rows only if the data in all relevant columns is satisfied. In this case, 'first_name' and 'last_name' simply need to have non-NULL values, and 'age' needs to be a value between 20 and 25. |
953 | - |
954 | .. _or: |
955 | |
956 | OR |
957 | -- |
958 | |
959 | -This logical operator OR: |
960 | - |
961 | -* returns 1 if any operand is nonzero and both operands are non-NULL, and returns 0 otherwise |
962 | -* returns 1 with a NULL operand if the other operand is nonzero, and retunes NULL otherwise |
963 | -* returns NULL if both operands are NULL |
964 | - |
965 | -.. code-block:: mysql |
966 | - |
967 | - SELECT 1 || 1; |
968 | - -> 1 |
969 | - SELECT 1 || 0; |
970 | - -> 1 |
971 | - SELECT 0 || 0; |
972 | - -> 0 |
973 | - SELECT 1 || NULL; |
974 | - -> 1 |
975 | - SELECT 0 || NULL; |
976 | - -> NULL |
977 | - |
978 | -In other words, OR is used to select rows that satisfy at least one of the given conditions. |
979 | - |
980 | -For example, the following query could be used to find the user_id for people that live in either California or Texas: |
981 | - |
982 | -.. code-block:: mysql |
983 | - |
984 | - SELECT user_id, state |
985 | - FROM user_location |
986 | - WHERE state = 'California' OR state = 'Texas'; |
987 | - |
988 | -The result set could be something like: |
989 | - |
990 | -+---------------+------------------+-----------+ |
991 | -|user_id |city |state | |
992 | -+===============+==================+===========+ |
993 | -|608 |Sacremento |California | |
994 | -+---------------+------------------+-----------+ |
995 | -|844 |Austin |Texas | |
996 | -+---------------+------------------+-----------+ |
997 | -|917 |Oakland |California | |
998 | -+---------------+------------------+-----------+ |
999 | - |
1000 | - |
1001 | .. _xor: |
1002 | |
1003 | XOR |
1004 | --- |
1005 | |
1006 | -* returns NULL if either operand is NULL |
1007 | -* evaluates to 1 for non-NULL operands (if an odd number of operands is nonzero) |
1008 | -* otherwise 0 is returned |
1009 | - |
1010 | -.. code-block:: mysql |
1011 | - |
1012 | - SELECT 1 XOR NULL; |
1013 | - -> NULL |
1014 | - SELECT 1 XOR 0; |
1015 | - -> 1 |
1016 | - SELECT 1 XOR 1 XOR 1; |
1017 | - -> 1 |
1018 | - SELECT 1 XOR 1; |
1019 | - -> 0 |
1020 | - |
1021 | -Note that "a XOR b" is the mathematical equivalent of (a AND (NOT b)) OR ((NOT a) and b). |
1022 | - |
1023 | - |
1024 | .. _not: |
1025 | |
1026 | NOT |
1027 | --- |
1028 | |
1029 | -This logical operator NOT: |
1030 | - |
1031 | -* evaluates to 1 if the operand is 0 |
1032 | -* evaluates to 0 if the operand is nonzero |
1033 | -* NOT NULL returns NULL |
1034 | - |
1035 | -.. code-block:: mysql |
1036 | - |
1037 | - SELECT NOT 10; |
1038 | - -> 0 |
1039 | - SELECT NOT 0; |
1040 | - -> 1 |
1041 | - SELECT NOT NULL; |
1042 | - -> NULL |
1043 | - SELECT ! (1+1); |
1044 | - -> 0 |
1045 | - SELECT ! 1+1; |
1046 | - -> 1 |
1047 | - |
1048 | -If you want to find rows that do not satisfy a condition, you can use the logical operator, NOT. NOT results in the reverse of a condition. That is, if a condition is satisfied, then the row is not returned. |
1049 | - |
1050 | -For example: If you want to find out the user_id for people who do not practice medicine as their profession, the query would be like: |
1051 | - |
1052 | -.. code-block:: mysql |
1053 | - |
1054 | - SELECT user_id, title, occupation |
1055 | - FROM user_occupations |
1056 | - WHERE NOT occupation = 'Doctor'; |
1057 | - |
1058 | -The result set would be something like: |
1059 | - |
1060 | -+---------------+------------------+--------------+ |
1061 | -|user_id |degree |occupation | |
1062 | -+===============+==================+==============+ |
1063 | -|322 |PhD |Professor | |
1064 | -+---------------+------------------+--------------+ |
1065 | -|579 |PhD |Writer | |
1066 | -+---------------+------------------+--------------+ |
1067 | -|681 |MD |Consultant | |
1068 | -+---------------+------------------+--------------+ |
1069 | |
1070 | |
1071 | .. _less_than: |
1072 | @@ -185,12 +46,6 @@ |
1073 | LESS THAN |
1074 | ---------- |
1075 | |
1076 | -Less than: |
1077 | - |
1078 | -.. code-block:: mysql |
1079 | - |
1080 | - SELECT 2 < 2; |
1081 | - -> 0 |
1082 | |
1083 | |
1084 | .. _greater_than: |
1085 | @@ -198,72 +53,26 @@ |
1086 | GREATER THAN |
1087 | ------------- |
1088 | |
1089 | -Greater than: |
1090 | - |
1091 | -.. code-block:: mysql |
1092 | - |
1093 | - SELECT 2 > 2; |
1094 | - -> 0 |
1095 | |
1096 | .. _less_or_equal: |
1097 | |
1098 | LESS THAN OR EQUAL |
1099 | ------------------- |
1100 | |
1101 | -Less than or equal: |
1102 | - |
1103 | -.. code-block:: mysql |
1104 | - |
1105 | - SELECT 0.1 <= 2; |
1106 | - -> 1 |
1107 | - |
1108 | |
1109 | .. _greater_or_equal: |
1110 | |
1111 | GREATER THAN OR EQUAL |
1112 | ---------------------- |
1113 | |
1114 | -Greater than or equal: |
1115 | - |
1116 | -.. code-block:: mysql |
1117 | - |
1118 | - SELECT 2 >= 2; |
1119 | - -> 1 |
1120 | - |
1121 | .. _equal: |
1122 | |
1123 | EQUAL |
1124 | ----- |
1125 | |
1126 | -Equal: |
1127 | - |
1128 | -.. code-block:: mysql |
1129 | - |
1130 | - SELECT 1 = 0; |
1131 | - -> 0 |
1132 | - SELECT '0' = 0; |
1133 | - -> 1 |
1134 | - SELECT '0.0' = 0; |
1135 | - -> 1 |
1136 | - SELECT '0.01' = 0; |
1137 | - -> 0 |
1138 | - SELECT '.01' = 0.01; |
1139 | - -> 1 |
1140 | - |
1141 | |
1142 | .. _not_equal: |
1143 | |
1144 | NOT EQUAL |
1145 | ---------- |
1146 | |
1147 | -Not equal: |
1148 | - |
1149 | -.. code-block:: mysql |
1150 | - |
1151 | - SELECT '.01' <> '0.01'; |
1152 | - -> 1 |
1153 | - SELECT .01 <> '0.01'; |
1154 | - -> 0 |
1155 | - SELECT 'zing' <> 'zingg'; |
1156 | - -> 1 |
1157 | - |
1158 | |
1159 | === modified file 'docs/functions/overview.rst' |
1160 | --- docs/functions/overview.rst 2011-08-13 20:41:38 +0000 |
1161 | +++ docs/functions/overview.rst 2012-06-19 08:53:18 +0000 |
1162 | @@ -1,7 +1,7 @@ |
1163 | SQL Functions |
1164 | ============= |
1165 | |
1166 | -Several SQL functions are built into Drizzle--functions perform calculations on data. They can be be understood in categories: |
1167 | +'TODO' |
1168 | |
1169 | .. toctree:: |
1170 | :maxdepth: 2 |
1171 | |
1172 | === modified file 'docs/functions/string.rst' |
1173 | --- docs/functions/string.rst 2011-08-13 20:41:38 +0000 |
1174 | +++ docs/functions/string.rst 2012-06-19 08:53:18 +0000 |
1175 | @@ -18,18 +18,21 @@ |
1176 | Summary of Functions |
1177 | -------------------- |
1178 | |
1179 | +'TODO' descriptions |
1180 | +'TODO' "regular functions" ...there are no regular or irregular functions!!! |
1181 | + |
1182 | Comparative and regular functions |
1183 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
1184 | |
1185 | =================== ==================================================================================================== |
1186 | Operator Description |
1187 | =================== ==================================================================================================== |
1188 | -LIKE Matches a simple pattern |
1189 | -NOT LIKE Negation of simple pattern matching |
1190 | -STRCMP() Compare two strings |
1191 | -NOT REGEXP Negation of REGEXP |
1192 | -REGEXP Returns values that match a regular expression pattern |
1193 | -RLIKE Synonym for REGEXP |
1194 | +LIKE |
1195 | +NOT LIKE |
1196 | +STRCMP() |
1197 | +NOT REGEXP |
1198 | +REGEXP |
1199 | +RLIKE |
1200 | =================== ==================================================================================================== |
1201 | |
1202 | |
1203 | @@ -38,15 +41,15 @@ |
1204 | =================== ==================================================================================================== |
1205 | Operator Description |
1206 | =================== ==================================================================================================== |
1207 | -ASCII() Return numeric value of left-most character |
1208 | -BIN() Return a string representation of the argument |
1209 | -CHAR() Return the character for each integer passed |
1210 | -HEX() Return a hexadecimal representation of a decimal or string value |
1211 | -LOWER() Return the argument in lowercase |
1212 | -LCASE() Synonym for LOWER() |
1213 | -UCASE() Synonym for UPPER() |
1214 | -UNHEX() Convert each pair of hexadecimal digits to a character |
1215 | -UPPER() Convert to uppercase |
1216 | +ASCII() |
1217 | +BIN() |
1218 | +CHAR() |
1219 | +HEX() |
1220 | +LOWER() |
1221 | +LCASE() |
1222 | +UCASE() |
1223 | +UNHEX() |
1224 | +UPPER() |
1225 | =================== ==================================================================================================== |
1226 | |
1227 | |
1228 | @@ -55,10 +58,10 @@ |
1229 | =================== ==================================================================================================== |
1230 | Operator Description |
1231 | =================== ==================================================================================================== |
1232 | -BIT_LENGTH() Return length of argument in bits |
1233 | -CHAR_LENGTH() Return number of characters in argument |
1234 | -LENGTH() Return the length of a string in bytes |
1235 | -OCTET_LENGTH() A synonym for LENGTH() |
1236 | +BIT_LENGTH() |
1237 | +CHAR_LENGTH() |
1238 | +LENGTH() |
1239 | +OCTET_LENGTH() |
1240 | =================== ==================================================================================================== |
1241 | |
1242 | |
1243 | @@ -67,10 +70,10 @@ |
1244 | =================== ==================================================================================================== |
1245 | Operator Description |
1246 | =================== ==================================================================================================== |
1247 | -CONCAT() Returns a concatenated string |
1248 | -TRIM() Remove leading and trailing spaces |
1249 | -LTRIM() Remove leading spaces |
1250 | -RTRIM() Remove trailing spaces |
1251 | +CONCAT() |
1252 | +TRIM() |
1253 | +LTRIM() |
1254 | +RTRIM() |
1255 | =================== ==================================================================================================== |
1256 | |
1257 | |
1258 | @@ -80,13 +83,13 @@ |
1259 | =================== ==================================================================================================== |
1260 | Operator Description |
1261 | =================== ==================================================================================================== |
1262 | -FIELD() Return the index (position) of the first argument in the sequent arguments |
1263 | -FIND_IN_SET() Return the index position of the first argument within the second argument |
1264 | -INSTR() Return the index of the first occurrence of substring |
1265 | -LEFT() Return the leftmost number of characters as specified |
1266 | -INSERT() Insert a substring at the specified position up to the specified number of characters |
1267 | -LOCATE() Return the position of the first occurrence of substring |
1268 | -POSITION() A synonym for LOCATE() |
1269 | +FIELD() |
1270 | +FIND_IN_SET() |
1271 | +INSTR() |
1272 | +LEFT() |
1273 | +INSERT() |
1274 | +LOCATE() |
1275 | +POSITION() |
1276 | =================== ==================================================================================================== |
1277 | |
1278 | |
1279 | @@ -96,24 +99,24 @@ |
1280 | =================== ==================================================================================================== |
1281 | Operator Description |
1282 | =================== ==================================================================================================== |
1283 | -ELT() Return string at index number |
1284 | -EXPORT_SET() Return a string |
1285 | -FORMAT() Return a number formatted to specified number of decimal places |
1286 | -LOAD_FILE() Load the named file |
1287 | -LPAD() Return the string argument, left-padded with the specified string |
1288 | -MAKE_SET() Return a set of comma-separated strings that have the corresponding bit in bits set |
1289 | -MATCH Perform full-text search |
1290 | -MID() Return a substring starting from the specified position |
1291 | -ORD() Return character code for leftmost character of the argument |
1292 | -QUOTE() Escape the argument for use in an SQL statement |
1293 | -REPEAT() Repeat a string the specified number of times |
1294 | -REPLACE() Replace occurrences of a specified string |
1295 | -REVERSE() Reverse the characters in a string |
1296 | -RIGHT() Return the specified rightmost number of characters |
1297 | -RPAD() Append string the specified number of times |
1298 | -SOUNDEX() Return a soundex string |
1299 | -SUBSTR() Return the substring as specified |
1300 | -SUBSTRING_INDEX() Return a substring from a string before the specified number of occurrences of the delimiter |
1301 | -SUBSTRING() Return the substring as specified |
1302 | +ELT() |
1303 | +EXPORT_SET() |
1304 | +FORMAT() |
1305 | +LOAD_FILE() |
1306 | +LPAD() |
1307 | +MAKE_SET() |
1308 | +MATCH |
1309 | +MID() |
1310 | +ORD() |
1311 | +QUOTE() |
1312 | +REPEAT() |
1313 | +REPLACE() |
1314 | +REVERSE() |
1315 | +RIGHT() |
1316 | +RPAD() |
1317 | +SOUNDEX() |
1318 | +SUBSTR() |
1319 | +SUBSTRING_INDEX() |
1320 | +SUBSTRING() |
1321 | =================== ==================================================================================================== |
1322 | |
1323 | |
1324 | === modified file 'docs/functions/string/comparative.rst' |
1325 | --- docs/functions/string/comparative.rst 2011-08-13 20:41:38 +0000 |
1326 | +++ docs/functions/string/comparative.rst 2012-06-19 08:53:18 +0000 |
1327 | @@ -1,72 +1,31 @@ |
1328 | Comparative Functions |
1329 | ===================== |
1330 | |
1331 | +'TODO' |
1332 | + |
1333 | .. _like-function: |
1334 | |
1335 | -LIKE |
1336 | +LIKE |
1337 | ---- |
1338 | |
1339 | -The LIKE operator is used to check if field values match a specified pattern, and searches for less-than-exact but similar values. |
1340 | - |
1341 | -The LIKE operator supports the use of two wildcards. (Wildcards provide more flexibility by allowing any character or group of characters in a string to be acceptable as a match for another string): |
1342 | - |
1343 | - * Percentage (%): Represents zero or more values. |
1344 | - * Underscore (_): Matches exactly one character value. |
1345 | - |
1346 | -In accordance the SQL standard, LIKE performs matching on a per-character basis. It therefore provides results different from the = comparison operator. |
1347 | - |
1348 | -The following SELECT statement includes a WHERE clause in order to search for job titles that start with "DIRECTOR", by using the percentage wildcard after the lookup value. |
1349 | - |
1350 | -For example: |
1351 | - |
1352 | -.. code-block:: mysql |
1353 | - |
1354 | - SELECT title, field |
1355 | - FROM job_detail |
1356 | - WHERE title LIKE 'DIRECTOR%' |
1357 | - ORDER BY field, title; |
1358 | + |
1359 | + |
1360 | |
1361 | .. _regex-function: |
1362 | |
1363 | REGEX |
1364 | ----- |
1365 | |
1366 | -Undocumented. |
1367 | |
1368 | .. _regexp-function: |
1369 | |
1370 | REGEXP |
1371 | ------ |
1372 | |
1373 | -Returns values that match a regular expression pattern; they are commonly used for creating complex searches. Here is an example of using a REGEXP (Regular Expression) match: |
1374 | - |
1375 | -.. code-block:: mysql |
1376 | - |
1377 | - SELECT title, category_name |
1378 | - FROM film_detail |
1379 | - WHERE title REGEXP '^AIRP[LO]' |
1380 | - ORDER BY title; |
1381 | - |
1382 | -Other REGEXP examples: |
1383 | - |
1384 | -.. code-block:: mysql |
1385 | - |
1386 | - SELECT 'abcabc' REGEXP 'abc', |
1387 | - 'abcabc' REGEXP 'cb'; |
1388 | - |
1389 | -The search pattern may describe only a part of string. To match entire string, use ^ and $ in the search: |
1390 | - |
1391 | -.. code-block:: mysql |
1392 | - |
1393 | - SELECT 'abc' REGEXP '^abc$', 'abcabc' REGEXP '^abc$'; |
1394 | - |
1395 | - SELECT 'cde' REGEXP '[a-c]+', 'efg' REGEXP '[a-c]+'; |
1396 | - |
1397 | - SELECT 'abcabc' REGEXP 'ABC', 'abcabc' REGEXP BINARY 'ABC'; |
1398 | + |
1399 | |
1400 | .. _strcmp-function: |
1401 | |
1402 | STRCMP |
1403 | ------ |
1404 | |
1405 | -The purpose of STRCMP is also to compare two strings. This function returns 0 if two strings are the same, -1 if the first argument is smaller than the second according to the current sort order, and 1 otherwise. |
1406 | |
1407 | === modified file 'docs/functions/string/conversion.rst' |
1408 | --- docs/functions/string/conversion.rst 2011-08-13 20:41:38 +0000 |
1409 | +++ docs/functions/string/conversion.rst 2012-06-19 08:53:18 +0000 |
1410 | @@ -1,145 +1,59 @@ |
1411 | Conversion Functions |
1412 | ==================== |
1413 | |
1414 | +'TODO' |
1415 | + |
1416 | .. _ascii-function: |
1417 | |
1418 | ASCII |
1419 | ----- |
1420 | |
1421 | -The ASCII(str) function returns the numeric value of the leftmost character of the string ’str’. It returns NULL if str is NULL. It works for 8-bit characters. |
1422 | - |
1423 | -For example: |
1424 | - |
1425 | -.. code-block:: mysql |
1426 | - |
1427 | - SELECT ASCII('0'); |
1428 | - |
1429 | -Returns 48 |
1430 | - |
1431 | -.. code-block:: mysql |
1432 | - |
1433 | - SELECT ASCII('d'); |
1434 | - |
1435 | -Returns 100 |
1436 | |
1437 | .. _bin-function: |
1438 | |
1439 | BIN |
1440 | --- |
1441 | |
1442 | -The BIN string function returns a string value that represents the binary value of N, where N is a longlong(BIGINT) number. This function is equivalent to CONV(N, 10 , 0). If the function return the null then N is null. |
1443 | - |
1444 | -Syntax: |
1445 | - |
1446 | -BIN (N); |
1447 | - |
1448 | -For exempt: |
1449 | - |
1450 | -.. code-block:: mysql |
1451 | - |
1452 | - SELECT BIN(12); |
1453 | - |
1454 | -Returns: '1100' |
1455 | - |
1456 | - |
1457 | .. _char-function: |
1458 | |
1459 | CHAR |
1460 | ---- |
1461 | |
1462 | -SQL CHAR function is the opposite of the ASCII function. It converts an integer in range 0-255 into a ASCII character. It returns a string (the character), given the integer value. This function skips NULL values. |
1463 | |
1464 | -For example: |
1465 | - |
1466 | -.. code-block:: mysql |
1467 | - |
1468 | - SELECT CHAR(65) AS ch_65; |
1469 | - |
1470 | -Returns "A" |
1471 | |
1472 | |
1473 | .. _hex-function: |
1474 | |
1475 | HEX |
1476 | --- |
1477 | |
1478 | -This string function returns the hexadecimal (base-16) representation of a string or decicmal argument. Each character in the string argument is converted to two hexadecimal digits. If the argument is numeric, HEX() returns a hexadecimal string representation of the value as a BIGINT number. |
1479 | - |
1480 | -Using HEX for numeric values: |
1481 | - |
1482 | -.. code-block:: mysql |
1483 | - |
1484 | - SELECT HEX(255); |
1485 | - |
1486 | -Returns: FF |
1487 | - |
1488 | -Using HEX for string values: |
1489 | - |
1490 | -.. code-block:: mysql |
1491 | - |
1492 | - SELECT HEX('Drizzle'); |
1493 | - |
1494 | -Returns: 4452495A5AHc45 |
1495 | - |
1496 | -(To better understand this output, you can use an :doc:`../../resources/ascii_chart` that includes both Hexadecimal and character values.) |
1497 | |
1498 | .. _unhex-function: |
1499 | |
1500 | UNHEX |
1501 | ----- |
1502 | |
1503 | -UNHEX converts each pair of hexadecimal digits to a character. For a string argument, UNHEX() is the inverse operation of HEX(str). |
1504 | - |
1505 | -Instead of converting each character in the string argument to hex digits, it interprets each pair of characters in the argument as a hexadecimal number and converts it to the character represented by the number. The return value is a binary string. |
1506 | - |
1507 | -.. code-block:: mysql |
1508 | - |
1509 | - SELECT UNHEX('4452495A5AHc45'); |
1510 | - |
1511 | -Returns 'drizzle' |
1512 | - |
1513 | -.. code-block:: mysql |
1514 | - |
1515 | - SELECT UNHEX(HEX('string')); |
1516 | - |
1517 | -Returns 'string' |
1518 | - |
1519 | -.. code-block:: mysql |
1520 | - |
1521 | - SELECT HEX(UNHEX('1267')); |
1522 | - |
1523 | -Returns '1267' |
1524 | - |
1525 | -The characters in the argument string must be legal hexadecimal digits: '0' .. '9', 'A' .. 'F', 'a' .. 'f'. If the argument contains any non-hexadecimal digits, the result is NULL: |
1526 | - |
1527 | -.. code-block:: mysql |
1528 | - |
1529 | - SELECT UNHEX('GG'); |
1530 | - |
1531 | -Returns NULL |
1532 | + |
1533 | |
1534 | .. _lower-function: |
1535 | |
1536 | LOWER |
1537 | ----- |
1538 | |
1539 | -Return the argument in lowercase. |
1540 | |
1541 | .. _lcase-function: |
1542 | |
1543 | LCASE |
1544 | ----- |
1545 | |
1546 | -Synonym for LOWER(). |
1547 | |
1548 | .. _ucase-function: |
1549 | |
1550 | UCASE |
1551 | ----- |
1552 | |
1553 | -Synonym for UPPER() |
1554 | |
1555 | .. _upper-function: |
1556 | |
1557 | UPPER |
1558 | ----- |
1559 | |
1560 | -Convert to uppercase. |
1561 | + |
1562 | |
1563 | === modified file 'docs/functions/string/length.rst' |
1564 | --- docs/functions/string/length.rst 2011-09-15 13:23:48 +0000 |
1565 | +++ docs/functions/string/length.rst 2012-06-19 08:53:18 +0000 |
1566 | @@ -1,43 +1,28 @@ |
1567 | Length and Size Functions |
1568 | ========================= |
1569 | |
1570 | +'TODO' |
1571 | + |
1572 | .. _char-length-function: |
1573 | |
1574 | CHAR_LENGTH |
1575 | ----------- |
1576 | -The CHAR_LENGTH(str) function returns string length measured in characters. |
1577 | - |
1578 | -A multi-byte character counts as single character such as a string contains 5 two-byte characters, then LENGTH() function returns 10, but the CHAR_LENGTH() returns 5. :: |
1579 | - |
1580 | - CHARACTER_LENGTH(str) |
1581 | - |
1582 | -This function is same as CHAR_LENGTH(). |
1583 | + |
1584 | |
1585 | .. _character-length-function: |
1586 | |
1587 | CHARACTER_LENGTH |
1588 | ---------------- |
1589 | |
1590 | -Synonym for CHAR_LENGTH. |
1591 | |
1592 | .. _length-function: |
1593 | |
1594 | LENGTH |
1595 | ------ |
1596 | |
1597 | -The LENGTH function returns the length of the string argument in bytes. A multi-byte character counts as multiple bytes. This means that for a string containing a three-byte character, LENGTH() returns 3, whereas CHAR_LENGTH() returns 1. For example: |
1598 | - |
1599 | -.. code-block:: mysql |
1600 | - |
1601 | - select length('€'); |
1602 | - |
1603 | -Returns 3 |
1604 | - |
1605 | -The is because the Euro sign is encoded as 0xE282AC in UTF-8 and thereby occupies 3 bytes. |
1606 | |
1607 | .. _octet-length-function: |
1608 | |
1609 | OCTET_LENGTH |
1610 | ------------- |
1611 | |
1612 | -A synonym for LENGTH(). |
1613 | |
1614 | === modified file 'docs/functions/string/modification.rst' |
1615 | --- docs/functions/string/modification.rst 2011-09-15 13:44:31 +0000 |
1616 | +++ docs/functions/string/modification.rst 2012-06-19 08:53:18 +0000 |
1617 | @@ -1,117 +1,4 @@ |
1618 | String Modification Functions |
1619 | ============================= |
1620 | |
1621 | -.. _concat-function: |
1622 | - |
1623 | -CONCAT |
1624 | ------- |
1625 | - |
1626 | -The SQL standard defines a concatenation operator ( || ), which joins two or more strings into one string value. |
1627 | -The CONCAT(str1, str2...) function can have one or more arguments. It returns a string that is the result of concatenating the arguments. |
1628 | - |
1629 | -* If arguments are non-binary strings, the result is also a non-binary string. |
1630 | -* If any argument is a binary string, then the result will also be a binary string. |
1631 | -* Numeric arguments are converted to their equivalent in binary string format. |
1632 | -* If any argument is NULL then it also returns NULL. |
1633 | - |
1634 | -Syntax: |
1635 | - |
1636 | -CONCAT(str1, str2, [,...n]) |
1637 | -For example: |
1638 | - |
1639 | -.. code-block:: mysql |
1640 | - |
1641 | - SELECT CONCAT('Dr', 'izzl', 'ed'); |
1642 | - |
1643 | -Returns: 'Drizzled' |
1644 | - |
1645 | -.. code-block:: mysql |
1646 | - |
1647 | - SELECT CONCAT('micro', NULL, 'nel'); |
1648 | - |
1649 | -Returns: NULL |
1650 | - |
1651 | -.. code-block:: mysql |
1652 | - |
1653 | - SELECT CONCAT(14.8); |
1654 | - |
1655 | -Returns: '14.8' |
1656 | - |
1657 | -.. _concat-ws-function: |
1658 | - |
1659 | -CONCAT_WS |
1660 | ---------- |
1661 | -CONCAT WS (With Separator) [1]_ allows you to specify that the first argument is treated as a separator for the rest of the arguments. This argument is added between the strings to be concatenated. |
1662 | - |
1663 | -Syntax: |
1664 | - |
1665 | -CONCAT_WS(separator, str1, str2,....) |
1666 | - |
1667 | -For example: |
1668 | - |
1669 | -.. code-block:: mysql |
1670 | - |
1671 | - SELECT CONCAT_WS(',', ' Occupation', 'First name', 'Last Name'); |
1672 | - |
1673 | -Returns: 'Occupation, First name, Last Name' |
1674 | - |
1675 | -.. code-block:: mysql |
1676 | - |
1677 | - SELECT CONCAT_WS(',', 'First name', NULL, 'Last Name'); |
1678 | - |
1679 | -Returns: 'First name, Last Name' |
1680 | - |
1681 | -.. _trim-function: |
1682 | - |
1683 | -TRIM |
1684 | ----- |
1685 | - |
1686 | -The TRIM function remove specified prefixes or suffixes from a string (typically leading and trailing spaces), and returns the resulting string. If none of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is assumed. |
1687 | - |
1688 | -Syntax: |
1689 | - |
1690 | -TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr FROM] str) |
1691 | - |
1692 | -[remstr] is optional (if it's not specified, spaces are removed). |
1693 | - |
1694 | -For example: |
1695 | - |
1696 | -.. code-block:: mysql |
1697 | - |
1698 | - SELECT TRIM(BOTH 'hello,' FROM 'hello,Drizzlehello,'); |
1699 | - |
1700 | -Returns: 'Drizzle' |
1701 | - |
1702 | -.. _ltrim-function: |
1703 | - |
1704 | -LTRIM |
1705 | ------ |
1706 | - |
1707 | -This version of the TRIM function removes leading spaces from the beginning of a string. |
1708 | - |
1709 | -For example: |
1710 | - |
1711 | -.. code-block:: mysql |
1712 | - |
1713 | - SELECT LTRIM(' Drizzle'); |
1714 | - |
1715 | -Returns: 'Drizzle' |
1716 | - |
1717 | -.. _rtrim-function: |
1718 | - |
1719 | -RTRIM |
1720 | ------ |
1721 | - |
1722 | -This version of the TRIM function removes trailing spaces from the end of a function. |
1723 | - |
1724 | -For example: |
1725 | - |
1726 | -.. code-block:: mysql |
1727 | - |
1728 | - SELECT RTRIM('Drizzle '); |
1729 | - |
1730 | -Returns: 'Drizzle' |
1731 | - |
1732 | -.. rubric:: Footnotes |
1733 | - |
1734 | -.. [1] If the separator is NULL then the result is NULL. |
1735 | +'TODO' |
1736 | \ No newline at end of file |
1737 | |
1738 | === modified file 'docs/functions/string/other.rst' |
1739 | --- docs/functions/string/other.rst 2011-09-15 13:58:14 +0000 |
1740 | +++ docs/functions/string/other.rst 2012-06-19 08:53:18 +0000 |
1741 | @@ -1,171 +1,126 @@ |
1742 | Other String Functions |
1743 | ====================== |
1744 | |
1745 | +'TODO' |
1746 | + |
1747 | .. _coercibility-function: |
1748 | |
1749 | COERCIBILITY |
1750 | ------------ |
1751 | |
1752 | -Gets coercibility for an expression. |
1753 | + |
1754 | |
1755 | .. _elt-function: |
1756 | |
1757 | ELT |
1758 | --- |
1759 | |
1760 | -Return string at index number. |
1761 | |
1762 | .. _export-set-function: |
1763 | |
1764 | EXPORT_SET |
1765 | ---------- |
1766 | |
1767 | -Return a string |
1768 | |
1769 | .. _format-function: |
1770 | |
1771 | FORMAT |
1772 | ------ |
1773 | |
1774 | -Return a number formatted to specified number of decimal places. |
1775 | |
1776 | .. _load-file-function: |
1777 | |
1778 | LOAD_FILE |
1779 | --------- |
1780 | |
1781 | -Load the named file. |
1782 | |
1783 | .. _lpad-function: |
1784 | |
1785 | LPAD |
1786 | ---- |
1787 | |
1788 | -Return the string argument, left-padded with the specified string. |
1789 | |
1790 | .. _make-set-function: |
1791 | |
1792 | MAKE_SET |
1793 | -------- |
1794 | |
1795 | -Return a set of comma-separated strings that have the corresponding bit in bits set. |
1796 | + |
1797 | |
1798 | .. _match-function: |
1799 | |
1800 | MATCH |
1801 | ----- |
1802 | |
1803 | -Perform full-text search. |
1804 | |
1805 | .. _mid-function: |
1806 | |
1807 | MID |
1808 | --- |
1809 | |
1810 | -Return a substring starting from the specified position. |
1811 | |
1812 | .. _quote-function: |
1813 | |
1814 | QUOTE |
1815 | ----- |
1816 | |
1817 | -Escape the argument for use in an SQL statement. |
1818 | |
1819 | .. _repeat-function: |
1820 | |
1821 | REPEAT |
1822 | ------ |
1823 | |
1824 | -Repeat a string the specified number of times. |
1825 | |
1826 | .. _replace-function: |
1827 | |
1828 | REPLACE |
1829 | ------- |
1830 | |
1831 | -The REPLACE() function returns a string with all occurrences of the 'from_str' replaced by 'to_str'. REPLACE is case-sensitive when searching for 'from_str'. |
1832 | - |
1833 | -Syntax: |
1834 | - |
1835 | -REPLACE(str,from_str,to_str) |
1836 | - |
1837 | -For example: |
1838 | - |
1839 | -.. code-block:: mysql |
1840 | - |
1841 | - SELECT REPLACE('www.google.com', 'w', 'v'); |
1842 | - |
1843 | -Returns: vvv.google.com |
1844 | + |
1845 | |
1846 | .. _reverse-function: |
1847 | |
1848 | REVERSE |
1849 | ------- |
1850 | |
1851 | -This function returns a string argument with the characters in reverse order. |
1852 | - |
1853 | -.. code-block:: mysql |
1854 | - |
1855 | - SELECT REVERSE('abcd'); |
1856 | - |
1857 | -Returns: dcba |
1858 | + |
1859 | + |
1860 | |
1861 | .. _right-function: |
1862 | |
1863 | RIGHT |
1864 | ----- |
1865 | |
1866 | -Return the specified rightmost number of characters |
1867 | + |
1868 | |
1869 | .. _rpad-function: |
1870 | |
1871 | RPAD |
1872 | ---- |
1873 | |
1874 | -Append string the specified number of times |
1875 | + |
1876 | + |
1877 | |
1878 | .. _soundex-function: |
1879 | |
1880 | SOUNDEX |
1881 | ------- |
1882 | |
1883 | -Return a soundex string |
1884 | + |
1885 | + |
1886 | |
1887 | .. _substr-function: |
1888 | |
1889 | SUBSTR |
1890 | ------ |
1891 | |
1892 | -Synonym for SUBSTRING(). |
1893 | + |
1894 | |
1895 | .. _substring-function: |
1896 | |
1897 | SUBSTRING |
1898 | --------- |
1899 | |
1900 | -Returns the substring as specified |
1901 | - |
1902 | -Examples that use SUBSTRING() in the SELECT clause: |
1903 | - |
1904 | -The SUBSTRING() function is used to extract a character string (using a given starting position and a given length). |
1905 | - |
1906 | -.. code-block:: mysql |
1907 | - |
1908 | - SELECT |
1909 | - SUBSTRING(course_designater,6,3) as 'Course number' |
1910 | - FROM Courses |
1911 | - WHERE course_designater LIKE 'Excel%' |
1912 | - LIMIT 10; |
1913 | - |
1914 | -You can also format a column using SUBSTRING() in combination with functions like LOWER() and UPPER(). |
1915 | - |
1916 | -.. code-block:: mysql |
1917 | - |
1918 | - SELECT |
1919 | - CONCAT(UPPER(SUBSTRING(lastname,1,1)), |
1920 | - LOWER(SUBSTRING(lastname,2,29))) |
1921 | - FROM Students |
1922 | - LIMIT 10; |
1923 | |
1924 | .. _substring-index-function: |
1925 | |
1926 | @@ -173,4 +128,4 @@ |
1927 | SUBSTRING_INDEX |
1928 | --------------- |
1929 | |
1930 | -Return a substring from a string before the specified number of occurrences of the delimiter. |
1931 | + |
1932 | |
1933 | === modified file 'docs/functions/string/position.rst' |
1934 | --- docs/functions/string/position.rst 2011-09-15 13:56:15 +0000 |
1935 | +++ docs/functions/string/position.rst 2012-06-19 08:53:18 +0000 |
1936 | @@ -1,114 +1,5 @@ |
1937 | Position Functions |
1938 | ================== |
1939 | |
1940 | -.. _field-function: |
1941 | - |
1942 | -FIELD |
1943 | ------ |
1944 | - |
1945 | -The FIELD function returns the index (position) of string arguments (str1, str2, str3, ...) |
1946 | - |
1947 | -It returns 0 if the str value is not found. |
1948 | - |
1949 | -If each argument is a string, all arguments will be compared as strings, whereas if arguments are numbers, they will be compared as numbers. |
1950 | - |
1951 | -Otherwise, the arguments are compared as double. |
1952 | - |
1953 | -If str is NULL, the return value is 0 because NULL fails equality comparison with any value. FIELD() is the complement of ELT(). |
1954 | - |
1955 | -.. code-block:: mysql |
1956 | - |
1957 | - SELECT FIELD('ej', 'Hej', 'ej', 'Heja', 'hej', 'foo'); |
1958 | - |
1959 | -Returns 2 |
1960 | - |
1961 | -.. code-block:: mysql |
1962 | - |
1963 | - SELECT FIELD('fo', 'Hej', 'ej', 'Heja', 'hej', 'foo'); |
1964 | - |
1965 | -Returns 0 |
1966 | - |
1967 | -.. _find-in-set-function: |
1968 | - |
1969 | -FIND_IN_SET |
1970 | ------------ |
1971 | - |
1972 | -Return the index position of the first argument within the second argument |
1973 | - |
1974 | -.. code-block:: mysql |
1975 | - |
1976 | - SELECT FIND_IN_SET('2', '1,2,3,4'); |
1977 | - -> 2 |
1978 | - SELECT FIND_IN_SET('1', '123'); |
1979 | - -> 0 |
1980 | - |
1981 | -.. _instr-function: |
1982 | - |
1983 | -INSTR |
1984 | ------ |
1985 | - |
1986 | -INSTR(str, substr) returns the index of the first occurrence of substring str in string substr. Note that this works like LOCATE except the order of the arguments is reversed: |
1987 | - |
1988 | -.. code-block:: mysql |
1989 | - |
1990 | - SELECT INSTR('tacosalad', 'salad'); |
1991 | - -> 5 |
1992 | - SELECT INSTR('burger', 'salad'); |
1993 | - -> 0 |
1994 | - |
1995 | -.. _left-function: |
1996 | - |
1997 | -LEFT |
1998 | ----- |
1999 | - |
2000 | -Return the leftmost number of characters as specified |
2001 | - |
2002 | -.. code-block:: mysql |
2003 | - |
2004 | - SELECT LEFT('drizzled', 7); |
2005 | - -> 'drizzle' |
2006 | - |
2007 | -.. _insert-function: |
2008 | - |
2009 | -INSERT |
2010 | ------- |
2011 | - |
2012 | -This function inserts a substring at the specified position up to the specified number of characters. |
2013 | - |
2014 | -INSERT(str,pos,len,newstr) |
2015 | - |
2016 | -It returns str (a string), with the substring beginning at pos (position) and len (how many characters long) replaced by the newstr. |
2017 | - |
2018 | -* INSERT returns the original string if pos is not within the length of the string |
2019 | -* It replaces the rest of the string from position pos if len is not within the length of the rest of the string |
2020 | -* It returns NULL if any argument is NULL |
2021 | - |
2022 | -.. code-block:: mysql |
2023 | - |
2024 | - SELECT INSERT('Aquatic', 3, 2, 'Me'); |
2025 | - -> 'AqMetic' |
2026 | - SELECT INSERT('Aquatic', -1, 4, 'This'); |
2027 | - -> 'Aquatic' |
2028 | - SELECT INSERT('Aquatic', 3, 100, 'This'); |
2029 | - -> 'AqThis' |
2030 | - |
2031 | -.. _locate-function: |
2032 | - |
2033 | -LOCATE |
2034 | ------- |
2035 | - |
2036 | -Return the position of the first occurrence of substring. |
2037 | - |
2038 | -.. code-block:: mysql |
2039 | - |
2040 | - SELECT LOCATE('salad', 'tacosalad'); |
2041 | - -> 5 |
2042 | - SELECT LOCATE('burger', 'salad'); |
2043 | - -> 0 |
2044 | - |
2045 | -.. _position-function: |
2046 | - |
2047 | -POSITION |
2048 | --------- |
2049 | - |
2050 | -A synonym for LOCATE() |
2051 | + |
2052 | +'TODO' |
2053 | \ No newline at end of file |
2054 | |
2055 | === modified file 'docs/groupby.rst' |
2056 | --- docs/groupby.rst 2011-10-23 16:01:37 +0000 |
2057 | +++ docs/groupby.rst 2012-06-19 08:53:18 +0000 |
2058 | @@ -1,9 +1,7 @@ |
2059 | GROUP BY |
2060 | ======== |
2061 | |
2062 | -The GROUP BY clause is used to extract only those records that fulfill a specified criterion. |
2063 | - |
2064 | -SQL GROUP BY Syntax |
2065 | +'TODO' |
2066 | |
2067 | .. code-block:: mysql |
2068 | |
2069 | @@ -12,78 +10,4 @@ |
2070 | WHERE column_name operator value |
2071 | GROUP BY column_name |
2072 | |
2073 | -**GROUP BY Clause Example** |
2074 | - |
2075 | -The "Activities" table: |
2076 | - |
2077 | -+---------+--------------+--------------+-------------+----------+ |
2078 | -|Id |ActivityDate |ActivityType |ActivityCost | userID | |
2079 | -+=========+==============+==============+=============+==========+ |
2080 | -| 1 |2011-01-02 | Sport |45 |131 | |
2081 | -+---------+--------------+--------------+-------------+----------+ |
2082 | -| 2 |2011-01-02 | Art |10 |256 | |
2083 | -+---------+--------------+--------------+-------------+----------+ |
2084 | -| 3 |2011-01-02 | Music |25 |022 | |
2085 | -+---------+--------------+--------------+-------------+----------+ |
2086 | -| 4 |2011-01-02 | Food |125 |022 | |
2087 | -+---------+--------------+--------------+-------------+----------+ |
2088 | -| 5 |2011-01-03 | Music |40 |131 | |
2089 | -+---------+--------------+--------------+-------------+----------+ |
2090 | -| 6 |2011-01-03 | Food |20 |175 | |
2091 | -+---------+--------------+--------------+-------------+----------+ |
2092 | - |
2093 | -Running the following simple query |
2094 | - |
2095 | -.. code-block:: mysql |
2096 | - |
2097 | - SELECT userID |
2098 | - FROM activities |
2099 | - GROUP BY userID; |
2100 | - |
2101 | -Returns: |
2102 | - |
2103 | -+---------+ |
2104 | -| userID | |
2105 | -+=========+ |
2106 | -| 131 | |
2107 | -+---------+ |
2108 | -| 256 | |
2109 | -+---------+ |
2110 | -| 022 | |
2111 | -+---------+ |
2112 | -| 175 | |
2113 | -+---------+ |
2114 | - |
2115 | -(This shows that GROUP BY accepts a column_name and consolidates like customer values.) |
2116 | - |
2117 | -However, GROUP BY is much more powerful when used with an aggregate function. Let's say you want to find the total amount spent by each unique User. |
2118 | - |
2119 | -You could use the following SQL statement: |
2120 | - |
2121 | -.. code-block:: mysql |
2122 | - |
2123 | - SELECT userID,SUM(ActivityCost) AS "Activity Total" |
2124 | - FROM Activities |
2125 | - GROUP BY userID; |
2126 | - |
2127 | -The result-set will look like this: |
2128 | - |
2129 | -====== ============== |
2130 | -userID Activity Total |
2131 | -====== ============== |
2132 | -131 85 |
2133 | -256 10 |
2134 | -022 150 |
2135 | -175 20 |
2136 | -====== ============== |
2137 | - |
2138 | -With the aggregate SUM() function, SQL can calculate how much each unique user has spent on activities over time. |
2139 | - |
2140 | -We can also use the GROUP BY statement on more than one column, like this: |
2141 | - |
2142 | -.. code-block:: mysql |
2143 | - |
2144 | - SELECT userID,ActivityDate,SUM(ActivityCost) |
2145 | - FROM Activities |
2146 | - GROUP BY userID,ActivityDate; |
2147 | - |
2148 | +'TODO' |
2149 | \ No newline at end of file |
2150 | |
2151 | === modified file 'docs/having.rst' |
2152 | --- docs/having.rst 2011-10-23 16:01:37 +0000 |
2153 | +++ docs/having.rst 2012-06-19 08:53:18 +0000 |
2154 | @@ -1,9 +1,7 @@ |
2155 | HAVING |
2156 | ====== |
2157 | |
2158 | -The WHERE keyword cannot be used with aggregate functions, but the HAVING clause can be; this is its primary use. |
2159 | - |
2160 | -SQL HAVING Syntax: |
2161 | +'TODO' |
2162 | |
2163 | .. code-block:: mysql |
2164 | |
2165 | @@ -13,58 +11,4 @@ |
2166 | GROUP BY column_name |
2167 | HAVING aggregate_function(column_name) operator value |
2168 | |
2169 | -**SQL HAVING Example** |
2170 | - |
2171 | -Take a look at the "Activities" table: |
2172 | - |
2173 | -+---------+--------------+--------------+-------------+----------+ |
2174 | -|Id |ActivityDate |ActivityType |ActivityCost | userID | |
2175 | -+=========+==============+==============+=============+==========+ |
2176 | -| 1 |2011-01-02 | Sport |45 |131 | |
2177 | -+---------+--------------+--------------+-------------+----------+ |
2178 | -| 2 |2011-01-02 | Art |10 |256 | |
2179 | -+---------+--------------+--------------+-------------+----------+ |
2180 | -| 3 |2011-01-02 | Music |25 |022 | |
2181 | -+---------+--------------+--------------+-------------+----------+ |
2182 | -| 4 |2011-01-02 | Food |125 |022 | |
2183 | -+---------+--------------+--------------+-------------+----------+ |
2184 | -| 5 |2011-01-03 | Music |40 |131 | |
2185 | -+---------+--------------+--------------+-------------+----------+ |
2186 | -| 6 |2011-01-03 | Food |20 |175 | |
2187 | -+---------+--------------+--------------+-------------+----------+ |
2188 | - |
2189 | -In order to find if any users have spent more than $100 on recreational activities, use the following SQL statement: |
2190 | - |
2191 | -.. code-block:: mysql |
2192 | - |
2193 | - SELECT userID,SUM(ActivityCost) FROM Activities |
2194 | - GROUP BY userID |
2195 | - HAVING SUM(ActivityCost)>100; |
2196 | - |
2197 | -The result-set will look like this: |
2198 | - |
2199 | -====== =============== |
2200 | -userID SUM(OrderPrice) |
2201 | -====== =============== |
2202 | -022 150 |
2203 | -====== =============== |
2204 | - |
2205 | -Now we want to find if userIDs "131", "256", or "175" spent less than $50 on Activities. |
2206 | - |
2207 | -We add an ordinary WHERE clause to the SQL statement: |
2208 | - |
2209 | -.. code-block:: mysql |
2210 | - |
2211 | - SELECT userID,SUM(ActivityCost) FROM Activities |
2212 | - WHERE userID='131' OR userID='256' OR userID="175" |
2213 | - GROUP BY userID |
2214 | - HAVING SUM(ActivityCost)<50; |
2215 | - |
2216 | -The result-set would be: |
2217 | - |
2218 | -====== =============== |
2219 | -userID SUM(OrderPrice) |
2220 | -====== =============== |
2221 | -256 10 |
2222 | -175 20 |
2223 | -====== =============== |
2224 | +'TODO' |
2225 | \ No newline at end of file |
2226 | |
2227 | === modified file 'docs/insert.rst' |
2228 | --- docs/insert.rst 2011-03-30 03:12:02 +0000 |
2229 | +++ docs/insert.rst 2012-06-19 08:53:18 +0000 |
2230 | @@ -1,37 +1,4 @@ |
2231 | Inserting Data |
2232 | ============== |
2233 | |
2234 | -In Drizzle you can make use of INSERT in order to insert data into a table. |
2235 | - |
2236 | -A type query: |
2237 | - |
2238 | -.. code-block:: mysql |
2239 | - |
2240 | - INSERT INTO A VALUES ("1"); |
2241 | - |
2242 | -INSERT statements that use VALUES syntax can insert multiple rows. To do this, use the multi row VALUES syntax (include multiple lists of column values, each enclosed within parentheses and separated by commas): |
2243 | - |
2244 | -.. code-block:: mysql |
2245 | - |
2246 | - INSERT INTO music (artist, album, date_prod, genre) VALUES |
2247 | - ('Beatles', 'Abbey Road', '1969-09-26', 'rock'), |
2248 | - ('The Velvet Underground', 'The Velvet Underground', '1969-03-05', 'rock'); |
2249 | - |
2250 | -or: |
2251 | - |
2252 | -.. code-block:: mysql |
2253 | - |
2254 | - INSERT INTO table_1 (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9); |
2255 | - |
2256 | -The following statement is incorrect since the number of values in the list does not match the number of column names: |
2257 | - |
2258 | -.. code-block:: mysql |
2259 | - |
2260 | - INSERT INTO table_1 (a,b,c) VALUES(1,2,3,4,5,6,7,8,9); |
2261 | - |
2262 | -VALUE is a synonym for VALUES where performing a single or multirow INSERT. |
2263 | - |
2264 | -Performance |
2265 | ------------ |
2266 | - |
2267 | -A multi-row INSERT involving three rows will require roughly one third of the time required to execute the three single-row statements. This performance improvement can become quite significant over a large number of statements. |
2268 | +'TODO' |
2269 | \ No newline at end of file |
2270 | |
2271 | === modified file 'docs/join.rst' |
2272 | --- docs/join.rst 2011-11-06 00:00:03 +0000 |
2273 | +++ docs/join.rst 2012-06-19 08:53:18 +0000 |
2274 | @@ -1,60 +1,7 @@ |
2275 | JOIN |
2276 | ==== |
2277 | |
2278 | -The JOIN keyword is used in an SQL statement to query data from two or more tables, based on a relationship between certain columns in these tables. |
2279 | - |
2280 | -Queries can access multiple tables at once, or access the same table in such a way that multiple rows of the table are being processed at the same time. For instance, in order to list all the 'interest' records together with the location of the associated city. To do this, it's necessary to compare the city column of each row of the 'Interests" table with the name column of all rows in the cities table, and select the pairs of rows where these values match. As such, a JOIN statement involves combining records from two tables by using values common to each. |
2281 | - |
2282 | -Take the "Interests" table: |
2283 | - |
2284 | -+---------+--------------+--------------+-------------+----------+ |
2285 | -|Id |DateAdded |InterestType |Name | userID | |
2286 | -+=========+==============+==============+=============+==========+ |
2287 | -| 1 |2011-01-02 | Sport |45 |2 | |
2288 | -+---------+--------------+--------------+-------------+----------+ |
2289 | -| 2 |2011-01-02 | Art |10 |4 | |
2290 | -+---------+--------------+--------------+-------------+----------+ |
2291 | -| 3 |2011-01-02 | Music |25 |1 | |
2292 | -+---------+--------------+--------------+-------------+----------+ |
2293 | -| 4 |2011-01-02 | Food |125 |1 | |
2294 | -+---------+--------------+--------------+-------------+----------+ |
2295 | -| 5 |2011-01-03 | Music |40 |2 | |
2296 | -+---------+--------------+--------------+-------------+----------+ |
2297 | -| 6 |2011-01-03 | Food |20 |3 | |
2298 | -+---------+--------------+--------------+-------------+----------+ |
2299 | - |
2300 | - |
2301 | -Note that the "Id" column is the primary key in the "Persons" table. This means that no two rows can have the same "Id"; it distinguishes two interests even if they have the same name or userID. |
2302 | - |
2303 | -Next, we have the "Persons" table: |
2304 | - |
2305 | -+---------+------------+----------+----------+--------+ |
2306 | -|userId |LastName |FirstName |Address | City | |
2307 | -+=========+============+==========+==========+========+ |
2308 | -| 1 | Larson | Sue |3 Cherry | Chicago| |
2309 | -+---------+------------+----------+----------+--------+ |
2310 | -| 2 | Roberts | Teri |21 Brown | Chicago| |
2311 | -+---------+------------+----------+----------+--------+ |
2312 | -| 3 | Peterson | Kari |30 Mell | Reno | |
2313 | -+---------+------------+----------+----------+--------+ |
2314 | -| 4 | Anderson | Kyle |435 Tyler | Dayton | |
2315 | -+---------+------------+----------+----------+--------+ |
2316 | - |
2317 | -The "userID" column is the primary key in the "Persons" table; in the "Persons" table, it can be used to identify users without using their names. Therefore, the relationship between the two tables above is the "userId" column. |
2318 | - |
2319 | -Different kinds of SQL JOINs |
2320 | ----------------------------- |
2321 | - |
2322 | -Here are the types of JOIN you can use, and the differences between them: |
2323 | - |
2324 | - **JOIN:** Return rows when there is at least one match in both tables |
2325 | - |
2326 | - **LEFT JOIN:** Return all rows from the left table, even if there are no matches in the right table |
2327 | - |
2328 | - **RIGHT JOIN:** Return all rows from the right table, even if there are no matches in the left table |
2329 | - |
2330 | - **CROSS JOIN:** Return rows when there is a match in one of the tables |
2331 | - |
2332 | +'TODO' |
2333 | |
2334 | .. note:: |
2335 | Implicit cartesian products of the form ``SELECT * FROM t1, t2`` |
2336 | |
2337 | === modified file 'docs/load_data_infile.rst' |
2338 | --- docs/load_data_infile.rst 2011-03-17 16:54:26 +0000 |
2339 | +++ docs/load_data_infile.rst 2012-06-19 08:53:18 +0000 |
2340 | @@ -1,39 +1,4 @@ |
2341 | LOAD DATA INFILE |
2342 | ================= |
2343 | |
2344 | -While the INSERT statement loads one record at a time into a table, LOAD DATA INFILE imports data from an external text file into a table, and does so very rapidly. The file name must be given as a literal string. |
2345 | - |
2346 | -For example: |
2347 | - |
2348 | -.. code-block:: mysql |
2349 | - |
2350 | - LOAD DATA LOCAL INFILE '/home/user/names.txt' INTO TABLE names; |
2351 | - |
2352 | -Then check that your data was loaded correctly: |
2353 | - |
2354 | -.. code-block:: mysql |
2355 | - |
2356 | - SELECT * FROM names; |
2357 | - |
2358 | -Options |
2359 | --------- |
2360 | - |
2361 | -LOAD DATA INFILE has some options that can be used to specify the format for the text file and how the data is imported. Above, the LOCAL option specifies the client machine as the location of the text file. When connecting to a Drizzle server, the file will be read directly from the server as long as the LOCAL option is omitted. |
2362 | - |
2363 | -The REPLACE option replaces table rows with the same primary key in the text file. For example: |
2364 | - |
2365 | -.. code-block:: mysql |
2366 | - |
2367 | - LOAD DATA LOCAL INFILE '/home/user/names.txt' REPLACE INTO TABLE names; |
2368 | - |
2369 | -The IGNORE option says to skip any rows that duplicate existing rows with the same primary key, and follows the same syntax as REPLACE. The IGNORE number LINES option can be used to ignore lines at the start of the file. For example, you can use IGNORE 1 LINES to skip over a row containing column names: |
2370 | - |
2371 | -.. code-block:: mysql |
2372 | - |
2373 | - LOAD DATA LOCAL INFILE '/home/user/names.txt' INTO TABLE names IGNORE 1 LINES; |
2374 | - |
2375 | -The FIELDS TERMINATED BY option can be used when importing from a comma separated value (CSV) file. (It specifies that the fields will be separated by a character other than a tab, such as a comma.) For example: |
2376 | - |
2377 | -.. code-block:: mysql |
2378 | - |
2379 | - LOAD DATA LOCAL INFILE '/home/user/names.csv' REPLACE INTO TABLE names FIELDS TERMINATED BY ','; |
2380 | +'TODO' |
2381 | \ No newline at end of file |
2382 | |
2383 | === modified file 'docs/orderby.rst' |
2384 | --- docs/orderby.rst 2011-10-23 16:01:37 +0000 |
2385 | +++ docs/orderby.rst 2012-06-19 08:53:18 +0000 |
2386 | @@ -1,7 +1,7 @@ |
2387 | ORDER BY |
2388 | ======== |
2389 | |
2390 | -The ORDER BY keyword is used to sort the result-set by column; by default, it sorts the records in ascending order. |
2391 | +'TODO' |
2392 | |
2393 | SQL ORDER BY Syntax: |
2394 | |
2395 | @@ -11,49 +11,4 @@ |
2396 | FROM table_name |
2397 | ORDER BY column_name(s) ASC|DESC; |
2398 | |
2399 | -**ORDER BY Example** |
2400 | - |
2401 | -The "Persons" table: |
2402 | - |
2403 | -+---------+------------+----------+----------+--------+ |
2404 | -|Id |LastName |FirstName |Address | City | |
2405 | -+=========+============+==========+==========+========+ |
2406 | -| 1 | Larson | Sue |3 Cherry | Chicago| |
2407 | -+---------+------------+----------+----------+--------+ |
2408 | -| 2 | Roberts | Teri |21 Brown | Chicago| |
2409 | -+---------+------------+----------+----------+--------+ |
2410 | -| 3 | Peterson | Kari |30 Mell | Reno | |
2411 | -+---------+------------+----------+----------+--------+ |
2412 | - |
2413 | -To select all the persons from the table above, and also sort them by their last name, use the following SELECT statement: |
2414 | - |
2415 | -.. code-block:: mysql |
2416 | - |
2417 | - SELECT * FROM Persons |
2418 | - ORDER BY LastName; |
2419 | - |
2420 | -The result-set will look like this: |
2421 | - |
2422 | -+---------+------------+----------+----------+--------+ |
2423 | -|Id |LastName |FirstName |Address | City | |
2424 | -+=========+============+==========+==========+========+ |
2425 | -| 1 | Larson | Sue |3 Cherry | Chicago| |
2426 | -+---------+------------+----------+----------+--------+ |
2427 | -| 3 | Peterson | Kari |30 Mell | Reno | |
2428 | -+---------+------------+----------+----------+--------+ |
2429 | -| 2 | Roberts | Teri |21 Brown | Chicago| |
2430 | -+---------+------------+----------+----------+--------+ |
2431 | - |
2432 | -Without using "ORDERBY" in the following query, the result-set will be non-deterministic, and could returned matching rows in a different order for each query. |
2433 | - |
2434 | -ORDER BY DESC can be used to reverse the order of the result set. |
2435 | - |
2436 | -.. code-block:: mysql |
2437 | - |
2438 | - SELECT * FROM Persons |
2439 | - ORDER BY LastName DESC; |
2440 | - |
2441 | - |
2442 | -.. todo:: |
2443 | - |
2444 | - add something about how ORDER BY is executed. index scan vs filesort |
2445 | +'TODO' |
2446 | \ No newline at end of file |
2447 | |
2448 | === modified file 'docs/queries.rst' |
2449 | --- docs/queries.rst 2011-02-15 22:03:42 +0000 |
2450 | +++ docs/queries.rst 2012-06-19 08:53:18 +0000 |
2451 | @@ -1,18 +1,13 @@ |
2452 | Executing Queries |
2453 | ================= |
2454 | |
2455 | -Queries retrieve data from a database based on specific criteria. They |
2456 | -are performed with the declarative SELECT statement, which has no |
2457 | -persistent effects on the database. SELECT simply retrieves data from |
2458 | -one or more tables, or expressions. |
2459 | - |
2460 | -A query includes a list of columns to be included in a result set; an example of this would be: |
2461 | +'TODO' |
2462 | |
2463 | .. code-block:: mysql |
2464 | |
2465 | SELECT * FROM table_name; |
2466 | |
2467 | -SELECT * FROM is an example of using SELECT with clauses. The select clause specifies the columns you want to retrieve. The from clause specifies the tables to search. |
2468 | +'TODO' |
2469 | |
2470 | Keywords and clauses include: |
2471 | |
2472 | @@ -34,8 +29,4 @@ |
2473 | FROM table_name |
2474 | WHERE first_column_name > 1000; |
2475 | |
2476 | -The column names that follow the SELECT keyword determine the columns that will be returned in the results. You can select as many column names that you'd like, or you can use a * to select all columns (as shown in the first example above). The order in which they are specified will be reflected in your query results. |
2477 | - |
2478 | -The table name that follows the keyword FROM specifies the table that will be queried to retrieve the desired results. |
2479 | - |
2480 | -The WHERE clause (optional) specifies the data values or rows to be returned or displayed, based on the criteria described after the keyword WHERE. |
2481 | +'TODO' |
2482 | \ No newline at end of file |
2483 | |
2484 | === modified file 'docs/rename.rst' |
2485 | --- docs/rename.rst 2011-11-06 00:00:03 +0000 |
2486 | +++ docs/rename.rst 2012-06-19 08:53:18 +0000 |
2487 | @@ -1,23 +1,13 @@ |
2488 | RENAME |
2489 | ====== |
2490 | |
2491 | -Rename a table, or group of tables. |
2492 | - |
2493 | -If you have an existing table old_name, you can create another table new_name; it will be empty but reptant he same structure, and then replace the existing table with the empty one as follows (assuming backup_table does not already exist): |
2494 | +'TODO' |
2495 | |
2496 | .. code-block:: mysql |
2497 | |
2498 | CREATE TABLE new_name (...); |
2499 | RENAME TABLE old_name TO backup_table, new_name TO old_name; |
2500 | |
2501 | -When using a statement to rename more than one table, the order of operations are done from left to right. To swap two table names, use the following (assuming tmp_table does not already exist): |
2502 | - |
2503 | -.. code-block:: mysql |
2504 | - |
2505 | - RENAME TABLE old_name TO tmp_table, |
2506 | - new_name TO old_name, |
2507 | - tmp_table TO new_name; |
2508 | - |
2509 | -While RENAME is running, no other session can access any of the involved tables. |
2510 | +'TODO' |
2511 | |
2512 | .. seealso:: :doc:`/alter_table` |
2513 | |
2514 | === modified file 'docs/resources/ascii_chart.rst' |
2515 | --- docs/resources/ascii_chart.rst 2011-02-23 15:33:37 +0000 |
2516 | +++ docs/resources/ascii_chart.rst 2012-06-19 08:53:18 +0000 |
2517 | @@ -1,103 +1,4 @@ |
2518 | ASCII Conversion Chart |
2519 | ======================= |
2520 | |
2521 | -========== =========== ============= ================= ================== |
2522 | - Binary Octal Decimal Hexadecimal Character |
2523 | -========== =========== ============= ================= ================== |
2524 | -100000 40 32 20 ``space character`` |
2525 | -100001 41 33 21 ``!`` |
2526 | -100010 42 34 22 ``"`` |
2527 | -100011 43 35 23 ``#`` |
2528 | -100100 44 36 24 ``$`` |
2529 | -100101 45 37 25 ``%`` |
2530 | -100110 46 38 26 ``&`` |
2531 | -100111 47 39 27 ``'`` |
2532 | -101000 50 40 28 ``(`` |
2533 | -101001 51 41 29 ``)`` |
2534 | -101010 52 42 2A ``*`` |
2535 | -101011 53 43 2B ``+`` |
2536 | -101100 54 44 2C ``,`` |
2537 | -101101 55 45 2D ``-`` |
2538 | -101110 56 46 2E ``.`` |
2539 | -101111 57 47 2F ``/`` |
2540 | -110000 60 48 30 ``0`` |
2541 | -110001 61 49 31 ``1`` |
2542 | -110010 62 50 32 ``2`` |
2543 | -110011 63 51 33 ``3`` |
2544 | -110100 64 52 34 ``4`` |
2545 | -110101 65 53 35 ``5`` |
2546 | -110110 66 54 36 ``6`` |
2547 | -110111 67 55 37 ``7`` |
2548 | -111000 70 56 38 ``8`` |
2549 | -111001 71 57 39 ``9`` |
2550 | -111010 72 58 3A ``:`` |
2551 | -111011 73 59 3B ``;`` |
2552 | -111100 74 60 3C ``<`` |
2553 | -111101 75 61 3D ``=`` |
2554 | -111110 76 62 3E ``>`` |
2555 | -111111 77 63 3F ``?`` |
2556 | -1000000 100 64 40 ``@`` |
2557 | -1000001 101 65 41 ``A`` |
2558 | -1000010 102 66 42 ``B`` |
2559 | -1000011 103 67 43 ``C`` |
2560 | -1000100 104 68 44 ``D`` |
2561 | -1000101 105 69 45 ``E`` |
2562 | -1000110 106 70 46 ``F`` |
2563 | -1000111 107 71 47 ``G`` |
2564 | -1001000 110 72 48 ``H`` |
2565 | -1001001 111 73 49 ``I`` |
2566 | -1001010 112 74 4A ``J`` |
2567 | -1001011 113 75 4B ``K`` |
2568 | -1001100 114 76 4C ``L`` |
2569 | -1001101 115 77 4D ``M`` |
2570 | -1001110 116 78 4E ``N`` |
2571 | -1001111 117 79 4F ``O`` |
2572 | -1010000 120 80 50 ``P`` |
2573 | -1010001 121 81 51 ``Q`` |
2574 | -1010010 122 82 52 ``R`` |
2575 | -1010011 123 83 53 ``S`` |
2576 | -1010100 124 84 54 ``T`` |
2577 | -1010101 125 85 55 ``U`` |
2578 | -1010110 126 86 56 ``V`` |
2579 | -1010111 127 87 57 ``W`` |
2580 | -1011000 130 88 58 ``X`` |
2581 | -1011001 131 89 59 ``Y`` |
2582 | -1011010 132 90 5A ``Z`` |
2583 | -1011011 133 91 5B ``[`` |
2584 | -1011100 134 92 5C ``\`` |
2585 | -1011101 135 93 5D ``]`` |
2586 | -1011110 136 94 5E ``^`` |
2587 | -1011111 137 95 5F ``_`` |
2588 | -1100000 140 96 60 :literal:`\`` |
2589 | -1100001 141 97 61 ``a`` |
2590 | -1100010 142 98 62 ``b`` |
2591 | -1100011 143 99 63 ``c`` |
2592 | -1100100 144 100 64 ``d`` |
2593 | -1100101 145 101 65 ``e`` |
2594 | -1100110 146 102 66 ``f`` |
2595 | -1100111 147 103 67 ``g`` |
2596 | -1101000 150 104 68 ``h`` |
2597 | -1101001 151 105 69 ``i`` |
2598 | -1101010 152 106 6A ``j`` |
2599 | -1101011 153 107 6B ``k`` |
2600 | -1101100 154 108 6C ``l`` |
2601 | -1101101 155 109 6D ``m`` |
2602 | -1101110 156 110 6E ``n`` |
2603 | -1101111 157 111 6F ``o`` |
2604 | -1110000 160 112 70 ``p`` |
2605 | -1110001 161 113 71 ``q`` |
2606 | -1110010 162 114 72 ``r`` |
2607 | -1110011 163 115 73 ``s`` |
2608 | -1110100 164 116 74 ``t`` |
2609 | -1110101 165 117 75 ``u`` |
2610 | -1110110 166 118 76 ``v`` |
2611 | -1110111 167 119 77 ``w`` |
2612 | -1111000 170 120 78 ``x`` |
2613 | -1111001 171 121 79 ``y`` |
2614 | -1111010 172 122 7A ``z`` |
2615 | -1111011 173 123 7B ``{`` |
2616 | -1111100 174 124 7C ``|`` |
2617 | -1111101 175 125 7D ``}`` |
2618 | -1111110 176 126 7E ``~`` |
2619 | -========== =========== ============= ================= ================== |
2620 | - |
2621 | +'TODO' |
2622 | |
2623 | === modified file 'docs/savepoints.rst' |
2624 | --- docs/savepoints.rst 2011-02-15 22:03:42 +0000 |
2625 | +++ docs/savepoints.rst 2012-06-19 08:53:18 +0000 |
2626 | @@ -1,11 +1,11 @@ |
2627 | SAVEPOINT |
2628 | ========= |
2629 | |
2630 | -A savepoint is a marker inside a transaction that allows all commands that are executed after it was established to be rolled back. It effectively restores the transaction state to what it was at the time of the savepoint. :: |
2631 | +'TODO' :: |
2632 | |
2633 | SAVEPOINT identifier |
2634 | |
2635 | -This sets a savepoint that can be returned to in the current transaction. The "identifier" is the name given to the new savepoint. If the identifier has already been used then the original identifier is replaced. Example: |
2636 | +'TODO' |
2637 | |
2638 | .. code-block:: mysql |
2639 | |
2640 | @@ -15,4 +15,4 @@ |
2641 | INSERT INTO t1 values (2); |
2642 | ROLLBACK TO SAVEPOINT A; |
2643 | |
2644 | -Will only roll back the second insert statement. |
2645 | +'TODO' |
2646 | |
2647 | === modified file 'docs/start_transaction.rst' |
2648 | --- docs/start_transaction.rst 2011-02-23 13:08:09 +0000 |
2649 | +++ docs/start_transaction.rst 2012-06-19 08:53:18 +0000 |
2650 | @@ -1,7 +1,7 @@ |
2651 | START TRANSACTION |
2652 | ====================== |
2653 | |
2654 | -A transaction can be started with either the BEGIN or START TRANSACTION statements. It can also be started by any statement when AUTOCOMMIT is disabled. A transaction can then run until either the connection to the database is dropped (in which case it is rolled back), or an explicit rollback or a commit command is sent. |
2655 | +'TODO' |
2656 | |
2657 | .. code-block:: mysql |
2658 | |
2659 | |
2660 | === modified file 'docs/string_data_types.rst' |
2661 | --- docs/string_data_types.rst 2011-03-17 17:15:30 +0000 |
2662 | +++ docs/string_data_types.rst 2012-06-19 08:53:18 +0000 |
2663 | @@ -1,12 +1,11 @@ |
2664 | String Data Types |
2665 | ================= |
2666 | |
2667 | -The string types in Drizzle are explained in the following groupings: |
2668 | |
2669 | VARCHAR and VARBINARY |
2670 | --------------------- |
2671 | |
2672 | -A VARCHAR or VARBINARY type is used to store variable length data. Indexes on these types are by default the full length of the data stored. The only difference between the two types is the COLLATION which is used. VARBINARY uses a binary collation for all index usage. |
2673 | +'TODO' |
2674 | |
2675 | .. note:: |
2676 | |
2677 | @@ -16,15 +15,15 @@ |
2678 | TEXT and BLOB |
2679 | ------------- |
2680 | |
2681 | -A TEXT or BLOB type is used to store data which is over XXX in size. Indexes on these types must specify the number of character or bytes which should be used. The only difference between the two types is the COLLATION which is used. A BLOB uses a binary collation for all index usage. |
2682 | +'TODO' |
2683 | |
2684 | ENUM |
2685 | ---- |
2686 | |
2687 | -Enum (enumerated) types are static lists of strings that are defined on table creation. They can be used to represent a collection of string types that are sorted based on the order that they are created. |
2688 | +'TODO' |
2689 | |
2690 | |
2691 | UTF-8 |
2692 | ------ |
2693 | |
2694 | -Drizzle stores its string data in an UTF-8 format, and does not support a multitude of language encodings and collations. |
2695 | \ No newline at end of file |
2696 | +'TODO' |
2697 | \ No newline at end of file |
2698 | |
2699 | === modified file 'docs/tables.rst' |
2700 | --- docs/tables.rst 2011-01-14 05:11:22 +0000 |
2701 | +++ docs/tables.rst 2012-06-19 08:53:18 +0000 |
2702 | @@ -1,17 +1,7 @@ |
2703 | Tables |
2704 | ====== |
2705 | |
2706 | -A table makes up a collection of :doc:`/columntypes` that |
2707 | -can be joined together in order to create relational result sets. |
2708 | - |
2709 | -Each record in the table is called a row, and a table can have an infinite |
2710 | -set of rows. Each row represents one piece of data, and each column can |
2711 | -be thought of as representing a component of that piece of data. |
2712 | - |
2713 | -So, for example, if we have a table for a customer information, then |
2714 | -the columns may include information such as First Name, Last Name, |
2715 | -Address, City, Country, Birth Date, and so on. As a result, tables have |
2716 | -column headers, which specify the data types for that particular column. |
2717 | +'TODO' |
2718 | |
2719 | .. toctree:: |
2720 | :maxdepth: 2 |
2721 | |
2722 | === modified file 'docs/transactional.rst' |
2723 | --- docs/transactional.rst 2011-02-23 13:08:09 +0000 |
2724 | +++ docs/transactional.rst 2012-06-19 08:53:18 +0000 |
2725 | @@ -9,7 +9,7 @@ |
2726 | rollback |
2727 | savepoints |
2728 | |
2729 | -The essence of a transaction is that it groups multiple steps into a single, all-or-nothing operation. Drizzle is a transactional database by default and by design, meaning that changes and queries to the database appear to be Atomic, Consistent, Isolated, and Durable (ACID). This means that Drizzle implements `serializable <http://en.wikipedia.org/wiki/Serializability>`_, ACID transactions, even if the transaction is interrupted. |
2730 | +Drizzle is a transactional database by default and by design, meaning that changes and queries to the database appear to be Atomic, Consistent, Isolated, and Durable (ACID). This means that Drizzle implements `serializable <http://en.wikipedia.org/wiki/Serializability>`_, ACID transactions, even if the transaction is interrupted. |
2731 | |
2732 | NOTE: Drizzle still supports non-transactional storage engines, and if these are used then you will not get transactional behaviour with them. The default engine is transactional. |
2733 | |
2734 | |
2735 | === modified file 'docs/update.rst' |
2736 | --- docs/update.rst 2011-02-16 22:57:39 +0000 |
2737 | +++ docs/update.rst 2012-06-19 08:53:18 +0000 |
2738 | @@ -1,20 +1,4 @@ |
2739 | Updating Data |
2740 | ============= |
2741 | |
2742 | -In Drizzle you can make use of UPDATE to modify an existing record in a table. |
2743 | - |
2744 | -An example query: |
2745 | - |
2746 | -.. code-block:: mysql |
2747 | - |
2748 | - UPDATE TABLE_1 SET a="1" WHERE <condition>; |
2749 | - |
2750 | -Multi-table delete and multi-table update code was removed from Drizzle. |
2751 | - |
2752 | -Multi-update/delete can be accomplished through subqueries. For example: |
2753 | - |
2754 | -.. code-block:: mysql |
2755 | - |
2756 | - UPDATE tableX SET tableXfield = (SELECT MAX(tableY.tableYfield) FROM tableY WHERE tableX.tableXfield = tableY.tableYfield) |
2757 | - |
2758 | -In other database frameworks, multi-update and multi-delete are used to change information in *one* table, but the rows to change are determined by using more than one table. In that case, subqueries work to address the issue of changing information in one table based on information in more than one table. |
2759 | +'TODO' |
2760 | |
2761 | === modified file 'docs/uuid_data_type.rst' |
2762 | --- docs/uuid_data_type.rst 2011-02-24 14:52:15 +0000 |
2763 | +++ docs/uuid_data_type.rst 2012-06-19 08:53:18 +0000 |
2764 | @@ -1,16 +1,6 @@ |
2765 | UUID Data Type |
2766 | ============== |
2767 | |
2768 | -The data type uuid stores Universally Unique Identifiers (UUID). Some systems refer to this data type as "globally unique identifier", or GUID, instead. |
2769 | - |
2770 | -This identifier is a 128-bit quantity that is generated by an algorithm designed to make it very unlikely that the same identifier will be generated by anyone else in the world using the same algorithm. The purpose of UUIDs is to enable distributed systems to uniquely identify information without significant central coordination. |
2771 | - |
2772 | -sequence generators, which are only unique within a single database. |
2773 | - |
2774 | -A UUID consists of 32 hexadecimal digits, displayed in 5 groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 digits and 4 hyphens). For example: |
2775 | - |
2776 | -550e8400-e29b-41d4-a716-446655440000 |
2777 | - |
2778 | -UUIDs are documented as part of ISO/IEC 11578:1996 "Information technology – Open Systems Interconnection – Remote Procedure Call (RPC)" and more recently in ITU-T Rec. X.667 | ISO/IEC 9834-8:2005. The IETF published Standards Track :rfc:`4122` that is technically equivalent with ITU-T Rec. X.667 | ISO/IEC 9834-8. |
2779 | +'TODO' |
2780 | |
2781 | Drizzle uses libuuid to generate UUID values. |
2782 | |
2783 | === modified file 'docs/where.rst' |
2784 | --- docs/where.rst 2011-10-23 16:01:37 +0000 |
2785 | +++ docs/where.rst 2012-06-19 08:53:18 +0000 |
2786 | @@ -1,9 +1,7 @@ |
2787 | WHERE |
2788 | ===== |
2789 | |
2790 | -The WHERE clause is used to extract only those records that fulfill a specified criterion. |
2791 | - |
2792 | -Simple SQL WHERE Syntax: |
2793 | +'TODO' |
2794 | |
2795 | .. code-block:: mysql |
2796 | |
2797 | @@ -11,33 +9,4 @@ |
2798 | FROM table_name |
2799 | WHERE column_name operator value |
2800 | |
2801 | -**Simple WHERE Clause Example** |
2802 | - |
2803 | -The "Persons" table: |
2804 | - |
2805 | -+---------+------------+----------+----------+--------+ |
2806 | -|Id |LastName |FirstName |Address | City | |
2807 | -+=========+============+==========+==========+========+ |
2808 | -| 1 | Larson | Sue |3 Cherry | Chicago| |
2809 | -+---------+------------+----------+----------+--------+ |
2810 | -| 2 | Roberts | Teri |21 Brown | Chicago| |
2811 | -+---------+------------+----------+----------+--------+ |
2812 | -| 3 | Peterson | Kari |30 Mell | Reno | |
2813 | -+---------+------------+----------+----------+--------+ |
2814 | - |
2815 | -If you want to select only the persons living in the city "Chicago" from the table above, use the following SELECT statement: |
2816 | - |
2817 | -.. code-block:: mysql |
2818 | - |
2819 | - SELECT * FROM Persons |
2820 | - WHERE City='Chicago' |
2821 | - |
2822 | -The result-set will look like this: |
2823 | - |
2824 | -+---------+------------+----------+----------+--------+ |
2825 | -| Id |LastName |FirstName |Address |City | |
2826 | -+=========+============+==========+==========+========+ |
2827 | -|1 | Larson | Sue |3 Cherry | Chicago| |
2828 | -+---------+------------+----------+----------+--------+ |
2829 | -|2 | Roberts | Teri |21 Brown | Chicago| |
2830 | -+---------+------------+----------+----------+--------+ |
2831 | +'TODO' (examples) |
2832 | \ No newline at end of file |
Will it merge with 7.1?