LinuxGuruz
Toll Free Numbers
Custom Search
MAIN MENU
Main Page
IT Jobs
IPTABLES
Linux Forum
HTML Forum
PHP Forum
MySQL Forum
Linux FAQ
Linux Articles
About Us
Privacy Policy

ADD TO FAVORITES


MARC

Mailing list ARChives
- Search by -
 Subjects
 Authors
 Bodies





FOLDOC

Computing Dictionary






Cheap UK Web Hosting Provider

Cheap Dedicated Servers UK

Cheap Linux VPS Hosting UK

Cheap Cloud Hosting UK



Icons
Icons


free brochure template
Free Brochure Template

Web Hosting

Domain Names

Web Design

Reseller Hosting

Registro de Dominios

Reseller Hosting


Toll Free Number for $2.00/Month!!!

Toll Free Number for $2.00/Month!!!
Incrementing/De-Incrementing columns

Title:       Incrementing/De-Incrementing columns
Contributor: Bamse
Last Update: Saturday September 2 21:15 EDT 2000



# Here is a MySQL columns drill for you to follow.
#
mysql -uroot -p

CREATE DATABASE TestDB;
USE TestDB;

CREATE TABLE test_table (
test_id INT NOT NULL auto_increment,
var_test VARCHAR(255) NOT NULL,
int_test SMALLINT NOT NULL,
PRIMARY KEY(test_id),
KEY(var_test),
KEY(var_test)
);

SELECT * FROM test_table;

INSERT into test_table (var_test,int_test) VALUES ('1', '1');
SELECT * FROM test_table;

UPDATE test_table SET var_test = var_test+2 WHERE test_id = '1';
UPDATE test_table SET int_test = int_test+2 WHERE test_id = '1';
SELECT * FROM test_table;

UPDATE test_table SET var_test = var_test-1 WHERE test_id = '1';
UPDATE test_table SET int_test = int_test-1 WHERE test_id = '1';
SELECT * FROM test_table;

UPDATE test_table SET int_test=int_test*2, int_test=int_test+1;
SELECT * FROM test_table;

UPDATE test_table SET int_test=var_test*2, int_test=int_test-1;
SELECT * FROM test_table;

DROP DATABASE TestDB;
quit

# Note that "DROP DATABASE TestDB;" does just that. It
# sent the database to binary heaven and it is now deleted.


   Anyone who wishes to make additions or changes to this
MySQL Tip email them to webmaster@linuxguruz.org

   This document is Copyright (c) 1999, 2000 by LinuxGuruz

Return to the LinuxGuruz MySQL Tutorials Page
Return to the LinuxGuruz Main Page


Submit a MySQL Tutorial

Title:

Contributor:

IRC NICK: (optional)

E-Mail Address: (optional)

Tutorial:

Return to the LinuxGuruz MySQL Tutorials Page
Return to the LinuxGuruz Main Page

RESOURCE LINKS
Linux
Apache
HTML
PHP
MySQL
PostgreSQL
Oracle
CGI
Perl
Java
C/C++
Bash
Tcl
Networking
Security
ISP
IRC
Xwindow
Laptop
Graphics
Hardware
Reference
Misc

Broadband


filing cabinet

  • Buy Batteries for Laptops and Cameras
  • Notebooks
  • Michael Fertik
  • Reputation Defender

  • XP Style Icons
    XP Style Icons


    Network Certification


    Network Security


    Wireless Networking


    Canadian
    Web Hosting in Canada


    Drummer Portal


    Mending Media

    The Path Of
    Most Resistance


    Toll Free Number for $2.00/Month!!!

    Toll Free Number for $2.00/Month!!!


    Linux

    The Distributions





    Linux

    The Software





    Linux

    The News




    webmaster@linuxguruz.com
    Copyright © 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 and 2009 by LinuxGuruz