Optimizing - Mailing list pgsql-sql

From Jeff Sack
Subject Optimizing
Date
Msg-id 003301c168a0$034d53e0$019ca8c0@jeff
Whole thread Raw
Responses Re: Optimizing
List pgsql-sql
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Hello all.<span style="mso-spacerun:yes">  </span>I have an academic project that I’m working on
and,as I’m relatively new to optimization techniques and database design, I’m wondering if some of you can give me some
pointers.<spanstyle="mso-spacerun:yes">  </span>Below is the schema (to model baseball statistics), and I’m pretty much
stuckwith it at this point.<span style="mso-spacerun:yes">  </span>If anyone has any suggestions involving changing the
schema,I’d appreciate hearing them just for future reference…</span></font><p class="MsoNormal"><font face="Arial"
size="2"><spanstyle="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">There are several interesting queries that I’ve been constructing just to get a feel for this
schema,and given that some of these tables contain 100,000-200,000 <span class="SpellE">tuples</span>, some queries are
takinga good 5-10 seconds to execute.<span style="mso-spacerun:yes">  </span>I’m just wondering if this is simply the
faultof my schema or are these queries poorly constructed? <span style="mso-spacerun:yes"> </span>Here are some queries
I’vebeen trying:</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Here’s a query for the top ten all time home run leaders:</span></font><p class="MsoNormal"><span
class="GramE"><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:Arial">select</span></font></span><fontface="System"
size="2"><spanstyle="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
Arial"> <span class="SpellE">P.first_name</span>, <span class="SpellE">P.last_name</span>, <span
class="SpellE">S.player_id</span>,sum(<span class="SpellE">B.hr</span>) as hr, (sum(<span
class="SpellE">B.h</span>)::float/ sum(<span class="SpellE">B.ab</span>)::float) <span
class="SpellE">ab</span></span></font><pclass="MsoNormal"><span class="GramE"><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:Arial">from</span></font></span><fontface="System"
size="2"><spanstyle="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
Arial"> statistics S, <span class="SpellE">batting_stats</span> B, players P</span></font><p class="MsoNormal"><span
class="GramE"><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:Arial">where</span></font></span><fontface="System"
size="2"><spanstyle="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
Arial"> <span class="SpellE">S.id</span>=<span class="SpellE">B.id</span> and <span
class="SpellE">S.player_id</span>=<spanclass="SpellE">P.id</span> and <span
class="SpellE">B.ab</span>>0</span></font><pclass="MsoNormal"><span class="GramE"><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:Arial">group</span></font></span><fontface="System"
size="2"><spanstyle="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
Arial"> by <span class="SpellE">P.first_name</span>, <span class="SpellE">P.last_name</span>, <span
class="SpellE">S.player_id</span></span></font><pclass="MsoNormal"><span class="GramE"><font face="System"
size="2"><spanstyle="font-size:10.0pt;font-family:System;mso-bidi-font-family:Arial">order</span></font></span><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
Arial"> by hr <span class="SpellE">desc</span> limit 10;</span></font><p class="MsoNormal"><font face="System"
size="2"><spanstyle="font-size:10.0pt; 
font-family:System;mso-bidi-font-family:Arial"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">Selectthe 10 highest batting averages of all time where the batter had 600
ormore at bats.<span style="mso-spacerun:yes">  </span>Also gather the name, year, team, hits, at
bats...</span></font><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><font face="Courier
New"size="2"><span style="font-size:10.0pt;font-family:"Courier New""> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><spanclass="GramE"><font face="System" size="2"><span
style="font-size:10.0pt;font-family:
System;mso-bidi-font-family:"Courier New"">select</span></font></span><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
"Courier New""> (<span class="SpellE">B.h::float</span> / <span class="SpellE">B.ab</span>) as <span
class="SpellE">avg</span>,<span class="SpellE">B.h</span>, <span class="SpellE">B.ab</span>, <span
class="SpellE">S.year</span>,<span class="SpellE">P.first_name</span>, <span class="SpellE">P.last_name</span>, <span
class="SpellE">T.city</span>,<span class="SpellE">T.name</span> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><spanclass="GramE"><font face="System" size="2"><span
style="font-size:10.0pt;font-family:
System;mso-bidi-font-family:"Courier New"">from</span></font></span><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
"Courier New""> <span class="SpellE">batting_stats</span> B, statistics S, players P, Teams T </span></font><p
class="MsoNormal"style="mso-layout-grid-align:none;text-autospace:none"><span class="GramE"><font face="System"
size="2"><spanstyle="font-size:10.0pt;font-family: 
System;mso-bidi-font-family:"Courier New"">where</span></font></span><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
"Courier New""> <span class="SpellE">B.ab</span> > 600 and <span class="SpellE">S.id</span>=<span
class="SpellE">B.id</span>and <span class="SpellE">S.player_id</span>=<span class="SpellE">P.id</span> and <span
class="SpellE">S.team_id</span>=<spanclass="SpellE">T.id</span> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><spanclass="GramE"><font face="System" size="2"><span
style="font-size:10.0pt;font-family:
System;mso-bidi-font-family:"Courier New"">order</span></font></span><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
"Courier New""> by <span class="SpellE">avg</span> <span class="SpellE">desc</span> limit 10;</span></font><p
class="MsoNormal"><fontface="System" size="2"><span style="font-size:10.0pt; 
font-family:System;mso-bidi-font-family:Arial"> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">Tofind the names of the single season home run leaders, along with the total
numberof home runs, the team name/city and the year:</span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Courier New" size="2"><span
style="font-size:10.0pt;font-family:"CourierNew""> </span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><spanclass="GramE"><font face="System" size="2"><span
style="font-size:10.0pt;font-family:
System;mso-bidi-font-family:"Courier New"">select</span></font></span><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
"Courier New""> <span class="SpellE">P.first_name</span>, <span class="SpellE">P.last_name</span>, <span
class="SpellE">B.hr</span>,<span class="SpellE">T.name</span>, <span class="SpellE">T.city</span>, <span
class="SpellE">S.year</span>from statistics S, <span class="SpellE">batting_stats</span> B, players P, teams T
</span></font><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><span class="GramE"><font
face="System"size="2"><span style="font-size:10.0pt;font-family: 
System;mso-bidi-font-family:"Courier New"">where</span></font></span><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
"Courier New""> (<span class="SpellE">S.id</span>=<span class="SpellE">B.id</span>) and </span></font><p
class="MsoNormal"style="mso-layout-grid-align:none;text-autospace:none"><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
"Courier New"">(<span class="SpellE">S.player_id</span>=<span class="SpellE">P.id</span>) and </span></font><p
class="MsoNormal"style="mso-layout-grid-align:none;text-autospace:none"><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
"Courier New"">(<span class="SpellE">B.hr</span>>30) and</span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
"Courier New"">(<span class="SpellE">T.id</span>=<span class="SpellE">S.team_id</span>) limit 10;</span></font><p
class="MsoNormal"style="mso-layout-grid-align:none;text-autospace:none"><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
"Courier New""> </span></font><p class="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><font
face="Arial"size="2"><span style="font-size:10.0pt;font-family:Arial">You get the idea.<span style="mso-spacerun:yes"> 
</span>Thesequeries take a while.<span style="mso-spacerun:yes">  </span>Is this just the way it is or there things
thatcan be done to optimize this?<span style="mso-spacerun:yes">  </span></span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial"> </span></font><pclass="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">Oneseparate issue (the reason why the above examples are all about batting
statistics)I’m having is representing the innings pitched statistic. <span style="mso-spacerun:yes"> </span>The way it
isoften represented (and the way it is done in this schema) is something like this 123.0 means exactly 123 innings
pitched,123.1 means 123 1/3 innings, and 123.2 means 123 2/3 innings pitched.<span style="mso-spacerun:yes"> 
</span>I’mcontemplating the best way to write a function that knows how to sum these values accurately.<span
style="mso-spacerun:yes"> </span>Is this something that can be done with PL/PGSQL or should I go straight to something
likePLPERL?<span style="mso-spacerun:yes">  </span>Alternatively, I could research a way to represent fractions in the
DBand write a script to convert all values in this column.<span style="mso-spacerun:yes">  </span><span
class="GramE">Anyadvice here??</span></span></font><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial"> </span></font><pclass="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">Thanksin advance for any thoughts, comments, suggestions…</span></font><p
class="MsoNormal"style="mso-layout-grid-align:none;text-autospace:none"><font face="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial"> </span></font><pclass="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">-Jeff</span></font><divstyle="border:none;border-bottom:solid windowtext
1.0pt;mso-border-bottom-alt:
solid windowtext .75pt;padding:0in 0in 1.0pt 0in"><p class="MsoNormal" style="border:none;mso-border-bottom-alt:solid
windowtext.75pt; 
padding:0in;mso-padding-alt:0in 0in 1.0pt 0in"><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:Arial"> </span></font></div><p
class="MsoNormal"><b><fontface="System" size="2"><span style="font-size:10.0pt; 
font-family:System;mso-bidi-font-family:System;font-weight:bold"> </span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><spanclass="GramE"><b><font face="System" size="2"><span
style="font-size:10.0pt;
font-family:System;mso-bidi-font-family:System;font-weight:bold">create</span></font></b></span><b><font face="System"
size="2"><spanstyle="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"> table leagues</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold">(</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span>-- create an integer id field for easier and
efficientFK referencing</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">id</span><span
style="mso-tab-count:2">                    </span>serial,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">name</span><span
style="mso-tab-count:2">              </span><span class="SpellE">varchar</span>(50),</span></font></b><p
class="MsoNormal"style="mso-layout-grid-align:none;text-autospace:none"><b><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">first_year</span></span><spanstyle="mso-tab-count: 
1">         </span>integer not null </span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:2">                        </span><span class="GramE">check</span>
(<spanclass="SpellE">first_year</span> > 1850 and <span class="SpellE">first_year</span> <
2010),</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">last_year</span></span><spanstyle="mso-tab-count: 
1">         </span>integer</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:2">                        </span><span class="GramE">check</span>
(<spanclass="SpellE">first_year</span> > 1850 and <span class="SpellE">first_year</span> <
2010),</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">primary</span>
key(id),</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">constraint</span> <span
class="SpellE">chronological_order</span></span></font></b><pclass="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:2">                        </span><span class="GramE">check</span>
(<spanclass="SpellE">last_year</span> >= <span class="SpellE">first_year</span>)</span></font></b><p
class="MsoNormal"style="mso-layout-grid-align:none;text-autospace:none"><b><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold">);</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"> </span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"> </span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><spanclass="GramE"><b><font face="System" size="2"><span
style="font-size:10.0pt;
font-family:System;mso-bidi-font-family:System;font-weight:bold">create</span></font></b></span><b><font face="System"
size="2"><spanstyle="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"> table teams</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold">(</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">id</span><span
style="mso-tab-count:2">                    </span>serial,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">name</span><span
style="mso-tab-count:2">              </span><span class="SpellE">varchar</span>(50) not null,</span></font></b><p
class="MsoNormal"style="mso-layout-grid-align:none;text-autospace:none"><b><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">city</span><span
style="mso-tab-count:2">                 </span><span class="SpellE">varchar</span>(50),</span></font></b><p
class="MsoNormal"style="mso-layout-grid-align:none;text-autospace:none"><b><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">first_year</span></span><spanstyle="mso-tab-count: 
1">         </span>integer not null</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:2">                        </span><span class="GramE">check</span>
(<spanclass="SpellE">first_year</span> > 1850 and <span class="SpellE">first_year</span> <
2010),</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">last_year</span></span><spanstyle="mso-tab-count: 
1">         </span>integer</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:2">                        </span><span class="GramE">check</span>
(<spanclass="SpellE">first_year</span> > 1850 and <span class="SpellE">first_year</span> <
2010),</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">alt_id</span></span><spanstyle="mso-tab-count: 
2">               </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">league_id</span></span><spanstyle="mso-tab-count: 
1">        </span>integer not null,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">primary</span>
key(id),</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">foreign</span> key(<span
class="SpellE">alt_id</span>)references teams(id),</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">foreign</span> key(<span
class="SpellE">league_id</span>)references leagues(id)</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:2">                        </span><span class="GramE">on</span>
deletecascade,</span></font></b><p class="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">constraint</span> <span
class="SpellE">chronological_order</span></span></font></b><pclass="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:2">                        </span><span class="GramE">check</span>
(<spanclass="SpellE">last_year</span> >= <span class="SpellE">first_year</span>)</span></font></b><p
class="MsoNormal"style="mso-layout-grid-align:none;text-autospace:none"><b><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold">);</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"> </span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><spanclass="GramE"><b><font face="System" size="2"><span
style="font-size:10.0pt;
font-family:System;mso-bidi-font-family:System;font-weight:bold">create</span></font></b></span><b><font face="System"
size="2"><spanstyle="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"> table players</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold">(</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">id</span><span
style="mso-tab-count:2">                    </span>serial,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">first_name</span></span><spanstyle="mso-tab-count: 
1">       </span><span class="SpellE">varchar</span>(30),</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">last_name</span></span><spanstyle="mso-tab-count: 
1">       </span><span class="SpellE">varchar</span>(30) not null,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">bats</span><span
style="mso-tab-count:2">                </span>char(1) check (bats in ('L','R','S')),</span></font></b><p
class="MsoNormal"style="mso-layout-grid-align:none;text-autospace:none"><b><font face="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">throws</span><span
style="mso-tab-count:2">            </span>char(1) check (throws in ('L','R')),</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">dob</span></span><spanstyle="mso-tab-count: 
2">                  </span>date,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">primary</span>
key(id)</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold">);</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"> </span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><spanclass="GramE"><b><font face="System" size="2"><span
style="font-size:10.0pt;
font-family:System;mso-bidi-font-family:System;font-weight:bold">create</span></font></b></span><b><font face="System"
size="2"><spanstyle="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"> table statistics</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold">(</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">id</span><span
style="mso-tab-count:3">                                </span>serial,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">year</span><span
style="mso-tab-count:3">                            </span>integer not null,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">g</span><span
style="mso-tab-count:3">                                 </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">player_id</span></span><spanstyle="mso-tab-count: 
2">                     </span>integer not null,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">team_id</span></span><spanstyle="mso-tab-count: 
3">                                   </span>integer not null,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">foreign</span> key(<span
class="SpellE">player_id</span>)references players(id)</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:2">                        </span><span class="GramE">on</span>
deletecascade,</span></font></b><p class="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">foreign</span> key(<span
class="SpellE">team_id</span>)references teams(id)</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:2">                        </span><span class="GramE">on</span>
deletecascade,</span></font></b><p class="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">primary</span>
key(id)</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold">);</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"> </span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><spanclass="GramE"><b><font face="System" size="2"><span
style="font-size:10.0pt;
font-family:System;mso-bidi-font-family:System;font-weight:bold">create</span></font></b></span><b><font face="System"
size="2"><spanstyle="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"> table <span class="SpellE">managing_stats</span></span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold">(</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">id</span><span
style="mso-tab-count:3">                                </span>integer not null,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">w</span><span
style="mso-tab-count:3">                                 </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">l</span><span
style="mso-tab-count:3">                                  </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">primary</span>
key(id),</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">foreign</span> key(id)
referencesstatistics(id)</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:2">                        </span><span class="GramE">on</span>
deletecascade</span></font></b><p class="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold">);</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"> </span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><spanclass="GramE"><b><font face="System" size="2"><span
style="font-size:10.0pt;
font-family:System;mso-bidi-font-family:System;font-weight:bold">create</span></font></b></span><b><font face="System"
size="2"><spanstyle="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"> table <span class="SpellE">fielding_stats</span></span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold">(</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">id</span><span
style="mso-tab-count:3">                                </span>integer not null,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">pos</span><span
style="mso-tab-count:3">                             </span>char(5),</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">po</span></span><spanstyle="mso-tab-count:3">                               
</span>integer,</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">a</span><span
style="mso-tab-count:3">                                 </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">e</span><span
style="mso-tab-count:3">                                 </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">dp</span></span><spanstyle="mso-tab-count:3">                               
</span>integer,</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">primary</span>
key(id),</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">foreign</span> key(id)
referencesstatistics(id)</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:2">                        </span><span class="GramE">on</span>
deletecascade</span></font></b><p class="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold">);</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"> </span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><spanclass="GramE"><b><font face="System" size="2"><span
style="font-size:10.0pt;
font-family:System;mso-bidi-font-family:System;font-weight:bold">create</span></font></b></span><b><font face="System"
size="2"><spanstyle="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"> table <span class="SpellE">batting_stats</span></span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold">(</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">id</span><span
style="mso-tab-count:3">                                </span>integer not null,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">ab</span></span><spanstyle="mso-tab-count:3">                               
</span>integer,</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">r</span><span
style="mso-tab-count:3">                                  </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">h</span><span
style="mso-tab-count:3">                                 </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">doubles</span><span
style="mso-tab-count:3">                                  </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">triples</span><span
style="mso-tab-count:3">                         </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">hr</span><span
style="mso-tab-count:3">                                </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">rbi</span></span><spanstyle="mso-tab-count: 
3">                                </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">sb</span></span><spanstyle="mso-tab-count:3">                               
</span>integer,</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">cs</span></span><spanstyle="mso-tab-count:3">                               
</span>integer,</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">bb</span><span
style="mso-tab-count:3">                               </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">so</span><span
style="mso-tab-count:3">                               </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">sh</span></span><spanstyle="mso-tab-count:3">                               
</span>integer,</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">sf</span></span><spanstyle="mso-tab-count:3">                                
</span>integer,</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">ibb</span></span><spanstyle="mso-tab-count: 
3">                               </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">hbp</span></span><spanstyle="mso-tab-count: 
3">                              </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">primary</span>
key(id),</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">foreign</span> key(id)
referencesstatistics(id)</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:2">                        </span><span class="GramE">on</span>
deletecascade</span></font></b><p class="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold">);</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"> </span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><spanclass="GramE"><b><font face="System" size="2"><span
style="font-size:10.0pt;
font-family:System;mso-bidi-font-family:System;font-weight:bold">create</span></font></b></span><b><font face="System"
size="2"><spanstyle="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"> table <span class="SpellE">pitching_stats</span></span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold">(</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">id</span><span
style="mso-tab-count:3">                                </span>integer not null,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">w</span><span
style="mso-tab-count:3">                                 </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">l</span><span
style="mso-tab-count:3">                                  </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">gs</span></span><spanstyle="mso-tab-count:3">                               
</span>integer,</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">cg</span><span
style="mso-tab-count:3">                               </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">sh</span></span><spanstyle="mso-tab-count:1">        </span><span
style="mso-tab-count:2">                       </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">sv</span></span><spanstyle="mso-tab-count:3">                               
</span>integer,</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">ip</span></span><spanstyle="mso-tab-count:3">                                
</span>numeric(5,1),</span></font></b><pclass="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">h</span><span
style="mso-tab-count:3">                                 </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="SpellE"><span
class="GramE">er</span></span><spanstyle="mso-tab-count:3">                                
</span>integer,</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">hr</span><span
style="mso-tab-count:3">                                </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">bb</span><span
style="mso-tab-count:3">                               </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">so</span><span
style="mso-tab-count:3">                               </span>integer,</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">primary</span>
key(id),</span></font></b><pclass="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold"><span style="mso-tab-count:1">            </span><span class="GramE">foreign</span> key(id)
referencesstatistics(id)</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"><span style="mso-tab-count:2">                        </span><span class="GramE">on</span>
deletecascade</span></font></b><p class="MsoNormal" style="mso-layout-grid-align:none;text-autospace:none"><b><font
face="System"size="2"><span style="font-size:10.0pt;font-family:System;mso-bidi-font-family: 
System;font-weight:bold">);</span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"> </span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"> </span></font></b><p class="MsoNormal"
style="mso-layout-grid-align:none;text-autospace:none"><b><fontface="System" size="2"><span
style="font-size:10.0pt;font-family:System;mso-bidi-font-family:
System;font-weight:bold"> </span></font></b><p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size:10.0pt;
font-family:Arial"> </span></font></div>

pgsql-sql by date:

Previous
From: "Jeff Sack"
Date:
Subject: Optimization, etc
Next
From: "fstelpstra@yahoo.com"
Date:
Subject: Re: Design Tool for postgresql