<< previous page   --   table of contents   --   next page >>
| | | | | | | |
  • Return to Table of Contents
  • Table of Contents

    1. General Information
    2. MySQL Installation
    3. Tutorial Introduction
    4. Database Administration
    5. MySQL Optimisation
    6. MySQL Language Reference
    7. MySQL Table Types
    8. MySQL APIs
    9. Extending MySQL

    Chapter 6:  MySQL Language Reference 447 BIT_AND(expr) Returns the bitwise AND of all bits in expr.  The calculation is performed with 64-bit (BIGINT) precision. MySQL  has  extended  the  use  of  GROUP BY.   You  can  use  columns  or  calculations  in  the SELECT  expressions that don't appear in the  GROUP BY  part.  This stands for  any  possible value  for  this  group.  You can use this to get better performance by avoiding sorting and grouping on unnecessary items.  For example, you don't need to group on customer.name in the following query: mysql> SELECT order.custid,customer.name,MAX(payments) -> FROM order,customer -> WHERE order.custid = customer.custid -> GROUP BY order.custid; In ANSI SQL, you would have to add customer.name to the GROUP BY clause.  In MySQL, the name is redundant if you don't run in ANSI mode. Don't use this feature if the columns you omit from the GROUP BY part aren't unique in the group!  You will get unpredictable results. In some cases, you can use  MIN()  and  MAX()  to obtain a speci c column value even if it isn't unique.  The following gives the value of column from the row containing the smallest value in the sort column: SUBSTR(MIN(CONCAT(RPAD(sort,6,' '),column)),7) See Section 3.5.4 [example-Maximum-column-group-row], page 170. Note that if you are using MySQL Version 3.22 (or earlier) or if you are trying to follow ANSI SQL, you can't use expressions in GROUP BY or ORDER BY clauses. You can work around this limitation by using an alias for the expression: mysql> SELECT id,FLOOR(value/100) AS val FROM tbl_name -> GROUP BY id,val ORDER BY val; In MySQL Version 3.23 you can do: mysql> SELECT id,FLOOR(value/100) FROM tbl_name ORDER BY RAND(); 6.4  Data Manipulation:  SELECTINSERTUPDATEDELETE 6.4.1  SELECT Syntax SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT] [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS] [HIGH_PRIORITY] [DISTINCT | DISTINCTROW | ALL] select_expression,... [INTO {OUTFILE | DUMPFILE} 'file_name' export_options] [FROM table_references [WHERE where_definition] [GROUP BY {unsigned_integer | col_name | formula} [ASC | DESC],
     

    Customer Support CentreMySQL Reference Manual

    Web Hosting Services
    UNIX WEB HOSTING
    MERCHANT ACCOUNTS
    DEDICATED SERVERS
    E-COMMERCE HOSTING
    SUPPORT & FAQ's
    TERMS OF USE
    Domain Services
    DOMAIN
    REGISTRATION
    MANAGE
    YOUR ACCOUNT
    SUPPORT & FAQ's
    TERMS OF USE
    Corporate Info
    ABOUT US
    OUR NETWORK
    CONTACT US
    SITE MAP
    Copyright © 2002 Dyntex Group, Inc. All Rights Reserved
  • Return to Table of Contents
  • Back to top

  • Web Hosting: Manuals & FAQ's

    1. Unix-Based Web Hosting
    2. Unix Dedicated Servers
    3. Windows Dedicated Servers
    4. CuteFTP User’s Guide
    5. CuteHTML User’s Guide
    6. WS_FTP Pro User's Guide
    7. Miva Order User's Guide
    8. Miva Merchant User's Guide