当前位置:网站首页>Modifying table names, deleting tables, obtaining table information, and deleting table records on specified dates for common MySQL statements
Modifying table names, deleting tables, obtaining table information, and deleting table records on specified dates for common MySQL statements
2022-06-26 02:52:00 【Why is there a bug list】
List of articles
Preface
Why does the operation table use commands , Instead of using simple visual tools to operate directly ?
When the amount of data is small , Using visualization tools is obviously more user-friendly , Simple mouse click operation , Get started without learning .
But as the amount of data increases , It is not realistic to use visualization tools , such as : A big watch with 30million lines , How can we manage it by hand ?
Using the command line , Obviously, it is more convenient and less error prone .
How to modify the table name
give an example :
ALTER table A RENAME TO B;
Keep watch A Rename table B
How to delete a table
Use here drop Delete , About drop,delete,truncate See the difference between the two :
https://blog.csdn.net/GBS20200720/article/details/125128287?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165613788116782248557404%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=165613788116782248557404&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2blogfirst_rank_ecpm_v1~rank_v31_ecpm-4-125128287-null-null.nonecase&utm_term=drop&spm=1018.2226.3001.4450
drop:
DROP TABLE A;
A Is the name of the watch
How to get the basic information of a table
select * from information_schema.tables where table_name=‘A’;
A Is the name of the watch
Here are some important parameters
TABLE_ROWS( The number of rows in the table ):39137335
AVG_ROW_LENGTH( Average length per row ):126
DATA_LENGTH( Data length ):4951375872
How to delete a table record on a specified date
Get the data three months ago sql:
SELECT *
FROM tp_order_cancel_log
WHERE add_time < curdate() - INTERVAL 3 MONTH
ORDER BY add_time DESC;
add_time It is the field of record creation time defined in my table ( More commonly used is create_time)
Delete data three months ago sql:
DELETE *
FROM tp_order_cancel_log
WHERE add_time < curdate() - INTERVAL 3 MONTH;
边栏推荐
- 【系统架构】-如何评估软件架构
- 多测师拱墅校区肖sir_jenkins中搭建出现页面报错
- 力扣(LeetCode)176. 第二高的薪水(2022.06.25)
- PCA and automatic encoder for dimension reduction of R language
- Share some remote office experience in Intranet operation | community essay solicitation
- Camtasia 2022全新版超清錄制電腦視頻
- 股票开户怎么开户?网上开户是否安全么?
- 分布式电商项目 谷粒商城 学习笔记<3>
- 用指南针交易股票安全吗?指南针是如何交易股票的,需要开户吗
- Dual batteries in series, hardware design
猜你喜欢

How to solve the problem that the iPhone 13 lock screen cannot receive the wechat notification prompt?

Wechat launched a web version transmission assistant. Is it really easy to use?

Camtasia 2022 new ultra clear recording computer video

Camtasia 2022 nouvelle vidéo d'ordinateur d'enregistrement ultra - clair

Camtasia 2022全新版超清录制电脑视频

《你不可不知的人性》经典语录
![[defect detection] automatic defect detection of printed circuit board based on Matlab GUI [including Matlab source code 1912]](/img/c4/75f4209c1fa02a192f79de92dc9ecb.png)
[defect detection] automatic defect detection of printed circuit board based on Matlab GUI [including Matlab source code 1912]

Install development cross process communication
![[flask introduction series] flask processing request and response](/img/4b/bb5d915e83341183270d492b98f7d3.png)
[flask introduction series] flask processing request and response

数据库的授权
随机推荐
Which securities company is better and safer to open a mobile stock account?
Redis Lua sandbox bypass command execution (cve-2022-0543)
How do I fix the iPhone green screen problem? Try these solutions
Technology is to be studied
Additional: brief description of hikaricp connection pool; (I didn't go deep into it, but I had a basic understanding of hikaricp connection pool)
2022-06-25:给定一个正数n, 表示有0~n-1号任务, 给定一个长度为n的数组time,time[i]表示i号任务做完的时间, 给定一个二维数组matrix, matrix[j] = {a,
How did the thief unlock the password after the iPhone was stolen? After reading the long knowledge
vulhub复现一 activemq
What is flush software? Is online account opening safe?
Thirty ninth step
Survival analysis based on ovarian data set
[image filtering] image filtering system based on Matlab GUI [including Matlab source code 1913]
Which securities company should I choose to open an account online? Is it safe to open an account online?
Redis configuration and optimization of NoSQL
The programmer's eight-year salary change has made netizens envious: you pay me one year's salary per month
我在中山,到哪里开户比较好?网上开户是否安全么?
2022-06-25: given a positive number n, it means that there are tasks 0~n-1. Given an array of length N, time[i] means the time when task I is completed. Given a two-dimensional array matrix, matrix[j]
Limit the input character length to 1 character in English and 2 characters in Chinese
多测师拱墅校区肖sir_jenkins中搭建出现页面报错
在同花顺网上开户安全吗?如何网上开一个券商账户