SQL
nameFnameHnameW
这个作者很懒,什么都没留下…
展开
-
create table as select 丢失 的 ”坑“ 你踩没踩
引用先,后期整理https://www.cnblogs.com/Neil223/p/5213895.htmlhttp://blog.itpub.net/23650854/viewspace-697781/https://www.cnblogs.com/emanlee/p/4605631.htmlcnblogs.com/fander/p/10309759.html原创 2020-08-11 20:06:38 · 971 阅读 · 0 评论 -
获取匹配度高的数据结果
SELECT aFROM bWHERE 'xxxxx' LIKE concat('%', b.DESCRIPTION, '%') OR 'xxxxx' LIKE concat('%', b.DESCRIPTION2, '%') GROUP BY REPLACE('xxxxx',b.DESCRIPTION,''), REPLACE('xxxxx',b.DESCRIPT...原创 2019-09-17 20:02:38 · 687 阅读 · 0 评论 -
mysql导出表的方法
1.mysqldump$ mysqldump -u root -p RUNOOB runoob_tbl > dump.txtpassword ******导出的数据中包含表结构和表数据2. select * from platform_user into outfile '/tmp/mysql/user/201810.csv'fields terminated by ',...原创 2020-04-02 20:42:01 · 803 阅读 · 0 评论 -
mysql中错误:1093-You can’t specify target table for update in FROM clause的解决方法
最近在处理数据库中数据的时候,写了下面类似的sql语句:UPDATE f_studentSET school_id = 0WHEREid in(SELECTidFROMf_studentWHEREschool_id = M))上面的sql是想数据对某些值进行修改,运行sql后报下面的错误:? 1 [Err] 109...原创 2019-05-28 18:55:47 · 1672 阅读 · 0 评论 -
数据库相关技巧
如何提高数据库SQL语句执行速度?(上)技巧1 比较运算符能用 “=”就不用“”“=”增加了索引的使用几率。技巧2 明知只有一条查询结果,那请使用 “LIMIT 1”“LIMIT 1”可以避免全表扫描,找到对应结果就不会再继续扫描了。技巧3 为列选择合适的数据类型能用TINYINT就不用SMALLINT,能用SMALLINT就不用INT,道理你懂的,磁盘和内存消耗越小越好嘛...原创 2019-05-28 20:31:10 · 222 阅读 · 0 评论 -
mysql中插入一条查询记录(带主键的),且主键字段类型为varchar,内容为数值
insert into A (ID,name,age,score,classes) select (select max(cast(ID as signed integer))+1 from A) ,'tom',21,score,classes from A WHERE ID=1017;—varchar 转 intcast(id as ...原创 2019-05-29 17:43:06 · 853 阅读 · 0 评论 -
MySQL数据库中字段含逗号的数据,分隔成多条数据
select a.id,substring_index(substring_index(a.name,',',b.help_topic_id+1),',',-1) namefrom test a joinmysql.help_topic bon b.help_topic_id < (length(a.name) - length(replace(a.name,',',''))+1)...转载 2019-09-17 20:04:07 · 485 阅读 · 0 评论