創建數據庫:CREATE DATABASE database_name;
刪除數據庫:DROP DATABASE database_name;
選擇數據庫:USE database_name;
創建表:CREATE TABLE table_name (column_name1 data_type1, column_name2 data_type2, …);
刪除表:DROP TABLE table_name;
插入數據:INSERT INTO table_name (column_name1, column_name2, …) VALUES (value1, value2, …);
更新數據:UPDATE table_name SET column_name1 = value1, column_name2 = value2 WHERE condition;
刪除數據:DELETE FROM table_name WHERE condition;
查詢數據:SELECT column_name1, column_name2, … FROM table_name WHERE condition;
查詢表結構:DESCRIBE table_name;
添加主鍵:ALTER TABLE table_name ADD PRIMARY KEY (column_name);
添加外鍵:ALTER TABLE table_name ADD FOREIGN KEY (column_name) REFERENCES other_table(column_name);
修改表結構:ALTER TABLE table_name MODIFY column_name data_type;
清空表數據:TRUNCATE TABLE table_name;
查看當前版本:SELECT VERSION();