~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/queries.rst

  • Committer: Brian Aker
  • Date: 2010-12-24 03:44:02 UTC
  • mfrom: (2015.1.3 timestamp)
  • mto: This revision was merged to the branch mainline in revision 2028.
  • Revision ID: brian@tangent.org-20101224034402-n1hpg1yxwjz59hpw
Finish up issues with unsigned/int by fixing cast().

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Executing Queries
 
1
Executing Queries 
2
2
=================
3
3
 
4
4
Queries retrieve data from a database based on specific criteria. They
6
6
persistent effects on the database. SELECT simply retrieves data from
7
7
one or more tables, or expressions.
8
8
 
9
 
A query includes a list of columns to be included in a result set; an example of this would be:
10
 
 
11
 
.. code-block:: mysql
 
9
A query includes a list of columns to be included in a result set; an example of this would be:  ::
12
10
 
13
11
        SELECT * FROM table_name;
14
12
 
15
 
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. 
 
13
SELECT * FROM is an example of using SELECT with a clause. The select clause specifies the columns you want to retrieve. The from clause specifies the tables to search. 
16
14
 
17
15
Keywords and clauses include:
18
16
 
19
 
.. toctree::
20
 
   :maxdepth: 2
21
 
 
22
 
   where
23
 
   distinct
24
 
   groupby
25
 
   having
26
 
   orderby
27
 
   join
28
 
 
29
 
For example:
30
 
 
31
 
.. code-block:: mysql
 
17
* The FROM clause
 
18
* The WHERE clause
 
19
* The GROUP BY clause
 
20
* The HAVING clause
 
21
* The ORDER BY clause
 
22
 
 
23
For example, ::
32
24
 
33
25
        SELECT first_column_name, second_column_name
34
26
        FROM table_name
35
27
        WHERE first_column_name > 1000;
36
28
 
37
 
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.
38
 
 
39
 
The table name that follows the keyword FROM specifies the table that will be queried to retrieve the desired results.
40
 
 
41
 
The WHERE clause (optional) specifies the data values or rows to be returned or displayed, based on the criteria described after the keyword WHERE.
 
29
*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.
 
30
 
 
31
*The table name that follows the keyword FROM specifies the table that will be queried to retrieve the desired results.
 
32
 
 
33
*The WHERE clause (optional) specifies the data values or rows to be returned or displayed, based on the criteria described after the keyword WHERE.
 
 
b'\\ No newline at end of file'