EKsumic's Blog

let today = new Beginning();

Click the left button to use the catalog.

SQL

9 Blogs

10k+ Reads 10991 Reads

0 likes

OR 关于在MySQL删除评论区丢失父Id的评论数据(垃圾数据)

​ 查询是否存在父Id和该表其他Id一致的数据: SELECT * FROM Comments A WHERE EXISTS(SELECT * FROM Comments B WHERE A.`ParentId`=B.`Id`) 这一条可以查询出来到底还要多少条合法子数据。 非法子数据直接加NOT会把父Id=0也筛选出来: SELECT * FROM Comments A WHERE NOT EXISTS(SELECT * FROM Comments B WHERE A.`ParentId`=B.`Id` ) 所以应该再加一句AND ParentId!=0: SELECT * FROM Comments A WHERE NOT EXISTS(SELECT * FROM Comments B WHERE A.`ParentId`=B.`Id`) AND ParentId!=0 但是最后删除的话,用这句其实是不行 ...

2022-03-04 13:04:47

1k+ 1145 reads

0 comments

OR 【SQL语句】垃圾评论清理

垃圾评论清理 ...

2021-02-20 14:20:51

1k+ 1075 reads

0 comments

OR How to connect to MySQL using .NET Core How should I write the connection string?

MySQL Connector/Net (.NET) standard connection method 1. Standard connection (Note, the default port is 3306.) 2. The special TCP/IP port connection local connection should be written to localhost and 127.0.0.1, if available, it is recommended Write localhost, because localhost does not pass through the network layer, firewall, etc., theoretically the performance is higher. But when I was testing ...

2020-11-05 01:05:47

1k+ 1009 reads

0 comments

OR What is the difference between MySQL datetime and SQL Server datetime?

Let me start with the conclusion: there is no difference. Someone told me before that when importing sqlserver database into mysql, pay attention that Datetime will become varchar, and you can change it to timestamp. What is the difference between mysql's timestamp ...

2020-11-05 00:59:57

1k+ 1219 reads

0 comments

OR How to set up mysql scheduled task

How to set up mysql scheduled task First, check the switch: SHOW VARIABLES LIKE 'event_scheduler' If it's off: SET GLOBAL event_scheduler = ON;  Second, create a stored procedure: CREATE PROCEDURE update_test()  UPDATE test set num=num+1 where ...

2020-10-28 21:27:03

1k+ 1161 reads

0 comments

OR MySQL的datetime和SQL Server的datetime有什么区别?

先说结论:没有区别。 之前有人跟我说sqlserver的数据库导入mysql要注意Datetime会变成varchar,你可以改成timestamp(时间戳), timestamp, mysql的timestamp和datetime的区别? DateTime和TimeStamp都是年月日时分秒,为什么还有这两个类型呢? DateTime和TimeStamp最大 ...

2020-10-04 03:31:24

1k+ 1141 reads

0 comments

OR Sql Server数据库迁移到MySQL(使用SQLyog)

新建一个同名的mysql数据库,这里为了演示取名为test。 基字符集是你默认安装的系统的字符集,我们这里默认使用utf-8,防止乱码。 不过话说回来,如果不清楚default是什么的话,建议执行一下语句: SHOW VARIABLES LIKE 'character%'; SHOW VARIABLES LIKE 'collation_%';   第二条语句将告诉你,默认连接、默认数据库使用基础字符集。 右击数据库,导入,导入外部数据 ...

2020-10-03 19:17:47

1k+ 1647 reads

2 comments

OR SQLite查看工具的使用注意事项

写这个Tips的目的是为了给初学者一个最基本的提醒,当然也是给我自己(*^_^*) 注意点: SQLite打开的.db后缀文件会在周围生成两个tmp文件,它是暂时的,请不要动这两个文件 SQLite打开并修改后,必须执行保存写入到数据库才可以实现更改 SQLite打开了的.db文件,不要复制或移动 ...

2020-09-01 14:43:54

1k+ 1257 reads

0 comments

OR SQL Server清除表中数据

​ 删除表数据有两种方法:delete和truncate。 如果你只是想初始化表,那直接: truncate table <表名> 完事。 truncate只用于表中清空数据。 它是清空,与delete有本质的区别。 delete与truncate最大的不同是: delete可以删除特定条件的一条或多条数据。 delete删除的数据占位 ​ ...

2020-08-20 19:42:50

1k+ 1337 reads

0 comments