随笔分类 -  数据库

上一页 1 2 3 4 5 6 7 8 ··· 11 下一页
摘要:原文链接:https://baijiahao.baidu.com/s?id=1725625533668535989&wfr=spider&for=pc coalesce语法:COALESCE(value1,value2,...); 举个例子: 返回表达式中第一个非空表达式,以下语句: SELECT 阅读全文
posted @ 2024-03-04 19:08 yinghualeihenmei 阅读(123) 评论(0) 推荐(0) 编辑
摘要:SUM(CASE WHEN income > 50000 THEN 1 ELSE 0 END) AS accounts_count 阅读全文
posted @ 2024-03-04 00:44 yinghualeihenmei 阅读(30) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/weixin_51309915/article/details/121880904 一、什么是开窗函数开窗函数/分析函数:over() 开窗函数也叫分析函数,有两类: 一类是聚合开窗函数,一类是排序开窗函数。 开窗函数的调用格式为: 函数名(列名) OVE 阅读全文
posted @ 2024-03-04 00:27 yinghualeihenmei 阅读(207) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/lgx5/p/13746747.html 1).数据 2). sum(LABST) over() 3). sum(LABST) over(order by MATNR) 4).sum(LABST) over(order by MATNR,ZWEEK) 阅读全文
posted @ 2024-03-04 00:08 yinghualeihenmei 阅读(338) 评论(0) 推荐(0) 编辑
摘要:原文链接:https://learn.microsoft.com/zh-CN/sql/relational-databases/performance/joins?view=aps-pdw-2016-au7 https://www.cnblogs.com/alone-striver/p/905507 阅读全文
posted @ 2024-03-03 23:29 yinghualeihenmei 阅读(80) 评论(0) 推荐(0) 编辑
摘要:原文链接:https://www.cnblogs.com/hellohui/p/17670858.html 今天遇到了in的新用法,即文中的第四条,使用多个列进行匹配,在此记录下。 使用列值列表进行匹配: SELECT * FROM 表名 WHERE 列名 IN (值1, 值2, 值3, ...) 阅读全文
posted @ 2024-03-03 20:46 yinghualeihenmei 阅读(662) 评论(0) 推荐(0) 编辑
摘要:我这边测试的是可以连接的,也是涨知识了,一直以为只能两边完全一样,才可以关联 阅读全文
posted @ 2024-03-01 18:36 yinghualeihenmei 阅读(9) 评论(0) 推荐(0) 编辑
摘要:原文链接:https://baijiahao.baidu.com/s?id=1776842859423008087&wfr=spider&for=pc 年均增长率=每年的增长率之和/年数 2 累积增长率法 累积增长率法是一种常见的求解年均增长率的方法,它适用于已知多个年份的数值: 步骤1:将每个年份 阅读全文
posted @ 2024-03-01 09:08 yinghualeihenmei 阅读(586) 评论(0) 推荐(0) 编辑
摘要:https://baijiahao.baidu.com/s?id=1762771338608732654&wfr=spider&for=pc 同比增幅是一种用于比较两个时间段之间变化的指标,也被称为年同比增长率或年度增长率。它是指与上一年相比,当前时间段的增长率。 同比增幅的计算公式是:(本期数-同 阅读全文
posted @ 2024-02-29 11:22 yinghualeihenmei 阅读(112) 评论(0) 推荐(0) 编辑
摘要:还原数据库遇到这个提示 学习下差异备份 原文链接:https://blog.csdn.net/david_520042/article/details/129750565 1.首先右键数据库,点击还原数据库:1、还原完整数据库,选择好完整数据库的备份文件,在【选项】中,【还原选项】选择覆盖现有数据库 阅读全文
posted @ 2024-01-26 17:48 yinghualeihenmei 阅读(827) 评论(0) 推荐(0) 编辑
摘要:三角形的条件:两边之和大于第三边 case when x+y>z and x+z>y and y+z>x then 'Yes' else 'No' end as triangle 阅读全文
posted @ 2024-01-23 17:51 yinghualeihenmei 阅读(21) 评论(0) 推荐(0) 编辑
摘要:sql里面有numeric(5,2),将5改成6,numeric(6,2)就好了。 numeric(5,2)是总位数为5,小数点后为2位的数,也就是说这个字段的整数位最大是3位,有超过3位的就会出问题。 阅读全文
posted @ 2024-01-22 15:01 yinghualeihenmei 阅读(454) 评论(0) 推荐(0) 编辑
摘要:原文链接:https://www.cnblogs.com/tanshuai1001/p/8761378.html https://baijiahao.baidu.com/s?id=1709966309120511971&wfr=spider&for=pc district必须放在所有字段前面: SE 阅读全文
posted @ 2024-01-17 18:42 yinghualeihenmei 阅读(389) 评论(0) 推荐(0) 编辑
摘要:使用CONCAT()函数可将两个或多个字符串连接成一个字符串,语法如下: CONCAT ( input_string1, input_string2 [, input_stringN ] ); 可以有多个参数,连接多个字符串,最多255个输入字符串并将它们连接成一个字符串。 它至少需要两个输入字符串 阅读全文
posted @ 2024-01-09 14:35 yinghualeihenmei 阅读(507) 评论(0) 推荐(0) 编辑
摘要:疑问1: datepart(year,trans_date)+'-'+datepart(month,trans_date)两个不可以直接拼接,两个都是整型。两个数直接相加。需要转换成字符型才能拼接。 CONVERT(varchar(10),YEAR(trans_date)) +'-'+CONVERT 阅读全文
posted @ 2024-01-08 22:13 yinghualeihenmei 阅读(99) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/mapstar/p/13601617.html SQL中保留两位小数的方法有三种,(第2、3种方法类似): 1、使用round(数字,保留位数)函数,使用示例: SELECT ROUND(123.9994, 3) --123.9990 SELECT R 阅读全文
posted @ 2024-01-07 14:32 yinghualeihenmei 阅读(1354) 评论(0) 推荐(0) 编辑
摘要:表: Signups + + + | Column Name | Type | + + + | user_id | int | | time_stamp | datetime | + + + User_id是该表的主键。 每一行都包含ID为user_id的用户的注册时间信息。 表: Confirma 阅读全文
posted @ 2024-01-05 18:44 yinghualeihenmei 阅读(3) 评论(0) 推荐(0) 编辑
摘要:原文链接:http://cn.voidcc.com/question/p-ysebrehb-rq.html select cast(1/2 as decimal(9,2)) 也返回0 原因: 整数除法 select 1/2 -- 0 浮法分裂(至少有一个参数必须是浮/十进制): select 1/2 阅读全文
posted @ 2024-01-05 18:28 yinghualeihenmei 阅读(118) 评论(0) 推荐(0) 编辑
摘要:使用 FORMAT 函数(仅适用于 SQL Server 2012 及以上版本) SELECT FORMAT(GETDATE(), 'yyyy年MM月dd日') select Format(GETDATE(), 'yyyy-MM-dd hh:mm') 结果:2024-03-06 04:13 sele 阅读全文
posted @ 2023-12-27 10:10 yinghualeihenmei 阅读(528) 评论(0) 推荐(0) 编辑
摘要:原文链接:https://www.xjx100.cn/news/415146.html?action=onClick 1.将要导入的excel表格数据如下,第一行数据默认为数据库表中的字段,所以这个必须要有,否则无法映射导入。如下图(只截部分数据) 2.打开Microsoft SQL Server 阅读全文
posted @ 2023-12-22 17:21 yinghualeihenmei 阅读(1624) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 ··· 11 下一页
点击右上角即可分享
微信分享提示