Leetcode SQL

1555. Bank Account Summary

Table: Users

Table: Transactions

Leetcode Bank (LCB) helps its coders in making virtual payments. Our bank records all transactions in the table Transaction, we want to find out the current balance of all users and check wheter they have breached their credit limit (If their current credit is less than 0).

Write an SQL query to report.

  • user_id
  • user_name
  • credit, current balance after performing transactions.
  • credit_limit_breached, check credit_limit ("Yes" or "No")

Return the result table in any order.

The query result format is in the following example.





Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store