Create the following tables in your database with the following schema: Table: Users I Column Name | Type +-- int I account | name | varchar +-- ---+ ----- account is the primary key for this table....


Write all the sql code (including create, insert and select)


Create the following tables in your database with the following schema:<br>Table: Users<br>I Column Name<br>| Type<br>+--<br>int<br>I account<br>| name<br>| varchar<br>+--<br>---+<br>-----<br>account is the primary key for this table.<br>Each row of this table contains the account number of each user in the bank.<br>Table: Transactions<br>| Column Name<br>| Туре<br>+-<br>| trans id<br>I account<br>| amount<br>| transacted_on | date<br>| int<br>| int<br>| int<br>+--<br>trans id is the primary key for this table.<br>Each row of this table contains all changes made to all accounts.<br>amount is positive if the user received money and negative if they<br>transferred money.<br>All accounts start with a balance of 0.<br>Add the following data to your tables:<br>Input:<br>Users table:<br>+---<br>I account<br>I name<br>+---<br>| 900001<br>| 900002<br>| 900003<br>| Alice<br>| Bob<br>| Charlie<br>Transactions table:<br>+--<br>| trans id<br>| account<br>| amount<br>| transacted_on<br>+---<br>| 1<br>| 2<br>| 3<br>| 900001<br>| 900001<br>| 900001<br>I 900002<br>| 900003<br>| 900003<br>| 900003<br>| 7000<br>I 7000<br>| -3000<br>| 1000<br>| 6000<br>| 6000<br>| -4000<br>2020-08-01<br>2020-09-01<br>2020-09-02<br>2020-09-12<br>5<br>2020-08-07<br>2020-09-07<br>| 7<br>2020-09-11<br>+--<br>

Extracted text: Create the following tables in your database with the following schema: Table: Users I Column Name | Type +-- int I account | name | varchar +-- ---+ ----- account is the primary key for this table. Each row of this table contains the account number of each user in the bank. Table: Transactions | Column Name | Туре +- | trans id I account | amount | transacted_on | date | int | int | int +-- trans id is the primary key for this table. Each row of this table contains all changes made to all accounts. amount is positive if the user received money and negative if they transferred money. All accounts start with a balance of 0. Add the following data to your tables: Input: Users table: +--- I account I name +--- | 900001 | 900002 | 900003 | Alice | Bob | Charlie Transactions table: +-- | trans id | account | amount | transacted_on +--- | 1 | 2 | 3 | 900001 | 900001 | 900001 I 900002 | 900003 | 900003 | 900003 | 7000 I 7000 | -3000 | 1000 | 6000 | 6000 | -4000 2020-08-01 2020-09-01 2020-09-02 2020-09-12 5 2020-08-07 2020-09-07 | 7 2020-09-11 +--
Write an SQL query to report the name and balance of users with a balance higher than 10000. The<br>balance of an account is equal to the sum of the amounts of all transactions involving that account.<br>Return the result table in any order.<br>The results should be:<br>Output:<br>I name<br>balance<br>| Alice<br>11000<br>Explanation:<br>Alice's balance is (7000 + 7000 -<br>Bob's balance is 1000.<br>3000) = 11000.<br>Charlie's balance is (6000 + 6000<br>4000) = 8000.<br>

Extracted text: Write an SQL query to report the name and balance of users with a balance higher than 10000. The balance of an account is equal to the sum of the amounts of all transactions involving that account. Return the result table in any order. The results should be: Output: I name balance | Alice 11000 Explanation: Alice's balance is (7000 + 7000 - Bob's balance is 1000. 3000) = 11000. Charlie's balance is (6000 + 6000 4000) = 8000.
Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here