Home    Back    Forward    Refresh    txtSQL Homepage

Primary Keys

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 Comments - 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')));
?>
Last Page Next Page

'Language Reference'
  • Logical Operators
  • Relational Operators
  • Data Types
  • Column Types
  • Primary Keys
  • Functions
  • Where Clauses
  • LIKE Clauses
  • Limit Clauses
  • OrderBy Clauses
  • Notes
  • txtSQL 3.0.0 Beta Readme

    User Functions

    Database Functions

    Data Manipulation Functions

    Table Functions

    Error Handling Functions

    SQL Syntax

  • [ txtSQL Documentation powered by txtSQL | 6 SQL Queries ]