Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Devise relational algebra queries for the following schema of a database storing informa- tion about (for simplicity at a daily basis) or cryptocurrency values and
Devise relational algebra queries for the following schema of a database storing informa- tion about (for simplicity at a daily basis) or cryptocurrency values and basic transactions made by a firm that trades cryptocurrencies. For simplicity, we will further assume that all cryptocurrencies are traded in US dollards (i.e. we do not allow exchanging cryptocurrencies between each other). Cryptocurrencies are today the core of the general category of "digital assets"; where digital assets are becoming to be the dominant financial products in the years to come. Today, cryptocurrencies are exchanged in Digital Currency Exchanges (aka Crypto Markets). Some among the main ones are: Binance, Huobi, Bittrex, Bitfinex, Coinbase, and Coinbase. There are also various cryptocurrencies. Some of the main ones are: Bitcoin (BTC), Ethereum (ETH), XRP (XRP), Bitcoin Cash (BCH), Litecoin (LTC), and Paxos Standard (PAX). There are more than 2300 actively traded (and most of them mined) cryptocurrencies (partial list: https://coinmarketcap.com/all/views/all/) Remark: Below, you should define domains so as to make the schema complete. COIN (currency, exchange) currency: digital currency's symbol (similar to a stock's currency title symbol); e.g. BTC, Express the following as relational algebra expressions. i. Find the currency titles and all closing values of all currencies exchanged in 2019. ii. Find all currency titles traded in 'Coinbase for which there were only BUY trades on 10/22/2019' and only SELL trades on 10/22/2019'. iii. Find all currencies (i.e. for all dates) whose closing value is both higher than ETH' in "Huobi' on 10/20/2019' and no higher than BTC' in 'Huobi' on '10/20/2019'. iv. Find the currency titles of all currencies that closed at the highest value on '10/ HD value on 10/20/2019'. (we are asking for "all currencies" since there may be more than one with the same "highest value") v. Find the currency titles of all currencies traded in 'Coinbase' whose closing value on 10/20/2019' was either strictly below $100 or strictly above $9000. vi. Find all currencies traded in Binance of the currencies whose closing value showed the highest increase between '10/20/2019' and '10/21/2019' in 'Huobi' and whose closing value was (in Huobi') strictly above $100 for the entire 2019 (we are asking for "all currencies" since there may be more than one with the same increase. Recall that Relational Algebra does not support MAX, MIN, AVG operations.) Remarks: In the above queries if there are no relevant tuples in the database to compare then you do not include these in the resulting relation (i.e. what your query returns). For example, if a currency title does not appear on both 10/20/2019' and '10/21/2019' in Huobi then you should not include it in the result. Furthermore, we are also not really careful about datatypes. For example, for the BUY/SELL attribute we must create a new datatype, but to keep things simple I will allow you to use a string and furthermore for making things even simpler you won't have to check for consistency. Finally, the above database does not have any Integrity Constraints specified. If you want you can specify primary, foreign keys, etc, however it is not necessary to do so neither here nor in SQL in the next question. Of course, in reality you must always specify ICs, but for simplicity in this lab exercise you can optionally do this if you want. Devise relational algebra queries for the following schema of a database storing informa- tion about (for simplicity at a daily basis) or cryptocurrency values and basic transactions made by a firm that trades cryptocurrencies. For simplicity, we will further assume that all cryptocurrencies are traded in US dollards (i.e. we do not allow exchanging cryptocurrencies between each other). Cryptocurrencies are today the core of the general category of "digital assets"; where digital assets are becoming to be the dominant financial products in the years to come. Today, cryptocurrencies are exchanged in Digital Currency Exchanges (aka Crypto Markets). Some among the main ones are: Binance, Huobi, Bittrex, Bitfinex, Coinbase, and Coinbase. There are also various cryptocurrencies. Some of the main ones are: Bitcoin (BTC), Ethereum (ETH), XRP (XRP), Bitcoin Cash (BCH), Litecoin (LTC), and Paxos Standard (PAX). There are more than 2300 actively traded (and most of them mined) cryptocurrencies (partial list: https://coinmarketcap.com/all/views/all/) Remark: Below, you should define domains so as to make the schema complete. COIN (currency, exchange) currency: digital currency's symbol (similar to a stock's currency title symbol); e.g. BTC, Express the following as relational algebra expressions. i. Find the currency titles and all closing values of all currencies exchanged in 2019. ii. Find all currency titles traded in 'Coinbase for which there were only BUY trades on 10/22/2019' and only SELL trades on 10/22/2019'. iii. Find all currencies (i.e. for all dates) whose closing value is both higher than ETH' in "Huobi' on 10/20/2019' and no higher than BTC' in 'Huobi' on '10/20/2019'. iv. Find the currency titles of all currencies that closed at the highest value on '10/ HD value on 10/20/2019'. (we are asking for "all currencies" since there may be more than one with the same "highest value") v. Find the currency titles of all currencies traded in 'Coinbase' whose closing value on 10/20/2019' was either strictly below $100 or strictly above $9000. vi. Find all currencies traded in Binance of the currencies whose closing value showed the highest increase between '10/20/2019' and '10/21/2019' in 'Huobi' and whose closing value was (in Huobi') strictly above $100 for the entire 2019 (we are asking for "all currencies" since there may be more than one with the same increase. Recall that Relational Algebra does not support MAX, MIN, AVG operations.) Remarks: In the above queries if there are no relevant tuples in the database to compare then you do not include these in the resulting relation (i.e. what your query returns). For example, if a currency title does not appear on both 10/20/2019' and '10/21/2019' in Huobi then you should not include it in the result. Furthermore, we are also not really careful about datatypes. For example, for the BUY/SELL attribute we must create a new datatype, but to keep things simple I will allow you to use a string and furthermore for making things even simpler you won't have to check for consistency. Finally, the above database does not have any Integrity Constraints specified. If you want you can specify primary, foreign keys, etc, however it is not necessary to do so neither here nor in SQL in the next question. Of course, in reality you must always specify ICs, but for simplicity in this lab exercise you can optionally do this if you want
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started