Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
MySQL
Select Clause 430 codes
Home
MySQL
Select Clause
1 (Greater than and equals)= ALL
2 = and subquery
3 A DELETE statement can be qualified by using an ORDER BY and a LIMIT clause
4 A less fine-grained summary can be obtained by using only the month values
5 A two-query approach
6 Add the WITH ROLLUP option to the GROUP BY clause
7 Add up count value from subquery
8 Advancing the rank only when values change
9 Aggregate function in subquery
10 Alias for calculated value
11 Alias subquery
12 Alias the union tables in subquery
13 ALL operator requires that all values returned by the subquery must cause the expression to evaluate to true b
14 Alter table
15 Another Count and Group BY
16 Another decendingly
17 Another GROUP BY
18 Another ORDER BY and limit
19 Another way to group statements is to turn off auto-commit mode explicitly
20 Arithmetic Operators
21 Ascertain the most common initial letter for state names like this
22 Assign a constant to a variable
23 Assign and create three variables inside one select statement
24 Assign the result from a sql to a variable
25 Assign the result of an aggregate function to a variable
26 Assign value to a variable with
27 Assigning Ranks
28 Assin constant value to a variable
29 Average distinct value
30 Between and opertor and subquery
31 But LIMIT allows you to return only that record
32 Calculate the overall average and save it in a variable, then compare each drivers average to the saved value
33 Calculating Linear Regressions or Correlation Coefficients
34 Calculation
35 Calculation in subquery
36 Calculation in subquery and use the result from outside
37 Can the result of a SELECT statement be assigned to a user variable
38 Categorize groups on a logarithmic scale
39 Check the state of the variables with the following command
40 Choose specific columns
41 Columns specified by positions or by aliases can be sorted in either ascending or descending order
42 Compare decimal type variables
43 Compare NULL with = operator
44 Compare to a variable
45 Compare to aggregate function
46 Compare two data type value together
47 COMPARISON OPERATORS WITH SUBQUERIES
48 Comparing a Table to Itself
49 Comparison Operators
50 Comparison operators 2
51 Comparison Operators and null
52 Comparisons with a large number of values can be carried out easily with IN
53 Constant value with in opertator
54 Controlling Summary Display Order
55 Convert the output column and sort that-but doing so affects the displayed values, possibly in an undesirable
56 Count and Count all
57 Count and group
58 Count and group by two columns
59 Count and rollup
60 Count and subquery in Having clause
61 COUNT command with condition
62 Count distinct
63 Count how many states joined the Union on each day of the week, grouped by day name, the results will be sorte
64 Count value in subquery
65 COUNT with condition and group
66 COUNT() and GROUP BY
67 Counting Rows
68 Create and set MySQL variable
69 Create constant value in subquery
70 Create table
71 Create the user variable PLAYERNO and initialize it with the value 7
72 Create view for union
73 Create view for union constants
74 Creating Unions That Join
75 Data calculation inside in operator
76 Default sort order is ascending
77 Define and use variable in select clause
78 Delete command with sub query
79 Delete from the Orders table any order for the book title Where Im Calling From
80 Delete with order by and limit clause
81 Determine how many books have been ordered for authors who have more than one book listed in the Books table
82 Determines all employees whose names contain the sequence of letters er
83 Determining the Number of Records Suppressed by LIMIT (SQL_CALC_FOUND_ROWS, FOUND_ROWS)
84 Determining Whether Values are Unique
85 DISTINCT with two columns
86 DISTINCT works with expressions, not just column values
87 DISTINCT works with multiple-column output too
88 Display all data in hers and his sorted by id
89 Display all data in ps_games, xbox_games and cube_games as a single result set
90 Display all products - including those with no orders
91 Display order number, quantity, item name, vendor and total order value of order number 2805
92 Display the composite names, but refer to the constituent values in the ORDER BY clause
93 Display the names of only those authors whose surname starts with one of the letters L through Z
94 Displaying One Set of Values While Sorting by Another
95 Distinct sub string
96 Dividing a Summary into Subgroups
97 Do math calculation with select
98 Eliminating Duplicate Data Using DISTINCT 1
99 Eliminating Duplicate Data Using DISTINCT 2
100 Enclose a given SELECT (including its ORDER BY clause) within parentheses
101 Equals any
102 Equals operator with subquery
103 Equals to the result of subquery
104 Exists and subquery
105 Explain select command
106 Explicit evaluation order
107 Find out how many books you have per author, use this query
108 Find the match numbers and the number of sets won and lost of all matches that were won 3-1 or 3-2
109 Finding people who didnt send mail to themselves
110 Finding Rows Containing Per-Group Minimum or Maximum Values
111 Floating Specific Values to the Head or Tail of the Sort Order
112 Four-level nested subquery with alias
113 From a subquery
114 Get GROUP BY for COUNT
115 Get players whose combination of name and initials comes before player 6 in alphabetical order
116 Get substring for a value from subquery
117 Get the number of orders per customer
118 Get the number, name, and date of birth of each player resident in Stratford; sort the result in alphabetical
119 Get the order number and number of items ordered where the color is not Pink and the number of items ordered i
120 Give the expression an alias in the output column list and refer to the alias in the GROUP BY clause
121 Global System Variables versus System Variables at the Connection Level
122 Greater than and equals all value from subquery
123 Greater than any elements from subquery
124 Greater than the result of subquery
125 Greater than two values in subquery
126 GROUP and HAVING with sub query
127 GROUP and sort the records
128 Group by and order by for linked tables
129 Group by calculated value
130 Group by DAYOFWEEK( )
131 GROUP BY for Several Columns
132 Group by multiple expressions if you like
133 GROUP BY returns a final sum for the first column and supplementary partial sums for the second column
134 Group by then order by vs Group by only
135 Group by two columns
136 GROUP BY WITH ROLLUP
137 GROUP BY with order and HAVING
138 Group mail table records into categories of 100,000 bytes
139 GROUP value and count
140 Group value in subquery
141 Grouping by Expression Results
142 Grouping Data
143 HAVING COUNT() 1
144 HAVING SUM(AMOUNT) 150
145 Having clause with subquery
146 How many different drivers there are, use COUNT(DISTINCT)
147 How many of those states joined the Union in the 19th century
148 Identifying What Values to Display
149 If the variable has not been used previously, that value is NULL
150 If you want to retrieve a value for a session variable, rather than a global variable
151 If youre retrieving the value of a global variable, you must also precede the variable name with the global keyword
152 In a list of value from subquery
153 In operator and a long list of integer
154 In operator and char type
155 In operator and subquery
156 Include a WHERE clause-but only to select rows, not to test summary values
157 Indicate of ascend
158 Insert statement with subquery
159 Insert statement with variable
160 Insert with union result
161 Inserting name values into the multisequence table generates separate sequences for each distinct name
162 Joining Results with UNION
163 Less than all value from subquery
164 Less than and equals all records from subquery
165 Less than and equals(=) operators with All operator
166 Less than and subquery(ERROR 1242 (21000)
167 Less than data type value from subquery
168 Less than two values in subquery
169 LIMIT 5 OFFSET 3
170 Limit the query results
171 Limit then union
172 Limit to first three columns
173 Limiting a Selection Using LIMIT
174 Limiting the Number of Results
175 Limits and order
176 Maximum-per-group problem for this table
177 Minus value from subquery
178 Missing and non-missing counts can be determined for subgroups as well
179 Mix constant value and subquery
180 Narrow down data with condition and order it
181 Nested subqueries
182 Nested subquery
183 Nested subquery and in operator
184 Nested subquery and where clause
185 Nested three level subquery
186 Not equal
187 Not exists and subquery of all columns
188 Not exists and subquery of constant value
189 Not in and subquery
190 Not operator
191 Or operator vs in operator
192 ORDER and limit
193 Order by alias name
194 Order BY and Limit
195 Order by calculated value
196 Order by char type
197 Order by index
198 Order by one column descending and another one ascending
199 ORDER BY RAND
200 Order by sub string
201 Order by sum result
202 Order by value from subquery
203 Order decending
204 Order result wiht ORDER
205 Order row in select clause
206 Order the rows with the largest SUM( ) values first and use LIMIT to select the first record
207 Order then choose the first rows
208 Order two columns with different orders
209 Ordinary variables indicated by a prefixed @ sign
210 Pair value within in operator and subquery
211 Parentheses may be used to group alternations
212 Pattern match with LIKE
213 Pattern Matching with LIKE
214 Performing a Single Row INSERT
215 Performing Mathematics
216 Performing Row and Column Counting
217 Processing the First or Last n Records
218 Provide an alias to make a heading more concise or meaningful
219 Pulling a Section from the Middle of a Result Set
220 Put branket for union
221 Putting the expression directly in the ORDER BY clause
222 Refer to Sort Columns
223 Refer to the alias in the ORDER BY clause
224 Reference column in select command
225 Removing duplicates and selecting only the unique combinations of values in the specified columns
226 Retrieve all columns in a table
227 Retrieving the Top Five Students
228 Return a list of surnames, with each surname appearing only once
229 Return the session system variables
230 Return the third, fourth, and fifth records sorted in descending order on the commission field
231 Returns all global variables and their settings
232 Returns book information about any books that have a copyright date greater than any books
233 Reversing or Negating Query Conditions
234 ROW and ANY
235 Row comparison method
236 Row data comparison
237 Row value comparison
238 Row value comparison and sunqueries
239 Row value comparison with select statement
240 Row values and subquery
241 Row values comparison for subquery
242 Scrolling through the entire product table four records at a time
243 Search string with order
244 Searching for Titles Without Authors
245 SELECT AA LIKE A%, AA LIKE A%, A% LIKE A%
246 Select calculated value with alias
247 Select clause with condition
248 Select distinct records using JOIN
249 Select from the result of subquery
250 Select from three subqueries
251 Select from two subqueries
252 Select rows
253 SELECT statement defines two variables
254 SELECT statement includes a HAVING clause that contains one condition
255 SELECT statement includes a LIMIT clause that specifies an offset value of 3 and a row count value of 4
256 SELECT statement includes an ORDER BY clause that sorts the result set according to two columns
257 SELECT statement includes three select list elements
258 SELECT statement uses the NOT IN operator
259 Selecting Records from the Beginning or End of a Result Set
260 Selecting Records in Parallel from Multiple Tables
261 Set a variable specifically
262 Set the query_cache_limit variable to 1000000 at the global level
263 Setting a Unique Constraint
264 Shows those hours of the day during which no messages were sent by using a HAVING clause that selects only sum
265 Simple COUNT
266 Simple demo for IN
267 Simple demo for NOT IN
268 Simple GROUP BY
269 Simple LIMIT
270 Simple ORDER by
271 Simple Retrieval
272 Sort by position
273 Sort columns in different directions
274 Sort data then do the union (ERROR 1221 (HY000)
275 Sort direction
276 Sort drivers according to who drove the most days or miles, add the appropriate ORDER BY clause
277 Sort on multiple columns
278 Sort Operators
279 Sort the column by the order in which colors occur in the rainbow
280 Sort the result set in a specific order with Union
281 Sort the results using the underlying column values rather than the displayed composite values
282 Sorting Data
283 Sorting Dotted-Quad IP Values in Numeric Order
284 Sorting Expression Results
285 Sorting hostname values correctly in right-to-left fashion
286 Sorting Hostnames in Domain Order
287 Sorting in User-Defined Orders
288 Sorting Rows
289 Sorting Subsets of a Table
290 Special = operator, which is like = except that it works with NULL operands by treating them as any other va
291 Specifies two columns in the GROUP BY clause
292 SQL variables hold single values
293 SQL variables may be used to store the results of intermediate calculations
294 Sub queries
295 Sub query with ALL command
296 Sub query with ANY command
297 Sub query with calculation
298 Sub query with EXISTS command
299 Sub query with IN command
300 Sub query with not equal and order
301 Sub query with NOT EXISTS command
302 Sub query with NOT IN command
303 Sub query with string concatenate
304 Subqueries As Calculated Columns
305 Subqueries in the WHERE Clause 2
306 Subqueries That Return Multiple Results
307 Subquery
308 Subquery and equals operator(ERROR 1242 (21000)
309 Subquery as a table
310 Subquery uses an aggregate function to arrive at a value that the outer statement can use
311 Subquery with ANY
312 Subquery with EXISTS
313 Subquery with having clause
314 Subquery with limit clause
315 SubSELECTs Syntax Variants
316 Sum with rollup
317 System and server variables
318 Tell MySQL what offset to use, from which result to start limiting
319 The default offset is 0, so by specifying an offset of 1, youre taking the second record
320 The EXISTS and NOT EXISTS operators are used only to test whether a subquery does or does not produce any resu
321 The expression in the select list subtracts the Reserved value from the total
322 The expressions display state names in lexical order within each row
323 The fraction of the records that contain unique or non-unique names
324 The lack of case sensitivity also applies to relative ordering comparisons
325 The LIMIT clause takes two arguments, as the following syntax shows
326 The Order in Which MySQL Processes Conditions
327 THE ROW EXPRESSION
328 The sorting is performed on the entire UNION If you just want to sort the second SELECT, youd need to use pa
329 The SQL key word DISTINCT has the effect that equivalent data records are output only once
330 Three row value comparison
331 To achieve the desired output order, display the string, but use the actual numeric size for sorting
332 To be more specific and find out how many messages each sender sent from each host, use two grouping columns
333 To calculate a standard deviation based on n-1 degrees of freedom instead
334 To find a value and save it in a variable
335 To find message senderrecipient pairs between whom only one message was sent
336 To invert a pattern match, use NOT LIKE rather than LIKE
337 To make the lexical ordering correspond to the numeric ordering
338 To select a single winner from each table and combine the results
339 To select all records, including duplicates, follow the first UNION keyword with ALL
340 To set a session-level variable
341 To set a variable explicitly to a particular value, use a SET statement
342 To sort by country code, use the rightmost two characters of the id values
343 To sort by product category, extract the category value and use it in the ORDER BY clause
344 To sort in reverse (descending) order
345 To sort the result set as a whole, add an ORDER BY clause after the final SELECT statement
346 To sort those records in calendar order, use the birthmonth and birthday columns
347 To use a GROUP BY clause effectively, you should also include a select list element that contains a function t
348 To use a SQL variable, store the highest price in it, then use the variable to identify the record containing
349 To use the substrings for sorting, use the appropriate expressions in the ORDER BY clause
350 Two USING clauses, rather than ON clauses
351 UNION does not return duplicate results (similar to the DISTINCT keyword)
352 Union all
353 Union columns from different tables
354 Union constant value
355 Union constant values
356 Union grouped value
357 Union numbers
358 Union start dates and end dates
359 Union the result of sum() aggregate function
360 Union the same tables
361 Union the subquery
362 Union with sorted data
363 Update command with sub query
364 Use a derived table
365 Use a not equal () comparison operator in the WHERE clause to introduce the subquery
366 Use a two-stage approach involving one query that selects the maximum size into a SQL variable, and another th
367 Use a wildcard () to return all the fields
368 Use alias
369 Use AVG and alias
370 Use COUNT and GROUP
371 Use COUNT in select command
372 Use COUNT with condition
373 Use COUNT, GROUP and HAVING
374 Use defined variable in new select clause
375 Use DISTICNT to get unique value
376 Use DISTINCT to get non-dupliate records
377 Use GROUP BY
378 Use GROUP BY 2
379 Use GROUP BY and ORDER BY together
380 Use GROUP BY clause to list only the unique data
381 Use IN and BETWEEN AND
382 Use IN and order rows
383 Use IN for static values
384 Use IN for string value
385 Use IN in where clause
386 Use LIKE
387 Use LIKE for matching substring
388 Use LIKE in where clause
389 Use LIMIT
390 Use LIMIT in SELECT
391 Use of Variables
392 Use ORDER BY to list
393 Use order by to sort the result
394 Use ORDER BY to sort the result set Then you can use LIMIT to find smallest and largest values
395 Use SUM and alias
396 Use the basic mathematical operators
397 Use the differential as follows to produce team standings that include winning percentage and GB values
398 Use the name column to place the rows in groups, but the summary functions operate on the miles values
399 Use the NOT EXISTS operator in the same way as the EXISTS operator, only the opposite results are returned
400 Use two ORDER BY fields
401 User Variables
402 Uses a subquery to return an AuthID value
403 USING command in JOIN
404 Using Aliases
405 Using concat to create value for variable
406 Using constant string value as comment message for aggregate function
407 Using function with result from subquery
408 Using Functions to Perform System-Related Operations
409 Using IN command in sub query
410 Using LIKE with SQL Pattern Matches
411 Using math function in HAVING
412 Using mysql as a Calculator
413 Using select into to assign value to variabls
414 Using SQL Variables in Queries
415 Using the aliases p1 and p2 to refer to the book table different ways
416 Using the value from subquery with in operator
417 Using Union for subquery
418 Using variable in where clause
419 Using variable the calculate the new column ID
420 Using variable to pass value between sql statement
421 Value calculation of subquery
422 Variable Assignment
423 Variable names are case sensitive
424 Variables can be assigned values from arbitrary expressions
425 Where clause
426 WHERE clause can include additional logical operators and expressions that further limit the results returned
427 Which states joined the Union in the same year as New York
428 Working with Grouped Data
429 Working with Per-Group and Overall Summary Values Simultaneously
430 Write the GROUP BY clause to refer to the output column position