Php Mysql Create Database - MySQL Constraints - Phptpoint.com

PHP MySQL Create Database

/ins>

Create Database

The CREATE DATABASE statement is used to create a MySQL database.

Create database is used to create a MySQL database.

We must add the CREATE DATABASE statement to the mysql_query() function to execute the command.

Ex i(Create database)

In the above example first we create the connection with the database then we write statement to create a database of name employee after that this statement is passed to mysql_query() along with the connection variable of the database.

Create a table

The CREATE TABLE statement is used to create a table

Create table is used to create a table. while creating a table we can define several constraints such as primary key, unique key,auto_increment etc.

We must add the CREATE TABLE statement to the mysql_query() function to execute the command.
Ex (Create Table)

In the above example first we create the connection with the database then we select a database of name employee
then we write the statement to create a table,and this statement is passed to mysql_query().