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

881. MySQL Tutorial
MySQL Tutorial for Beginners - Learn MySQL in simple and easy steps starting from basic to advanced concepts with examples including database programming clauses command functions administration queries and usage along with PHP in simple steps. This tuto
https://www.tutorialspoint.com/mysql/index.htm

48. SQL Tutorial - An Ultimate Guide for Beginners
SQL Tutorials for Beginners - Learn the concepts of world
https://www.tutorialrepublic.com/sql-tutorial/

2569. SQL database table - SQL Tutorial

http://www.sql-tutorial.net/sql-database-table.asp

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

2577. SQL JOIN - SQL Tutorial

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

2579. SQL MAX - SQL Tutorial

http://www.sql-tutorial.net/SQL-MAX.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