mysql的工作中使用记录
这里比较推荐,也比较常用的,是mybqtis之类的直接手写sql。
因为用各种template方法,模板那些本质上也是字符串拼接替换,去差询sql。而且符号更麻烦(涉及到特殊字段,特殊符号)。
//这里用反斜线引号,避免产生歧义,特别是有些特殊含义字符,如columns,tables,往往我们的普通表命名字段命名要与之区分开
ALTER TABLE `test_hand1` CONVERT TO CHARACTER SET utf8mb4
# COLLATE gbk;
select row_id, pay_type, `status`, support_recharge from t_scte_paytype_blacklist
//这里用了双引号单引号,表示的是字符串常量;以前上学sql都是推荐单引号的,不知道为什么现在双引号几乎无差异比较支持了
select
CCSA.character_set_name ,
T.table_name
from
information_schema.`TABLES` T,
information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA
where
CCSA.collation_name = T.table_collation
and T.table_schema = "jfzw"
-- and T.table_schema = 'jfzw'
and CCSA.character_set_name = 'gbk'
select merchant_code, coupon_fee , shop_name from t_jfzw_order_info where