Last active
November 15, 2017 07:51
-
-
Save juananpe/ce1cf0e8ea4faa683f28d0d39956827a to your computer and use it in GitHub Desktop.
CryptoBrokerDB (sql)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE `cryptobroker` /*!40100 DEFAULT CHARACTER SET utf8mb4 */; | |
CREATE TABLE `transactions` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`message` json NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SELECT JSON_UNQUOTE( JSON_EXTRACT(message, '$.price')) FROM transactions
where JSON_EXTRACT(message, '$.side') = "buy" and JSON_EXTRACT(message, '$.product_id') = "BTC-EUR" and JSON_EXTRACT(message, '$.type') = "open"