当前位置:网站首页>MySQL advanced SQL statement of database (2)
MySQL advanced SQL statement of database (2)
2022-06-30 10:16:00 【thengsd】
Catalog
One 、MySQL Union set 、 Intersection value 、 No intersection value 、case
1、 combine
- Put two SQL The results of the statement are combined , Two SQL The fields generated by the statement need to be of the same data type
(1)UNION
(2)UNION ALL
2、 Intersection value
- Take two. SQL The intersection of statement results
- There are no duplicate rows in the two tables , And when there are intersections, use
- Take two. SQL The intersection of statement results , And there's no repetition
3、 No intersection value
- Show the first SQL Result of statement , And with the second SQL Statement has no result of intersection , And there's no repetition
4、CASE
Two 、 Null value (NULL) and No value (’’) The difference between
- The length of no value is 0, Not taking up space ; and NULL The length of the value is NULL, It takes up space .
- IS NULL perhaps IS NOT NULL, It is used to judge whether the field is NULL Or not NULL, Can't find out if it's worthless .
- The judgment without value uses =’‘ perhaps <>’' To deal with it .<> The representative is not equal to .
- Through count() When specifying the number of rows in the field statistics , If you encounter NULL The value is automatically ignored , If there is no value, it will be added to the record for calculation .
3、 ... and 、MySQL Regular expressions of
Four 、 stored procedure
1、 The concept of stored procedure
- A stored procedure is a set of functions to accomplish SQL Statement set .
- In the process of using stored procedures, common or complex work is used in advance SQL The statement is written and stored with a specified name , This process is compiled and optimized and stored in the database server . When you need to use this stored procedure , Just call it . Stored procedures perform better than traditional SQL Faster 、 More efficient execution .
2、 Advantages of stored procedures
- After one execution , The generated binary code will reside in the buffer , Improve execution efficiency
- SQL Statement plus a collection of control statements , High flexibility
- Store on the server side , When called by the client , Reduce network load
- Can be called repeatedly , Can be modified at any time , Does not affect client calls
- Can complete all database operations , You can also control the information access rights of the database
3、 Create stored procedure
4、 Calling stored procedure
5、 View stored procedures
6、 Parameters of stored procedure
- IN Input parameters : Indicates that the caller passes a value... To the procedure ( The incoming value can be literal or variable )
- OUT Output parameters : Indicates that the procedure passes out a value to the caller ( Multiple values can be returned )( Outgoing values can only be variables )
- INOUT Input/output parameter : It means that the caller passes in a value to the procedure , It also indicates that the procedure passes out a value to the caller ( Values can only be variables )
7、 Delete stored procedure
The method to modify the contents of stored procedures is to delete the original stored procedures , Then create a new stored procedure with the same name .
8、 Control statement of stored procedure
边栏推荐
- JS get the substring of the specified character position and the specified character position interval of the specified string [simple and detailed]
- Appium自动化测试基础 — 12.APPium自动化测试框架介绍
- Quick completion guide for mechanical arm (V): end effector
- Jump table introduction
- How to build an all-in-one database cloud machine that meets the needs of information innovation?
- About the split and join operations of strings
- 戴森设计大奖,以可持续化设计改变世界
- log4j
- AttributeError: ‘Version‘ object has no attribute ‘major‘
- South China Industrial Group launched digital economy and successfully held the city chain technology conference
猜你喜欢
Theme Studio(主题工作室)
GNN动手实践(二):复现图注意力网络GAT
Appium automation test foundation - ADB shell command
Theme Studio
KOREANO ESSENTIAL打造气质职场范
Read the difference and connection between hyperfusion and private cloud
Appium自动化测试基础 — adb shell 命令
将小程序容器技术应用到物联网IoT生态建设中
Open source! Wenxin large model Ernie tiny lightweight technology, accurate and fast, full effect
Detailed explanation of SolidWorks mass characteristics (inertia tensor, moment of inertia, inertia spindle)
随机推荐
文章内容无法复制复制不了
Plan the IT technology route for the new year? Let's learn about Gartner infrastructure hype cycle
keras ‘InputLayer‘ object is not iterable
机械臂速成小指南(四):机械臂关键部件之减速机
【JVM】G1垃圾回收器简述
About the split and join operations of strings
Nlopt -- Nonlinear Optimization -- principle introduction and application method
ModuleNotFoundError: No module named ‘_swigfaiss‘
Quick completion guide for manipulator (4): reducer of key components of manipulator
新冠无情人有情,芸众惠爱心善举暖人间——捐赠商丘市儿童福利院公益行动
机械臂速成小指南(五):末端执行器
G code explanation | list of the most important G code commands
乡村振兴公益基金启动暨古茶树非遗保护公益行发布
背课文记单词,读课文记单词,读文章记单词;40篇文章搞定3500词;71篇文章突破中考单词;15篇文章贯通四级词汇;15篇文章贯通六级词汇
栈题目:字符串解码
Js獲取指定字符串指定字符比特置&指定字符比特置區間的子串【簡單詳細】
JUL简介
Installation and use
“昆明城市咖啡地图”活动再度开启
【AGC】构建服务3-认证服务示例