![]() |
| | #1 (permalink) |
| Junior Member Join Date: Nov 2011
Posts: 2
![]() | AUTO INCREMENT a Field For the auto increment of the values we can ue the auto increment option. Syntax for MySQL The following SQL statement defines the "P_Id" column to be an auto-increment primary key field in the "Persons" table: CREATE TABLE Persons ( P_Id int NOT NULL AUTO_INCREMENT, LastName varchar(255) NOT NULL, FirstName varchar(255), Address varchar(255), City varchar(255), PRIMARY KEY (P_Id) ) MySQL uses the AUTO_INCREMENT keyword to perform an auto-increment feature. Example: ALTER TABLE Persons AUTO_INCREMENT=100 Syntax for SQL Server CREATE TABLE Persons ( P_Id int PRIMARY KEY IDENTITY, LastName varchar(255) NOT NULL, FirstName varchar(255), Address varchar(255), City varchar(255) ) Cegonsoft final year projects
__________________ Final Year Projects |
| | |
| | #2 (permalink) |
| Junior Member Join Date: Dec 2011
Posts: 3
![]() | Am New to this forum, and also in SQl... :)
__________________ Chicago health club |
| | |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |