Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The use of functions and triggers in MySQL

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Preface

MySQL is a relational database management system in which relational databases store data in different tables instead of all data in one large warehouse, which increases speed and flexibility.

The SQL language used by MySQL is the most commonly used standardized language for accessing databases. MySQL software adopts the dual licensing policy, which is divided into community version and commercial version. Because of its small size, high speed and low total cost of ownership, especially open source, the development of small and medium-sized websites generally choose MySQL as the website database.

I. the system encapsulates the function

MySQL has many built-in functions that can quickly solve some business requirements in development, including process control functions, numeric functions, string functions, date-time functions, aggregate functions, and so on. The functions commonly used in these classifications are listed below.

1. Control flow function case...when

The return value is judged according to the value, and the IF-ELSE judgment in analogical programming.

-- DEMO 01SELECT CASE DATE_FORMAT (NOW (),'% Ymuri% mmi% d') WHEN '2019-12-29' THEN 'today' WHEN' 2019-12-28 'THEN' yesterday' WHEN '2019-12-30' THEN 'tommor' ELSE' Unknow' END;-- DEMO 02SELECT (CASE WHEN 1 > 0 THEN 'true' ELSE' false' END) AS result;if (expr1,expr2,expr3)

If the expression expr1 is TRUE, the return value of IF () is expr2;, otherwise the return value is expr3.

SELECT IF (1 > 2)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report