Advanced
Views
Create View
CREATE VIEW view_name AS
SELECT column1, column2
FROM $TABLE_NAME
WHERE condition;Create or Replace View
CREATE OR REPLACE VIEW view_name AS
SELECT column1, column2
FROM $TABLE_NAME
WHERE condition;Select from View
SELECT * FROM view_name;Show Views
SHOW FULL TABLES WHERE Table_type = 'VIEW';Drop View
DROP VIEW view_name;Alter View
View Information
Stored Procedures and Functions
Create Stored Procedure
Call Stored Procedure
Create Function
Use Function
Show Procedures
Show Functions
Drop Procedure
Drop Function
Show Procedure Code
Show Function Code
Triggers
Create BEFORE INSERT Trigger
Create AFTER INSERT Trigger
Create BEFORE UPDATE Trigger
Create AFTER UPDATE Trigger
Create BEFORE DELETE Trigger
Show Triggers
Drop Trigger
Transactions
Start Transaction
Begin Transaction
Commit Transaction
Rollback Transaction
Savepoint
Rollback to Savepoint
Release Savepoint
Auto Commit Off
Auto Commit On
Transaction Example
User Management and Security
Create User
Create User with Host
Grant Privileges
Grant Specific Privileges
Grant with Grant Option
Revoke Privileges
Revoke Specific Privileges
Show Users
Show Grants
Show Current User
Change Password
Drop User
Flush Privileges
Create Role
Grant Role
Set Default Role
Backup & Restore
Backup Database
Backup All Databases
Backup Specific Tables
Backup with Structure Only
Backup with Data Only
Restore Database
Restore from MySQL Console
Create Database Before Restore
Backup with Compression
Restore from Compressed Backup
Performance Tuning
Show Current Processes
Show Full Processlist
Kill Process
Explain Query
Analyze Query Performance
Show Table Status
Show Index Usage
Create Index
Create Composite Index
Create Unique Index
Drop Index
Show Variables
Show Status
Show Engine Status
Optimize Table
Analyze Table
Check Table
Repair Table
Show Query Cache Status
Enable Query Cache
Show Slow Query Log
Enable Slow Query Log
Show Binary Log
Show Master Status
Show Slave Status
Last updated