i
PHP Variables
PHP Data Types
PHP Echo & Print
PHP Strings
PHP Numbers
PHP Constants
PHP Operators
PHP if...else...elseif Statements
Switch Statement
PHP Loops
PHP Arrays
Superglobals
PHP Coding Standards
PHP Form Handling
PHP Form Validation
PHP URLs Validation
PHP Form Required Validation
Complete Form Example
PHP File Functions Open/Read
PHP File Create/Write
PHP File Upload
PHP Cookies Handling
PHP Session Handling
PHP filter_var() Function
PHP Validation Filters
PHP Sanitization Filters
Using Filters
Filters Advanced
JSON
PHP Date and Time
MySQL Database
MySQL Connect
MySQL Commands-Creating a Table
MySQL Commands-Inserting The data
MySQL Commands-Prepared Statement
MySQL Commands-Selecting The Data
MySQL Commands-Where and Order By
MySQL Commands-Deleting And Updating The Data
PHP-OOP Introduction
PHP-Classes/Objects
PHP-Constructor/Destructor
PHP-Access Modifiers
PHP-Inheritance
PHP-Inheritance and Protected Access Modifier
PHP-Overriding Inherited Methods
PHP-Final keyword
PHP-Abstract Classes
PHP-Constants
PHP-Traits
PHP-Static Methods and Properties
Introduction to Functions
Defining A function
Returning Values From A Function
Dynamic Function Calls
Variable Scope
Understanding Arguments Or Parameters
Testing For A Function Existence
Returning Multiple Values From A Function
Making practical Use By Building Code Libraries For Code Re-usability
Using Include() And Require()
MySQL Commands
To use SQL commands first you need to create a database in MySQL and the syntax to create database is:
CREATE DATABASE database_name;
For example: CREATE DATABASE my_project;
Creating a Table
Now, after creating the database we can create tables to store our data and it will contain rows and columns and will have a unique name.
To create a table in MySQL, Create Table statement is used, and we can create the table with any number of rows and columns. Let us see an example:
CREATE TABLE Visitors
(
visitor_id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(40) NOT NULL,
email VARCHAR(50),
)
When you mention the create table statement with table name and the column names with datatype, you can also mention the additional parameters as we have mentioned in the above example. Let us see what the optional attributes means.
NOT NULL – It specifies that every row should contain a value for the particular column.
UNSIGNED – It limits the integer data and only stores zero and positive numbers.
AUTO_INCREMENT – This attribute automatically increases the value by 1 for the column whenever a row is added.
PRIMARY_KEY – It specifies the value should not be blank and should be unique. It is used to identify each row uniquely and is often used for ID numbers.
Don't miss out!