HOME | PHP Tutorial | CSS
facebook icon
AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP
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

3294. SQL WHERE AND & OR multiple conditions, sql tutorial
SQL WHERE AND & OR multiple conditions sql tutorial
https://www.agernic.com/sql-tutorial/sql-where-and-or-multiple-conditions.html

690. MySQL Tutorial - w3resource

https://www.w3resource.com/mysql/mysql-tutorials.php

3227. SQL Select data from a database., sql tutorial
SQL Select data from a database. sql tutorial
https://www.agernic.com/sql-tutorial/sql-select-data-from-database.html

3229. SQL tutorial will teach you how to use SQL - Database, sql tutorial
SQL tutorial will teach you how to use SQL - Database sql tutorial
https://www.agernic.com/sql-tutorial/sql-tutorials-sql-database.html

2586. SQL SUM - SQL Tutorial

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

2580. SQL MIN - SQL Tutorial

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

Your add here
How to get PHP errors to display?
How to prevent sql injection in php mysqli
How do I get PHP errors to display - PHP error_reporting()
mysql_query(): The mysql extension is deprecated and will be removed i
Function eregi_replace() is deprecated in php - How to fix
PHP delete an element from an array
Uncaught Error: Call to undefined function MYSQL_NUM_ROWS() in
Deprecated: mysql_connect() mysql extension is deprecated and will be
mysqli_fetch_array() expects parameter 1 to be mysqli_result boolean g
SQL IN Operator - example
SQL BETWEEN Operator
SQL like syntax and example
SQL WHERE AND & OR multiple conditions
SQL create table primary key autoincrement
PHP mysqli_connect () Function
SQL COUNT(), AVG() and SUM() Functions
Display data from SQL database with MySQLi into php - html table
SQL CREATE DATABASE - example
SQL mysql order by columns, by date, by asc, by desc, random with PHP
PHP mysqli_query() Function - mysqli query
SQL delete row - SQL delete table
SQL update - SQL update select
Insert into SQL - Insert into table SQL - Insert data in sql
Login in PHP - simple login script with PHP MYSQL