创建数据库: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();