0% found this document useful (0 votes)
16 views3 pages

Dbms Views

The document defines 20 views that create summaries of data from various database tables, including views of all users, banks, companies, prices, investments, profits, bills, and transactions, as well as views that filter on specific fields like phone number, account number, ISIN code, time, symbol, bought price, ID, type, bank name, investment symbol, bought price, and transaction type.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

Dbms Views

The document defines 20 views that create summaries of data from various database tables, including views of all users, banks, companies, prices, investments, profits, bills, and transactions, as well as views that filter on specific fields like phone number, account number, ISIN code, time, symbol, bought price, ID, type, bank name, investment symbol, bought price, and transaction type.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

View of all users:

CREATE VIEW all_users AS SELECT * FROM user;


.

2. View of all banks:

CREATE VIEW all_banks AS SELECT * FROM bank;


.

3. View of all companies:

CREATE VIEW all_companies AS SELECT * FROM companies;


.

4. View of all prices:

CREATE VIEW all_prices AS SELECT * FROM price;


.

5. View of all investments:

CREATE VIEW all_investments AS SELECT * FROM investments;


.

6. View of all profits:

CREATE VIEW all_profits AS SELECT * FROM profits;


.

7. View of all bills:

CREATE VIEW all_bills AS SELECT * FROM bill;


.

8. View of all transactions:

CREATE VIEW all_transactions AS SELECT * FROM transaction;


.

9. View of users with a specific phone number:


CREATE VIEW users_with_phone_no AS SELECT * FROM user WHERE phone_no =
'1234567890';
.

10. View of banks with a specific account number:

CREATE VIEW banks_with_account_no AS SELECT * FROM bank WHERE account_no =


'1234567890';
.

11. View of companies with a specific ISIN code:

CREATE VIEW companies_with_ISIN_code AS SELECT * FROM companies WHERE


ISIN_code = 'US0378331005';
.

12. View of prices at a specific time:

CREATE VIEW prices_at_time AS SELECT * FROM price WHERE time = '2024-03-28


09:56:16';
.

13. View of investments with a specific symbol:

CREATE VIEW investments_with_symbol AS SELECT * FROM investments WHERE


symbol = 'AAPL';
.

14. View of profits with a specific bought price:

CREATE VIEW profits_with_bought_price AS SELECT * FROM profits WHERE


price_bought = 100;
.

15. View of bills with a specific id:

CREATE VIEW bills_with_id AS SELECT * FROM bill WHERE bill_id = 1;


.

16. View of transactions with a specific type:

CREATE VIEW transactions_with_type AS SELECT * FROM transaction WHERE


transaction_type = 'buy';
.

17. View of the total money in a specific bank:


CREATE VIEW total_money_in_bank AS SELECT SUM(money) FROM bank WHERE
bank_name = 'Bank Name';
.

18. View of the total volume of a specific investment:

CREATE VIEW total_volume_of_investment AS SELECT SUM(volume) FROM


investments WHERE symbol = 'AAPL';
.

19. View of the total volume of a specific profit:

CREATE VIEW total_volume_of_profit AS SELECT SUM(volume) FROM profits WHERE


price_bought = 100;
.

20. View of the total price of a specific transaction:

CREATE VIEW total_price_of_transaction AS SELECT SUM(transaction_price)


FROM transaction WHERE transaction_type = 'buy';

You might also like