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
py -m pip install <package name> | |
py -m pip uninstall <package name> | |
##Note: replace <package name> desired package (e.g., nltk, pyautogui, pandas etc...) | |
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
--- | |
title: "Sample Equations used in Statistics" | |
output: html_document | |
--- | |
### Summations | |
### Without Indices | |
$\sum x_{i}$ |
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
--1. Get the order ID and unit price for each order by joining the Orders table and the Order Details table. | |
SELECT o.OrderID, od.UnitPrice | |
FROM dbo.Orders AS o | |
JOIN dbo.[Order Details] AS od | |
ON o.OrderID = od.OrderID; | |
--2. Get the order ID and first name of the associated employee by joining the Orders and Employees tables. | |
SELECT o.OrderID, e.FirstName |
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
--The SQL DISTINCT command along with the SQL MOD() function is used to retrieve only unique records depending on the specified column or expression. | |
SELECT DISTINCT City FROM Station WHERE MOD(ID,2)=0 |
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
--Q1. Select the quantity per unit for all products in the Products table. | |
SELECT QuantityPerUnit FROM Products | |
--Q2.Select the unique category IDs from the Products table. | |
SELECT Distinct CategoryID FROM Products | |
--Q3. Select the names of products from the Products table which have more than 20 units left in stock. | |
SELECT ProductName FROM Products | |
WHERE UnitsInStock >20 |
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
SELECT SalesOrderID, OrderDate, | |
CASE | |
WHEN ShipDate IS NULL THEN 'Awaiting Shipment' | |
ELSE 'Shipped' | |
END AS ShippingStatus | |
FROM SalesLT.SalesOrderHeader; |
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
-- select the CustomerID, and use COALESCE with EmailAddress and Phone columns | |
SELECT CustomerID, COALESCE(EmailAddress, Phone) AS PrimaryContact | |
FROM SalesLT.Customer; |
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
-- use ISNULL to check for middle names and concatenate with FirstName and LastName | |
SELECT FirstName + ' ' + ISNULL(MiddleName + ' ', '') + LastName | |
AS CustomerName | |
FROM SalesLT.Customer; |
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
-- finish the query | |
SELECT SalesOrderNumber + ' (' + STR(RevisionNumber, 1) + ')' AS OrderRevision, | |
CONVERT(nvarchar(30), OrderDate, 102) AS OrderDate | |
FROM SalesLT.SalesOrderHeader; |
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
-- cast the CustomerID column to a VARCHAR and concatenate with the CompanyName column | |
SELECT CAST(CustomerID AS varchar) + ': ' + CompanyName AS CustomerCompany | |
FROM SalesLT.Customer; |
NewerOlder