当前位置:网站首页>Operation of variables in MySQL
Operation of variables in MySQL
2022-07-21 00:57:00 【DanceDonkey】
Variables are divided into system variables and user-defined variables , seeing the name of a thing one thinks of its function , System variables are variables defined by the system , These variables are fixed , User variables are not fixed , Users can define and use .
- System variables
System variables are divided into global system variables and session system variables , The modification of global system variables affects all sessions , The modification of session variables only affects the current session .
- Look at the system variables
show global variables
- Filter on view
show global variables like '%char%'
- View session variables
show session variables
Be careful : If global or session Omit , The default is session variable
- View a specific variable
select @@global.max_connections;
System variables are connected by @ start ,@@ And then global To view system variables ,@@ And then session Is to view the session variables .
- Change the value of the variable
set @@global .max_connections = 3000;
Look again
User variables
User session variables , After user declaration , As long as the current connection is not closed , It will always be stored in the server memory , The session is isolated from the variables before the session .
- User session variable definition
set @count = 0;
set @count := 1;
select @count;
- Define user variables , Batch update sql
set @indexcount := 0;
update emp set count = (@indexcount := @indexcount + 1);
select *
from emp;
- User defined variables can only be used in begin end in Not yet .
边栏推荐
- Import image method
- 哈希表(HashTable)
- 开发者必读:2022年移动应用运营增长洞察白皮书
- 苦劝无果,民警现场写代码揭诈骗,这事让我有一个脑洞
- Information system project manager core examination center (46) procurement statement of work (SOW)
- What is the difference between zero trust and SASE? The answer is not really important
- 和利时LE5107_LE5106_自由口协议
- Win11新Bug任务栏图标不显示的解决方法
- 如何入门.NET Core ? 推荐这10个优秀的开源项目!
- How can easycvr solve RTMP offline caused by restarting after configuring RTMP streaming?
猜你喜欢
选择排序/插入排序/冒泡排序
Network flow, bipartite graph and graph matching
What is the difference between zero trust and SASE? The answer is not really important
国产API工具哪家强?原来是它…
零信任和SASE有什么不一样?答案其实并不重要
2022年优秀灾难恢复解决方案
Why has API strategy become a magic weapon for enterprises' digital transformation?
Want to ensure software security at low cost? Five safety tasks worth considering
液晶ST7302图像缓存结构
Information system project manager core examination center (46) procurement statement of work (SOW)
随机推荐
读取Geotiff栅格文件赋值给点
如何运用并行编程Parallel提升任务执行效率
开发测试平台难吗?
通过Shell实现MeterSphere Signature签名
WPF implements drawer menu
央视新闻《广州开餐饮手撕定额发票》新闻频道_人民网
How to get asp Net core current startup address?
Warning FailedScheduling 8s default-scheduler 0/3 nodes are available: 1 Insufficient memory
STM32移植LVGL8.2
Persuasion failed, and the police wrote code to expose the fraud on the spot, which made me have a brain hole
IDEA:Lambda expression are not supported at language level ‘5‘
智能问答(Question Answering)的主要研究方向
CCTV news "Chengdu opens catering quota invoice by hand" news channel_ People's network
Net question and answer: is there the most efficient way to check large files in C?
Learun,已开源,一个.net web快速开
CCTV news "Ningbo rent quota invoice by hand" news channel_ People's network
Import image method
【JVM 系列】JVM 对象的分配策略
【翻译】C#表达式中的动态查询
模型压缩-方案(一)-参数共享:ALBERT、BERT-of-Theseus