LeetCode(数据库)- 银行账户概要

简介: LeetCode(数据库)- 银行账户概要

题目链接:点击打开链接

题目大意:略。

解题思路:略。

AC 代码

WITH t1 AS(SELECT user_id, credit FROM Users
UNION ALL 
SELECT paid_by, -amount FROM Transactions
UNION ALL 
SELECT paid_to, amount FROM Transactions)
SELECT user_id, user_name, SUM(t1.credit) credit, IF(SUM(t1.credit) > 0, 'No', 'Yes') credit_limit_breached
FROM t1 JOIN Users USING(user_id)
GROUP BY user_id
目录
相关文章
|
5月前
|
NoSQL Java 关系型数据库
基于Java swing和mysql实现酒店管理系统(源码+数据库+运行指导视频+系统用户使用手册+系统PPT+数据库设计说明书+系统概要说明书+需求说明书+详细说明书)
基于Java swing和mysql实现酒店管理系统(源码+数据库+运行指导视频+系统用户使用手册+系统PPT+数据库设计说明书+系统概要说明书+需求说明书+详细说明书)
|
5月前
|
SQL
leetcode-SQL-1587. 银行账户概要 II
leetcode-SQL-1587. 银行账户概要 II
43 0
|
Go 数据库 开发工具
【博客开发】服务端概要设计-数据库设计
【博客开发】服务端概要设计-数据库设计
91 0
|
数据库
数据库LeetCode每日练习(三)
数据库LeetCode每日练习(三)
数据库LeetCode每日练习(三)
|
SQL 数据库
数据库LeetCode每日练习(二)
数据库LeetCode每日练习(二)
数据库LeetCode每日练习(二)
|
SQL 数据库
数据库LeetCode每日练习(一)
数据库LeetCode每日练习(一)
数据库LeetCode每日练习(一)
|
数据库
LeetCode(数据库)- 2142. The Number of Passengers in Each Bus I
LeetCode(数据库)- 2142. The Number of Passengers in Each Bus I
193 0
|
数据库
LeetCode(数据库)- The Number of Seniors and Juniors to Join the Company II
LeetCode(数据库)- The Number of Seniors and Juniors to Join the Company II
108 0
|
数据库
LeetCode(数据库)- Number of Accounts That Did Not Stream
LeetCode(数据库)- Number of Accounts That Did Not Stream
112 0
|
数据库
LeetCode(数据库)- The Airport With the Most Traffic
LeetCode(数据库)- The Airport With the Most Traffic
121 0
下一篇
无影云桌面