13:05 ET Dow -154.48 at 10309.92, Nasdaq -37.61 at 2138.44, S&P -19.130 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 13:05 ET Dow -154.48 at 10309.92, Nasdaq -37.61 at 2138.44, S&P -19.1313:05 ET Dow -154.48 at 10309.92, Nasdaq -37.61 at 2138.44, S&P -19.13

.

.

Sunday, January 30, 2011

How to Read SQL Syntax

 Source: http://kb.askmonty.org/v/how-to-read-sql-syntax


How to Read SQL Syntax

We have used the following common variant of BNF notation for the SQL syntax diagrams in this book:
< > Angle brackets surround the names of syntactic elements. The brackets are not part of the syntax; do not include them in your SQL statement.
::= The definition operator separates the syntactic element being defined from its definition. Read the definition from left to right.
[ ] Square brackets surround optional syntax. You may choose whether or not to omit such syntax when forming an SQL statement. The brackets are not part of the syntax; do not include them in your SQL statement.
{ } Braces surround mandatory syntax groupings. You must include the entire grouping when forming an SQL statement. The braces are not part of the syntax; do not include them in your SQL statement.
| The vertical bar separates groups of syntactic elements. You must choose one of the elements when forming an SQL statement. The vertical bar is not part of the syntax; do not include it in your SQL statement.
... An ellipsis following a syntactic element indicates that the syntax is repeatable. You may include the element as often as you wish when forming an SQL statement. The ellipsis is not part of the syntax; do not include it in your SQL statement.
 Blank spaces (whether single or multiple spaces and/or line breaks) separate syntactic elements.
All other characters in a definition stand for themselves.
We also follow these notation conventions:
  1. Words written in uppercase letters are SQL <keyword>s. You must write them exactly as shown when forming an SQL statement, except that you have the choice of writing them in either uppercase or lowercase letters.
  2. Words written in lowercase letters represent syntactic categories. You must replace them with actual <identifier>s or <literal>s when forming an SQL statement.
  3. Parentheses that appear in a syntax diagram are part of the syntax. You must include them when forming an SQL statement.
Thus, as in the following simplified example of an SQL syntax diagram:
CREATE TABLE <Table name> (
     <Column name> {INTEGER | CHARACTER(5)} )
  1. The words CREATE and TABLE are SQL <keyword>s and must be included, without changes, in a CREATE TABLE statement.
  2. The words <Table name> and <Column name> are syntactic categories and must be replaced with an actual <Table name> and <Column name>, respectively, in a CREATE TABLE statement. The angle brackets around "Table name" and "Column name" indicate that these terms are defined with a syntax diagram somewhere in this book.
  3. The parentheses are part of the syntax and must be included, exactly where shown, in a CREATE TABLE statement.
  4. The braces and vertical bar after the <Column name> indicate that either one of the SQL <keyword>s "INTEGER" or "CHARACTER(5)" must be included, without changes, in a CREATE TABLE statement.
Based on this example, the following two SQL statements are the only valid uses of the syntax:
CREATE TABLE A_Table_Name (
     a_column_name INTEGER);

   CREATE TABLE A_Table_Name (
     a_column_name CHARACTER(5));

Saturday, January 29, 2011

Larry Kudlow - Questionable Economic Views from an Alleged Democrat

Kudlow opposes estate taxes, as well as taxes on dividends and capital gains. He also advocates that employees be compelled to make greater contributions to their pension and medical costs, suggesting that these expenses are an undue burden on businesses and defends high executive compensation as a manifestation of market forces and opposes most forms of government regulation.


Source: Wikipedia - http://en.wikipedia.org/wiki/Lawrence_Kudlow

This was economic prediction prior to "The Great Recession" -

Kudlow firmly denied that U.S. would enter a recession (in 2007) or that the U.S. was in recession (in early and mid 2008). In December, 2007 he wrote: "The recession debate is over. It's not gonna happen. Time to move on. At a bare minimum, we are looking at Goldilocks 2.0. (And that's a minimum). The Bush boom is alive and well. It's finishing up its sixth splendid year with many more years to come".[11] In May, 2008 he wrote:"President George W. Bush may turn out to be the top economic forecaster in the country" in his "R" is for "Right".[12]


He couldn't have been more wrong.

Wednesday, January 26, 2011

Work in SQL Server 2008 R2


SELECT TDate = t1.TDate, TOpenP = t1.TOpenP, THighP = t1.THighP,
TLowP = t1.TLowP, TCloseP = t1.TCloseP, TVolume = t1.TVolume
    FROM dbo.ibm$ t1 
    INNER JOIN dbo.intc$ t2 
    ON t1.TDate = t2.TDate
    AND t1.TDate = '2011-01-21 00:00:00.000'


=======================================================================
Ambiguous column name is usually the result of a poorly constructed inner join

BAD:
----------------------------------------------------

SELECT TDate
From ibm$
INNER JOIN intc$
ON ibm$.TDate=intc$.TDate
----------------------------------------------------
GOOD:

SELECT TDate = t1.TDate
    FROM ibm$ t1 
    JOIN intc$ t2 
    ON t1.TDate = t2.TDate

SELECT TDate = t1.TDate

    FROM ibm$ t1 

    JOIN intc$ t2 

    ON t1.TDate = t2.TDate

    AND t1.TDate = '2011-01-21 00:00:00.000'







/****** Script for SelectTopNRows command from SSMS  ******/
SELECT TOP 1000 [F1]
      ,[F2]
      ,[F3]
      ,[F4]
      ,[F5]
      ,[F6]
  FROM [trading].[dbo].[intc$]

--------------------------------------------------------------------------

/****** Script for SelectTopNRows command from SSMS  ******/
SELECT TOP 1000 [name]
      ,[team]
      ,[salary]
      ,[sickleave]
  FROM [BASKETBALL].[dbo].[DONG]
--------------------------------------------


create database trading
----------------------------------------------

create table intel
(t_date date not null,
t_open decimal(10,2) not null,
t_high decimal(10,2) not null,
t_low decimal(10,2) not null,
t_close decimal(10,2) not null,
volume numeric(11) not null);
----------------------------------------------
SELECT * FROM ‘intc$’
-----------------------------------------------

Click Finish to perform the following actions:


Source Location : C:\Users\edog\Documents\intc.xls
Source Provider : Microsoft.Jet.OLEDB.4.0
Destination Location : DRC-PC\DONGSERVER
Destination Provider : SQLNCLI10

·          Copy rows from `intc$` to [dbo].[intc$]
The new target table will be created.

·          The package will not be saved.
·          The package will be run immediately.

Provider mapping file : C:\Program Files\Microsoft SQL Server\100\DTS\MappingFiles\JetToMSSql9.xml
------------------------------------------------------------------------------------------------------------------------------------------------------------------


Sunday, January 16, 2011

The Federal Reserve Keeping Interest Rates Artificially Low

Very simply, Volcker bit the bullet and stopped the purchase of government securities that were keeping interest rates artificially low.

Wednesday, January 12, 2011

SymbolNameTradeChangeVolumeAvg Vol (3m)Last Trade SizeShort RatioPre Mkt Chg & PctFloatAnnualized GainAft Mkt Chg & PctRelated InfoZDH11.CBT
Dow Jones Industrial Average In
11,675.00Up 59.00Up 0.51%0-1---Chart, more...^DJI
Dow Jones Industrial Average
11,772.39Up 100.51Up 0.86%68,009,1314,095,380,0000---Chart, more...DIA
SPDR Dow Jones Industrial Avera
117.65Up 1.10Up 0.94%2,530,3176,405,2901,000-Up 1.00Up 0.86%--N/AN/AChart, Message, Profile, more...^IXIC
NASDAQ Composite
2,733.74Up 16.91Up 0.62%01,855,090,0000---Chart, more...QQQQ
PowerShares Exchange-Traded Fun
56.50Up 0.34Up 0.61%23,362,34061,997,7001,100-Up 0.32Up 0.56%--N/AN/AChart, Message, Profile, more...^RUT
Russell 2000
802.16Up 7.40Up 0.93%0N/A0---Chart, more...IWM
iShares Russell 2000
80.06Up 0.77Up 0.97%20,231,09546,332,500200-Up 0.73Up 0.92%--N/AN/AChart, Message, Profile, more...^GSPC
S&P 500 INDEX,RTH
1,285.81Up 11.33Up 0.89%1,613,715,9244,095,380,0000---Chart, more...SPY
SPDR S&P 500
128.71Up 1.28Up 1.00%51,046,250158,977,000300-Up 1.18Up 0.93%--N/AN/AChart, Message, Profile, more...^VIX
VOLATILITY S&P 500
16.28Down 0.61Down 3.61%0N/A0---Chart, more...^FTSE
FTSE 100
6,050.72Up 36.69Up 0.61%0783,056,0000---Chart, more...^GDAXI
DAX
7,068.78Up 127.21Up 1.83%030,358,6000---Chart, more...^FCHI
CAC 40
3,945.07Up 83.15Up 2.15%0120,097,0000---Chart, more...^IBEX
IBEX 35
10,101.20Up 519.10Up 5.42%3,797,922231,011,0000---Chart, more...^N225
NIKKEI 225
10,512.80Up 2.12Up 0.02%0132,0100---Chart, more...^HSI
HANG SENG INDEX
24,125.61Up 365.27Up 1.54%01,612,000,0000---Chart, more...CR-Y.NYB
Reuters/Jefferies CRB - Index -
334.42Up 2.96Up 0.89%0-0---Chart, more...GLD
SPDR Gold Trust
134.99Up 0.08Up 0.06%5,952,89416,420,3002,000-Down 0.03Down 0.02%--N/AN/AChart, Message, Profile, more...SLV
iShares Silver Trust
28.95Up 0.06Up 0.20%10,384,16528,985,300200-Down 0.07Down 0.25%--N/AN/AChart, Message, Profile, more...JJC
iPath Dow Jones UBS Copper Tota
58.82Up 0.89Up 1.54%98,192186,882200-Up 0.85Up 1.47%--N/AN/AChart, Message, Profile, more...PALL
ETFS Physical Palladium Shares
80.16Up 2.18Up 2.80%165,281314,558100-Up 2.22Up 2.85%--N/AN/AChart, Message, Profile, more...PPLT
ETFS Physical Platinum Shares
178.33Up 2.33Up 1.32%59,19872,234100-Up 2.54Up 1.44%--N/AN/AChart, Message, Profile, more...COPX
Global X Copper Miners ETF
20.13Up 0.53Up 2.70%151,005183,723250-Up 0.55Up 2.81%--N/AN/AChart, Message, Profile, more...PAH11.NYM
Palladium Mar 11
808.35Up 24.60Up 3.14%0-1---Chart, more...PLH11.NYM
Platinum Mar 11
1,784.80Up 17.20Up 0.97%0-1---Chart, more...GCH11.CMX
Gold Mar 11
1,383.70Down 1.60Down 0.12%0-2---Chart, more...SIH11.CMX
Silver Mar 11
29.61Up 0.11Up 0.36%0-1---Chart, more...HGH11.CMX
Copper Mar 11
4.42Up 0.07Up 1.56%0-1---Chart, more...CLF11.NYM
Light Sweet Crude Oil Futures,J
88.70Down 0.11Down 0.12%0-1---Chart, more...RBF11.NYM
New York Harbor RBOB (Blendstoc
2.45Up 0.06Up 2.43%0-1---Chart, more...HOF11.NYM
Heating Oil Futures,Jan-2011,Co
2.54Up 0.06Up 2.35%0-3---Chart, more...NGF11.NYM
Henry Hub Natural Gas Futures,J
4.220.000.00%0-1---Chart, more...EHF11.CBT
Ethanol (Denatured Fuel) Future
2.31Down 0.01Down 0.35%0-0---Chart, more...KCH11.NYB
Coffee Mar 11
241.10Up 6.40Up 2.73%0-1---Chart, more...CTH11.NYB
Cotton Mar 11
149.40Up 2.15Up 1.46%0-1---Chart, more...WH11.CBT
Wheat Mar 11
770.50Up 11.00Up 1.45%0-1---Chart, more...CH11.CBT
Corn Mar 11
630.25Up 23.25Up 3.83%0-3---Chart, more...SF11.CBT
Soybeans Jan 11
1,413.00Up 59.00Up 4.37%0-1---Chart, more...NGH11.CBT
Five-Year Interest Rate Swap Fu
107.53Down 0.34Down 0.32%0-10---Chart, more...7IH11.CBT
Seven Year Interest Rate Swap F
106.27Down 0.36Down 0.34%0-3---Chart, more...SRH11.CBT
Ten-Year Interest Rate Swap Fut
104.200.000.00%0-0---Chart, more...NZH11.CBT
Thirty-Year Interest Rate Swap
96.230.000.00%0-0---Chart, more...^IRX
TREASURY BILL 13-WEEK
0.140.000.00%0N/A0---Chart, more...^FVX
Treasury Yield 5 Years
2.03Up 0.71Up 53.67%0N/A0---Chart, more...^TYX
Treasury Yield 30 Years
4.54Up 0.06Up 1.29%0N/A0---Chart, more...TBT
ProShares UltraShort Lehman 20+
38.91Up 0.56Up 1.46%5,328,95015,321,400500-Up 0.53Up 1.38%--N/AN/AChart, Message, Profile, more...EDF11.CME
Eurodollar Futures,Jan-2011,Com
99.70Up 0.00Up 0.00%0-123---Chart, more...ZQH11.CBT
Thirty-Day Fed Fund Futures Set
99.83Up 0.01Up 0.01%0-31---Chart, more...TBH11.CME
Three-month US Treasury Bills F
99.270.000.00%0-0---Chart, more...ZTH11.CBT
Two-Year US Treasury Note Futur
109.40Down 0.07Down 0.06%0-3---Chart, more...Z3NH11.CBT
U.S. Treas Notes 3 year Futures
114.000.000.00%0-0---Chart, more...ZFH11.CBT
Five-Year US Treasury Note Futu
117.66Down 0.30Down 0.25%0-5---Chart, more...ZNH11.CBT
Ten-Year US Treasury Note Futur
120.13Down 0.42Down 0.35%0-1---Chart, more...ZBH11.CBT
Thirty-Year US Treasury Bond Fu
120.34Down 0.63Down 0.52%0-6---Chart, more...NBF11.NYM
Chicago Basis Swap Futures,Jan-
0.180.000.00%0-0---Chart, more...399130.SZ
MANUFACTURING INDEX
1,377.34Up 5.04Up 0.37%2,304,743,9603,910,030,000477,930---Chart, more...DX-Y.NYB
US Dollar Index Futures Cash,Co
80.28Down 0.57Down 0.70%0-0---Chart, more...USDJPY=X
USD/JPY
83.1750Down 0.1600Down 0.19%0-0---Chart, more...EURUSD=X
EUR/USD
1.3092Up 0.01Up 0.91%0N/A0---Chart, Message, more...AUDUSD=X
AUD/USD
0.9943Up 0.01Up 0.79%0-0---Chart, Message, more...USDCAD=X
USD/CAD
0.9872Down 0.0026Down 0.26%0-0---Chart, more...USDCHF=X
USD/CHF
0.9714Down 0.0022Down 0.23%0-0---Chart, more...USDCNY=X
USD/CNY
6.6085Down 0.0325Down 0.49%0-0---Chart, more...SLW
Silver Wheaton Corp Common Shar
34.65Down 0.46Down 1.31%4,454,59810,219,9005001Down 0.57Down 1.62%345.84M-N/AN/AChart, Message, Profile, more...AGQ
ProShares Ultra Silver
145.34Up 0.65Up 0.45%443,5061,157,420500-Down 0.54Down 0.37%--N/AN/AChart, Message, Profile, more...VXX
iPath S&P 500 VIX Short Term Fu
33.29Down 1.65Down 4.73%8,613,03110,058,0003,700-Down 1.58Down 4.52%--N/AN/AChart, Message, Profile, more...XRT
SPDR S&P Retail ETF
47.41Up 0.65Up 1.39%5,157,1639,684,660500-Up 0.63Up 1.35%--N/AN/AChart, Message, Profile, more...XOP
SPDR S&P Oil & Gas Explor & Pro
54.29Up 0.54Up 1.00%705,6393,339,790100-Up 0.55Up 1.01%--N/AN/AChart, Message, Profile, more...XME
SPDR S&P Metals & Mining ETF
70.83Down 0.06Down 0.08%1,513,2263,570,540100-Down 0.20Down 0.28%--N/AN/AChart, Message, Profile, more...XLI
SPDR Select Sector Fund - Indus
35.82Up 0.38Up 1.07%3,777,08111,710,500300-Up 0.34Up 0.96%--N/AN/AChart, Message, Profile, more...XHB
SPDR Series Trust SPDR Homebuil
18.17Up 0.23Up 1.25%1,414,7194,934,270100-Up 0.21Up 1.17%--N/AN/AChart, Message, Profile, more...VWO
Vanguard Emerging Markets ETF
48.60Up 0.81Up 1.69%9,236,86816,487,100100-Up 0.77Up 1.61%--N/AN/AChart, Message, Profile, more...XLK
SPDR Select Sector Fund - Techn
25.95Up 0.22Up 0.86%3,618,3109,319,670100-Up 0.21Up 0.82%--N/AN/AChart, Message, Profile, more...XLY
SPDR Select Sector Fund - Consu
37.85Up 0.19Up 0.50%5,118,2306,338,520100-Up 0.16Up 0.42%--N/AN/AChart, Message, Profile, more...XLP
SPDR Select Sector Fund - Consu
29.31Up 0.28Up 0.95%2,224,4685,448,740100-Up 0.25Up 0.86%--N/AN/AChart, Message, Profile, more...XLU
SPDR Select Sector Fund - Utili
31.68Up 0.23Up 0.72%2,188,8185,259,320100-Up 0.22Up 0.68%--N/AN/AChart, Message, Profile, more...UWM
ProShares Ultra Russell2000
44.71Up 0.85Up 1.94%1,009,3212,110,860100-Up 0.77Up 1.76%--N/AN/AChart, Message, Profile, more...XLV
SPDR Select Sector Fund - Healt
32.35Up 0.21Up 0.65%879,6035,677,5606,000-Up 0.19Up 0.59%--N/AN/AChart, Message, Profile, more...TWM
ProShares UltraShort Russell200
11.97Down 0.22Down 1.81%2,409,3924,781,510300-Down 0.20Down 1.64%--N/AN/AChart, Message, Profile, more...SRS
ProShares UltraShort Real Estat
18.08Down 0.24Down 1.31%541,3872,198,640200-Down 0.13Down 0.71%--N/AN/AChart, Message, Profile, more...SH
ProShares Short S&P500
42.85Down 0.42Down 0.97%705,3792,290,620500-Down 0.38Down 0.88%--N/AN/AChart, Message, Profile, more...RSX
Market Vectors TR Russia ETF
40.04Up 1.32Up 3.40%2,508,2212,699,290157-Up 1.30Up 3.36%--N/AN/AChart, Message, Profile, more...IYR
iShares Dow Jones U.S. Real Est
55.96Up 0.35Up 0.63%3,611,7259,008,140200-Up 0.15Up 0.27%--N/AN/AChart, Message, Profile, more...UUP
PowerShares DB USD Index Bullis
23.07Down 0.20Down 0.84%1,305,3955,136,710100-Down 0.16Down 0.67%--N/AN/AChart, Message, Profile, more...Total