HOME | PHP Tutorial | CSS
facebook icon
AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP
PHP Tutorial

PHP forms
HTML Tutorial

CSS Tutorial

SQL create table primary key autoincrement


The SQL CREATE TABLE Statement is used to create a new table in a SQL database.

AUTO INCREMENT fields are used for auto generating values for particular column whenever new row is being inserted.

SQL create table - how to create - example


CREATE TABLE Syntax

Example 1: Syntax
CREATE TABLE table-name (
    column1 datatype,
    column2 datatype,
    column3 datatype,
   ....
);


The following example creates a table called "Users" that contains five columns: ID, Name, Surname, Address, and City:

Example 1: CREATE TABLE
CREATE TABLE Users (
    ID int,
    Name varchar(255),
    Surname varchar(255),
    Address varchar(255),
    City varchar(255) 
);

SQL create table primary key autoincrement - Example - How to create

The following SQL statement defines the "ID" column to be an auto-increment primary key field in the "Persons" table:

Example 2: (MySQLi Procedural)

CREATE TABLE Persons (
    ID int NOT NULL AUTO_INCREMENT,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Age int,
    PRIMARY KEY (ID)
);


MySQL uses the AUTO_INCREMENT keyword to perform an auto-increment feature.
By default, the starting value for AUTO_INCREMENT is 1, and it will increment by 1 for each new record.

SQL create table SQL create table primary key autoincrement - sql tutorial

2568. SQL COUNT - SQL Tutorial

http://www.sql-tutorial.net/SQL-COUNT.asp

3283. Insert into SQL - Insert into table SQL - Insert data in sql, sql tutorial
Insert into SQL - Insert into table SQL - Insert data in sql sql tutorial
https://www.agernic.com/sql-tutorial/insert-into-sql-insert-into-table-sql-data-in-sql.html

3212. Online SQL Server Tutorial, Examples, Software, Commands, Online Courses
Online SQL Tutorial pdf, what is SQL, Online Courses, Classes, Training, Tutorials for Beginners - agernic.com is a free interactive Code, Tags, Example
https://www.agernic.com/sql-tutorial.html

2567. SQL Cheat Sheet - SQL Tutorial

http://www.sql-tutorial.net/SQL-Cheat-Sheet.asp

2586. SQL SUM - SQL Tutorial

http://www.sql-tutorial.net/SQL-SUM.asp

2560. Disclaimer - SQL Tutorial

http://www.sql-tutorial.net/disclaimer.asp

Your add here
PHP wordwrap() function

PHP similar_text() function

PHP strtolower() function

PHP define() function

PHP htmlentities() function

PHP rtrim() function

PHP htmlspecialchars_decode() function

PHP implode() function

PHP strcmp() function

PHP print() function

PHP str_split() function

PHP ucfirst() function

PHP html_entity_decode() function

PHP ltrim() function

PHP explode() function

PHP count() Function

CSS width and height - CSS Properties - Dimensions units
CSS align image center - how to create
HTML Text Color
SQL BETWEEN Operator
SQL update - SQL update select
How to prevent sql injection in php mysqli