Primary Keys Back | Forward | Home

'Language Reference'
  • Logical Operators

  • Relational Operators

  • Data Types

  • Column Types

  • Primary Keys

  • Functions

  • Where Clauses

  • LIKE Clauses

  • Limit Clauses

  • OrderBy Clauses

  • Notes


  • User Functions

    Database Functions

    Data Manipulation Functions

    Table Functions

    Error Handling Functions

    << Last Section ( Column Types ) Primary Keys Next Section ( Functions ) >>

    txtSQL has been designed to allow the use of primary keys. There are two ways to add them, and only one way to drop them.

    To add primary keys when creating a table, specify the column type 'primary' and set it equal to 1. The column must be 'int' (integer) and 'auto_increment'.
    The other way to add a primary key is to use the altertable() function.

    If you want to drop a primary key, you must also use the altertable() function.



    User-Contributed Comments for:
    Primary Keys
    Faraz Ali <SaiyanM at hotmail dot com>
    July 30, 2004, 11:19 pm
    If you want to use primary keys in a where clause, set the column name as 'primary', it's a special column setup for you to use.

    <?php
    $sql
    ->select(array('table' => 'table',
                       
    'where' => array('primary = 2')));
    ?>