Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Textfile is too long to post here but try to give possible code that may work using SQL List the Ticker, Industry, TradeDate, the opening

Textfile is too long to post here but try to give possible code that may work using SQL

List the Ticker, Industry, TradeDate, the opening stock price and the closing stock price. List only those trading days that occurred in the year 2021. Arrange the answer in order of the trade dates which means that for a given stock, trading days should appear in chronological order.

List the Ticker, TradeDate and the closing stock price. List only Microsoft stocks where the trade date occurred on dates other than the year 2021. Arrange the answer in order of the ticker symbol, trade dates and then the closing price.

List the Ticker, Industry, TradeDate, the opening price and the closing stock price. List only the BA, CAT, CRM and UNH ticker symbols. Arrange the answer in order of the ticker symbol, Industry and the trade dates.

List the price ID, opening price, and closing price of all stocks who have an opening price smaller than 120 dollars and a closing price greater than 120 dollars. List the opening and closing prices in ascending order.

List the price ID, stock high and stock low of all stocks that have a stock high above 130. Also list the same information for all stocks that have a stock low below 5. List the high and low stocks by ascending order.

Produce a list the industries that are in the StockData table. List the industries in alphabetical order from z to a.

List the highest Price ID with a low stock price under 80 dollars.

List the earliest trade date of the stock that ended up having a high over 100 dollars. Pick an alias name for the column.

List the most recent trade date of a stock that a low under 5 dollars. Pick an alias name for the column.

List the trade dates, stock highs and stock lows of all stocks that either had a stock high over 130 dollars and were traded before December 31st, 2021, or stocks that were traded after December 31st 2021 and had a stock low below 50 dollars. List the stock highs and lows in descending order.

List the Price IDs and stock highs over 130 dollars rounded to the nearest penny. Call the column HighStock.

Return all attributes for stocks that have the MSFT ticker symbol and have a high stock price below 120 dollars or any stock that has a low stock price above 250 dollars. List the rows high and low stock prices in ascending order.

List the volumes in descending order of all the stocks that have an opening price greater than or equal to 100 but with a closing price not equal to 120 dollars.

List the highest high price of all the stocks that have been traded in 2019 and have a low price less than 100 dollars.

List the ten largest differences (from greatest to least) between a daily high and low stock price along with the accompanying Ticker, Industry, and TradeDate.

List the ticker symbol and the average daily trade volume for AMZN in 2016. Label the column for the average volume AverageVolume.

List the largest single-day stock price increase for Salesforce (CRM) (between the market opening and closing). Pick an alias name for the column.

List the records on which you could have made at least a 10% profit by purchasing stocks at its lowest price for the day and selling the stock at its highest price for the day.

Cleaning, Exploring, and Validating Data

When you are given a new data set, or when you load one into a database, it can be extremely helpful to verify that the data make sense before running any analytical queries. If you had just imported StockData, the following steps would be useful to explore the data.

List 100 rows of the table to see what the data look like. (On a production server, you would not select the entire table, but a limited number of rows. Otherwise you risk slowing down the server, particularly if the table is very large.)

Look for inconsistencies between the Volume and the stock high, low, opening closing. A volume of zero indicates the stock did not trade on that day so the stock high, low, opening, and closing price should all be the same.

List all rows where the high stock price for the day is not at least as high as the low for that day. There is likely an error in the data with these rows.

List all rows where any of the stock prices are zero.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions