mysql数据库命令大全
时间: 2023-09-20 09:06:42 浏览: 30
以下是常用的 MySQL 数据库命令:
1. 连接数据库:`mysql -h [host] -u [user] -p[password] [database]`
2. 显示所有数据库:`show databases;`
3. 创建数据库:`create database [database];`
4. 删除数据库:`drop database [database];`
5. 选择数据库:`use [database];`
6. 显示所有表:`show tables;`
7. 显示表结构:`desc [table];`
8. 创建表:`create table [table] ([column] [type], [column] [type]);`
9. 删除表:`drop table [table];`
10. 插入数据:`insert into [table] values ([value], [value]);`
11. 更新数据:`update [table] set [column]=[value] where [condition];`
12. 删除数据:`delete from [table] where [condition];`
13. 查询数据:`select [columns] from [table] where [condition];`
14. 排序数据:`select [columns] from [table] order by [column] asc/desc;`
15. 分组数据:`select [columns] from [table] group by [column];`
16. 连接数据表:`select [columns] from [table1] inner join [table2] on [condition];`
17. 导入数据:`load data infile '[file]' into table [table] fields terminated by ',' lines terminated by '\n';`
18. 导出数据:`select [columns] into outfile '[file]' fields terminated by ',' lines terminated by '\n';`
以上是一些常用的 MySQL 数据库命令,更详细的内容可以参考 MySQL 官方文档。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![html](https://img-home.csdnimg.cn/images/20210720083451.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![apk](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)