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

How to solve the problem that the default value is invalid after Sequoiadb adds a field to the table

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "Sequoiadb to add fields to the table after setting the default value is invalid how to solve", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Sequoiadb to add fields to the table after setting the default value of the problem how to solve" it!

MySQL associates SequoiaDB, adds fields to the table and sets field defaults. After completion, check that the default values of fields in the table do not take effect.

[solution]

Due to the lack of alter support in the current version (3.0) of sequoiasql-mysql, this problem can be temporarily avoided by the following methods:

1. Set the default value to NULL, such as:

Alter table T1 add column d varchar (50) default null

two。 Then set the default value that you want to display through the IFNULL () function, such as:

Select IFNULL (d,'a') from T1 limit 1

Note: IFNULL function expression: IFNULL (expr1,expr2)

If expr1 is not NULL, the IFNULL function returns the value of expr1, otherwise it returns the value of expr2.

Thank you for your reading, the above is the "Sequoiadb to add fields to the table after setting the default value is invalid how to solve the problem" of the content, after the study of this article, I believe you add fields to the table after setting the default value after the problem of how to solve this problem has a more profound experience, the specific use of the situation also need to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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