the main way i optimise small queries is to image a path with the tables
joining the path (this has it's root in relational algebra and relational
calculus) and then build the query in my head imagining how i can reduce the
amount of 'traffic' flowing up the tree to the selects.
or draw the query as a tree (as ingres does as i seem to remember - great
idea for postgres ??????) like :
select X,Y,Z |
| |
/| t1.id=t2.id / | / |
/ | table table 2
obviously you'd have more joins and more tables but the aim is the restrict
the amount of data travelling up the tree so subsequent joins contain less
tuples.
if you need them i can dig out some references from books that i have read
(and forgotten !!!) so let me know if i'm only making sense to myself.
Steve
""Jeff Sack"" <sackj@alum.rpi.edu> wrote in message
news:003301c168a0$034d53e0$019ca8c0@jeff...
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_0034_01C1686D.B8B2E3E0
> Content-Type: text/plain;
> charset="us-ascii"
> Content-Transfer-Encoding: 7bit
>
>
> Hello all. 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. Below is the schema
> (to model baseball statistics), and I'm pretty much stuck with it at
> this point. If anyone has any suggestions involving changing the
> schema, I'd appreciate hearing them just for future reference.
>
> 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 tuples, some queries are taking a good 5-10
> seconds to execute. I'm just wondering if this is simply the fault of
> my schema or are these queries poorly constructed? Here are some
> queries I've been trying:
>
> Here's a query for the top ten all time home run leaders:
> select P.first_name, P.last_name, S.player_id, sum(B.hr) as hr,
> (sum(B.h)::float / sum(B.ab)::float) ab
> from statistics S, batting_stats B, players P
> where S.id=B.id and S.player_id=P.id and B.ab>0
> group by P.first_name, P.last_name, S.player_id
> order by hr desc limit 10;
>
> Select the 10 highest batting averages of all time where the batter had
> 600 or more at bats. Also gather the name, year, team, hits, at bats...
>
> select (B.h::float / B.ab) as avg, B.h, B.ab, S.year, P.first_name,
> P.last_name, T.city, T.name
> from batting_stats B, statistics S, players P, Teams T
> where B.ab > 600 and S.id=B.id and S.player_id=P.id and S.team_id=T.id
> order by avg desc limit 10;
>
> To find the names of the single season home run leaders, along with the
> total number of home runs, the team name/city and the year:
>
> select P.first_name, P.last_name, B.hr, T.name, T.city, S.year from
> statistics S, batting_stats B, players P, teams T
> where (S.id=B.id) and
> (S.player_id=P.id) and
> (B.hr>30) and
> (T.id=S.team_id) limit 10;
>
> You get the idea. These queries take a while. Is this just the way it
> is or there things that can be done to optimize this?
>
> One separate issue (the reason why the above examples are all about
> batting statistics) I'm having is representing the innings pitched
> statistic. The way it is often 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. I'm contemplating the best way to write a function that knows
> how to sum these values accurately. Is this something that can be done
> with PL/PGSQL or should I go straight to something like PLPERL?
> Alternatively, I could research a way to represent fractions in the DB
> and write a script to convert all values in this column. Any advice
> here??
>
> Thanks in advance for any thoughts, comments, suggestions.
>
> -Jeff
>
>
> create table leagues
> (
> -- create an integer id field for easier and efficient FK
> referencing
> id serial,
> name varchar(50),
> first_year integer not null
> check (first_year > 1850 and first_year < 2010),
> last_year integer
> check (first_year > 1850 and first_year < 2010),
> primary key(id),
> constraint chronological_order
> check (last_year >= first_year)
> );
>
>
> create table teams
> (
> id serial,
> name varchar(50) not null,
> city varchar(50),
> first_year integer not null
> check (first_year > 1850 and first_year < 2010),
> last_year integer
> check (first_year > 1850 and first_year < 2010),
> alt_id integer,
> league_id integer not null,
> primary key(id),
> foreign key(alt_id) references teams(id),
> foreign key(league_id) references leagues(id)
> on delete cascade,
> constraint chronological_order
> check (last_year >= first_year)
> );
>
> create table players
> (
> id serial,
> first_name varchar(30),
> last_name varchar(30) not null,
> bats char(1) check (bats in ('L','R','S')),
> throws char(1) check (throws in ('L','R')),
> dob date,
> primary key(id)
> );
>
> create table statistics
> (
> id serial,
> year integer not null,
> g integer,
> player_id integer not null,
> team_id integer not null,
> foreign key(player_id) references players(id)
> on delete cascade,
> foreign key(team_id) references teams(id)
> on delete cascade,
> primary key(id)
> );
>
> create table managing_stats
> (
> id integer not null,
> w integer,
> l integer,
> primary key(id),
> foreign key(id) references statistics(id)
> on delete cascade
> );
>
> create table fielding_stats
> (
> id integer not null,
> pos char(5),
> po integer,
> a integer,
> e integer,
> dp integer,
> primary key(id),
> foreign key(id) references statistics(id)
> on delete cascade
> );
>
> create table batting_stats
> (
> id integer not null,
> ab integer,
> r integer,
> h integer,
> doubles integer,
> triples integer,
> hr integer,
> rbi integer,
> sb integer,
> cs integer,
> bb integer,
> so integer,
> sh integer,
> sf integer,
> ibb integer,
> hbp integer,
> primary key(id),
> foreign key(id) references statistics(id)
> on delete cascade
> );
>
> create table pitching_stats
> (
> id integer not null,
> w integer,
> l integer,
> gs integer,
> cg integer,
> sh integer,
> sv integer,
> ip numeric(5,1),
> h integer,
> er integer,
> hr integer,
> bb integer,
> so integer,
> primary key(id),
> foreign key(id) references statistics(id)
> on delete cascade
> );
>
>
>
>
>
> ------=_NextPart_000_0034_01C1686D.B8B2E3E0
> Content-Type: text/html;
> charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
>
> <html xmlns:o=3D"urn:schemas-microsoft-com:office:office"
xmlns:w=3D"urn:sc=
> hemas-microsoft-com:office:word"
xmlns=3D"http://www.w3.org/TR/REC-html40">
>
> <head>
> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html;
charset=3Dus-ascii">
>
>
> <meta name=3DProgId content=3DWord.Document>
> <meta name=3DGenerator content=3D"Microsoft Word 10">
> <meta name=3DOriginator content=3D"Microsoft Word 10">
> <link rel=3DFile-List href=3D"cid:filelist.xml@01C1686D.B7A78E60">
> <!--[if gte mso 9]><xml>
> <o:OfficeDocumentSettings>
> <o:DoNotRelyOnCSS/>
> </o:OfficeDocumentSettings>
> </xml><![endif]--><!--[if gte mso 9]><xml>
> <w:WordDocument>
> <w:SpellingState>Clean</w:SpellingState>
> <w:GrammarState>Clean</w:GrammarState>
> <w:DocumentKind>DocumentEmail</w:DocumentKind>
> <w:EnvelopeVis/>
> <w:Compatibility>
> <w:BreakWrappedTables/>
> <w:SnapToGridInCell/>
> <w:WrapTextWithPunct/>
> <w:UseAsianBreakRules/>
> </w:Compatibility>
> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
> </w:WordDocument>
> </xml><![endif]-->
> <style>
> <!--
> /* Font Definitions */
> @font-face
> {font-family:System;
> panose-1:0 0 0 0 0 0 0 0 0 0;
> mso-font-charset:0;
> mso-generic-font-family:swiss;
> mso-font-format:other;
> mso-font-pitch:variable;
> mso-font-signature:3 0 0 0 1 0;}
> /* Style Definitions */
> p.MsoNormal, li.MsoNormal, div.MsoNormal
> {mso-style-parent:"";
> margin:0in;
> margin-bottom:.0001pt;
> mso-pagination:widow-orphan;
> font-size:12.0pt;
> font-family:"Times New Roman";
> mso-fareast-font-family:"Times New Roman";}
> a:link, span.MsoHyperlink
> {color:blue;
> text-decoration:underline;
> text-underline:single;}
> a:visited, span.MsoHyperlinkFollowed
> {color:purple;
> text-decoration:underline;
> text-underline:single;}
> span.EmailStyle17
> {mso-style-type:personal-compose;
> mso-style-noshow:yes;
> mso-ansi-font-size:10.0pt;
> mso-bidi-font-size:10.0pt;
> font-family:Arial;
> mso-ascii-font-family:Arial;
> mso-hansi-font-family:Arial;
> mso-bidi-font-family:Arial;
> color:windowtext;}
> span.SpellE
> {mso-style-name:"";
> mso-spl-e:yes;}
> span.GramE
> {mso-style-name:"";
> mso-gram-e:yes;}
> @page Section1
> {size:8.5in 11.0in;
> margin:1.0in 1.25in 1.0in 1.25in;
> mso-header-margin:.5in;
> mso-footer-margin:.5in;
> mso-paper-source:0;}
> div.Section1
> {page:Section1;}
> -->
> </style>
> <!--[if gte mso 10]>
> <style>
> /* Style Definitions */=20
> table.MsoNormalTable
> {mso-style-name:"Table Normal";
> mso-tstyle-rowband-size:0;
> mso-tstyle-colband-size:0;
> mso-style-noshow:yes;
> mso-style-parent:"";
> mso-padding-alt:0in 5.4pt 0in 5.4pt;
> mso-para-margin:0in;
> mso-para-margin-bottom:.0001pt;
> mso-pagination:widow-orphan;
> font-size:10.0pt;
> font-family:"Times New Roman";}
> </style>
> <![endif]-->
> </head>
>
> <body lang=3DEN-US link=3Dblue vlink=3Dpurple style=3D'tab-interval:.5in'>
>
> <div class=3DSection1>
>
> <p class=3DMsoNormal><font size=3D2 face=3DArial><span
style=3D'font-size:1=
> 0.0pt;
> font-family:Arial'><o:p> </o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 face=3DArial><span
style=3D'font-size:1=
> 0.0pt;
> font-family:Arial'>Hello all.<span style=3D'mso-spacerun:yes'>
</span=
> >I
> have an academic project that I’m working on and, as I’m
relati=
> vely
> new to optimization techniques and database design, I’m wondering if
=
> some
> of you can give me some pointers.<span style=3D'mso-spacerun:yes'>
</=
> span>Below
> is the schema (to model baseball statistics), and I’m pretty much
stu=
> ck
> with it at this point.<span style=3D'mso-spacerun:yes'> </span>If
any=
> one
> has any suggestions involving changing the schema, I’d appreciate
hea=
> ring
> them just for future reference…<o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 face=3DArial><span
style=3D'font-size:1=
> 0.0pt;
> font-family:Arial'><o:p> </o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 face=3DArial><span
style=3D'font-size:1=
> 0.0pt;
> font-family:Arial'>There are several interesting queries that I’ve
be=
> en
> constructing just to get a feel for this schema, and given that some of
the=
> se
> tables contain 100,000-200,000 <span class=3DSpellE>tuples</span>, some
que=
> ries
> are taking a good 5-10 seconds to execute.<span
style=3D'mso-spacerun:yes'>=
>
> </span>I’m just wondering if this is simply the fault of my schema
or=
> are
> these queries poorly constructed? <span
> style=3D'mso-spacerun:yes'> </span>Here are some queries I’ve
be=
> en
> trying:<o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 face=3DArial><span
style=3D'font-size:1=
> 0.0pt;
> font-family:Arial'><o:p> </o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 face=3DArial><span
style=3D'font-size:1=
> 0.0pt;
> font-family:Arial'>Here’s a query for the top ten all time home run
> leaders:<o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><span class=3DGramE><font size=3D2
face=3DSystem><span
>
style=3D'font-size:10.0pt;font-family:System;mso-bidi-font-family:Arial'>se=
> lect</span></font></span><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> Arial'> <span class=3DSpellE>P.first_name</span>, <span
class=3DSpellE>P.la=
> st_name</span>,
> <span class=3DSpellE>S.player_id</span>, sum(<span
class=3DSpellE>B.hr</spa=
> n>) as
> hr, (sum(<span class=3DSpellE>B.h</span>)::float / sum(<span
class=3DSpellE=
> >B.ab</span>)::float)
> <span class=3DSpellE>ab</span><o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><span class=3DGramE><font size=3D2
face=3DSystem><span
>
style=3D'font-size:10.0pt;font-family:System;mso-bidi-font-family:Arial'>fr=
> om</span></font></span><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> Arial'> statistics S, <span class=3DSpellE>batting_stats</span> B, players
=
> P<o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><span class=3DGramE><font size=3D2
face=3DSystem><span
>
style=3D'font-size:10.0pt;font-family:System;mso-bidi-font-family:Arial'>wh=
> ere</span></font></span><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> Arial'> <span class=3DSpellE>S.id</span>=3D<span
class=3DSpellE>B.id</span>=
> and <span
> class=3DSpellE>S.player_id</span>=3D<span class=3DSpellE>P.id</span> and
<s=
> pan
> class=3DSpellE>B.ab</span>>0<o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><span class=3DGramE><font size=3D2
face=3DSystem><span
>
style=3D'font-size:10.0pt;font-family:System;mso-bidi-font-family:Arial'>gr=
> oup</span></font></span><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> Arial'> by <span class=3DSpellE>P.first_name</span>, <span
class=3DSpellE>P=
> .last_name</span>,
> <span class=3DSpellE>S.player_id</span><o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><span class=3DGramE><font size=3D2
face=3DSystem><span
>
style=3D'font-size:10.0pt;font-family:System;mso-bidi-font-family:Arial'>or=
> der</span></font></span><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> Arial'> by hr <span class=3DSpellE>desc</span> limit
10;<o:p></o:p></span><=
> /font></p>
>
> <p class=3DMsoNormal><font size=3D2 face=3DSystem><span
style=3D'font-size:=
> 10.0pt;
>
font-family:System;mso-bidi-font-family:Arial'><o:p> </o:p></span></fo=
> nt></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>Se=
> lect the
> 10 highest batting averages of all time where the batter had 600 or more
at
> bats.<span style=3D'mso-spacerun:yes'> </span>Also gather the name,
y=
> ear,
> team, hits, at bats...<o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3D"Courier New"><span
style=3D'font-size:10.0pt;font-family:"=
> Courier New"'><o:p> </o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;=
> font-family:
> System;mso-bidi-font-family:"Courier
New"'>select</span></font></span><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> "Courier New"'> (<span class=3DSpellE>B.h::float</span> / <span
class=3DSpe=
> llE>B.ab</span>)
> as <span class=3DSpellE>avg</span>, <span class=3DSpellE>B.h</span>, <span
> class=3DSpellE>B.ab</span>, <span class=3DSpellE>S.year</span>, <span
class=
> =3DSpellE>P.first_name</span>,
> <span class=3DSpellE>P.last_name</span>, <span
class=3DSpellE>T.city</span>=
> , <span
> class=3DSpellE>T.name</span> <o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;=
> font-family:
> System;mso-bidi-font-family:"Courier New"'>from</span></font></span><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> "Courier New"'> <span class=3DSpellE>batting_stats</span> B, statistics S,
> players P, Teams T <o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;=
> font-family:
> System;mso-bidi-font-family:"Courier New"'>where</span></font></span><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> "Courier New"'> <span class=3DSpellE>B.ab</span> > 600 and <span class=
> =3DSpellE>S.id</span>=3D<span
> class=3DSpellE>B.id</span> and <span
class=3DSpellE>S.player_id</span>=3D<s=
> pan
> class=3DSpellE>P.id</span> and <span
class=3DSpellE>S.team_id</span>=3D<span
> class=3DSpellE>T.id</span> <o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;=
> font-family:
> System;mso-bidi-font-family:"Courier New"'>order</span></font></span><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> "Courier New"'> by <span class=3DSpellE>avg</span> <span
class=3DSpellE>des=
> c</span>
> limit 10;<o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 face=3DSystem><span
style=3D'font-size:=
> 10.0pt;
>
font-family:System;mso-bidi-font-family:Arial'><o:p> </o:p></span></fo=
> nt></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>To=
> find the
> names of the single season home run leaders, along with the total number
of
> home runs, the team name/city and the year:<o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3D"Courier New"><span
style=3D'font-size:10.0pt;font-family:"=
> Courier New"'><o:p> </o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;=
> font-family:
> System;mso-bidi-font-family:"Courier
New"'>select</span></font></span><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> "Courier New"'> <span class=3DSpellE>P.first_name</span>, <span
class=3DSpe=
> llE>P.last_name</span>,
> <span class=3DSpellE>B.hr</span>, <span class=3DSpellE>T.name</span>,
<span
> class=3DSpellE>T.city</span>, <span class=3DSpellE>S.year</span> from
stati=
> stics S,
> <span class=3DSpellE>batting_stats</span> B, players P, teams T
<o:p></o:p>=
> </span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;=
> font-family:
> System;mso-bidi-font-family:"Courier New"'>where</span></font></span><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> "Courier New"'> (<span class=3DSpellE>S.id</span>=3D<span
class=3DSpellE>B.=
> id</span>)
> and <o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> "Courier New"'>(<span class=3DSpellE>S.player_id</span>=3D<span
class=3DSpe=
> llE>P.id</span>)
> and <o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> "Courier New"'>(<span class=3DSpellE>B.hr</span>>30)
and<o:p></o:p></spa=
> n></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> "Courier New"'>(<span class=3DSpellE>T.id</span>=3D<span
class=3DSpellE>S.t=
> eam_id</span>)
> limit 10;<o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> "Courier New"'><o:p> </o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>Yo=
> u get the
> idea.<span style=3D'mso-spacerun:yes'> </span>These queries take a
wh=
> ile.<span
> style=3D'mso-spacerun:yes'> </span>Is this just the way it is or
there
> things that can be done to optimize this?<span
style=3D'mso-spacerun:yes'>&=
> nbsp;
> </span><o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'><o=
> :p> </o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>On=
> e separate
> issue (the reason why the above examples are all about batting statistics)
=
> I’m
> having is representing the innings pitched statistic. <span
> style=3D'mso-spacerun:yes'> </span>The way it is often represented
(an=
> d the
> way it is done in this schema) is something like this 123.0 means exactly
1=
> 23
> innings pitched, 123.1 means 123 1/3 innings, and 123.2 means 123 2/3
innin=
> gs
> pitched.<span style=3D'mso-spacerun:yes'> </span>I’m
contemplat=
> ing
> the best way to write a function that knows how to sum these values
> accurately.<span style=3D'mso-spacerun:yes'> </span>Is this
something=
> that
> can be done with PL/PGSQL or should I go straight to something like
PLPERL?=
> <span
> style=3D'mso-spacerun:yes'> </span>Alternatively, I could research a
=
> way to
> represent fractions in the DB and write a script to convert all values in
t=
> his
> column.<span style=3D'mso-spacerun:yes'> </span><span
class=3DGramE>A=
> ny
> advice here??</span><o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'><o=
> :p> </o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>Th=
> anks in
> advance for any thoughts, comments,
suggestions…<o:p></o:p></span></f=
> ont></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'><o=
> :p> </o:p></span></font></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><font
> size=3D2 face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>-J=
> eff<o:p></o:p></span></font></p>
>
> <div style=3D'border:none;border-bottom:solid windowtext
1.0pt;mso-border-b=
> ottom-alt:
> solid windowtext .75pt;padding:0in 0in 1.0pt 0in'>
>
> <p class=3DMsoNormal style=3D'border:none;mso-border-bottom-alt:solid
windo=
> wtext .75pt;
> padding:0in;mso-padding-alt:0in 0in 1.0pt 0in'><font size=3D2
face=3DSystem=
> ><span
>
style=3D'font-size:10.0pt;font-family:System;mso-bidi-font-family:Arial'><o=
> :p> </o:p></span></font></p>
>
> </div>
>
> <p class=3DMsoNormal><b><font size=3D2 face=3DSystem><span
style=3D'font-si=
> ze:10.0pt;
>
font-family:System;mso-bidi-font-family:System;font-weight:bold'><o:p> =
> ;</o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><b><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0=
> pt;
>
font-family:System;mso-bidi-font-family:System;font-weight:bold'>create</sp=
> an></font></b></span><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'> table leagues<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>(<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span>--
> create an integer id field for easier and efficient FK
referencing<o:p></o:=
> p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>id</span><span
style=3D'mso-tab-count:2'> &n=
>
bsp;  =
> ; </span>serial,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>name</span><span
style=3D'mso-tab-count:2'> =
>
</span><=
> span
> class=3DSpellE>varchar</span>(50),<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>first_year</span></span><span
style=3D'm=
> so-tab-count:
> 1'> </span>integer not
null=
> <o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DGramE>check</span> (<span class=3DSpellE>first_year</span> >
185=
> 0 and <span
> class=3DSpellE>first_year</span> <
2010),<o:p></o:p></span></font></b></=
> p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>last_year</span></span><span
style=3D'ms=
> o-tab-count:
> 1'>
</span>integer<o:p></o:=
> p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DGramE>check</span> (<span class=3DSpellE>first_year</span> >
185=
> 0 and <span
> class=3DSpellE>first_year</span> <
2010),<o:p></o:p></span></font></b></=
> p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>primary</span> key(id),<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>constraint</span> <span
class=3DSpellE>chronological_order</s=
> pan><o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DGramE>check</span> (<span class=3DSpellE>last_year</span> >=3D
<=
> span
> class=3DSpellE>first_year</span>)<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>);<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><o:p> </o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><o:p> </o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><b><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0=
> pt;
>
font-family:System;mso-bidi-font-family:System;font-weight:bold'>create</sp=
> an></font></b></span><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'> table teams<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>(<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>id</span><span
style=3D'mso-tab-count:2'> &n=
>
bsp;  =
> ; </span>serial,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>name</span><span
style=3D'mso-tab-count:2'> =
>
</span><=
> span
> class=3DSpellE>varchar</span>(50) not
null,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>city</span><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DSpellE>varchar</span>(50),<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>first_year</span></span><span
style=3D'm=
> so-tab-count:
> 1'> </span>integer not
null=
> <o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DGramE>check</span> (<span class=3DSpellE>first_year</span> >
185=
> 0 and <span
> class=3DSpellE>first_year</span> <
2010),<o:p></o:p></span></font></b></=
> p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>last_year</span></span><span
style=3D'ms=
> o-tab-count:
> 1'>
</span>integer<o:p></o:=
> p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DGramE>check</span> (<span class=3DSpellE>first_year</span> >
185=
> 0 and <span
> class=3DSpellE>first_year</span> <
2010),<o:p></o:p></span></font></b></=
> p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>alt_id</span></span><span
style=3D'mso-t=
> ab-count:
>
2'> =
> </span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>league_id</span></span><span
style=3D'ms=
> o-tab-count:
> 1'> </span>integer not
null,<o:p>=
> </o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>primary</span> key(id),<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>foreign</span> key(<span class=3DSpellE>alt_id</span>)
refere=
> nces
> teams(id),<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>foreign</span> key(<span class=3DSpellE>league_id</span>)
ref=
> erences
> leagues(id)<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DGramE>on</span> delete cascade,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>constraint</span> <span
class=3DSpellE>chronological_order</s=
> pan><o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DGramE>check</span> (<span class=3DSpellE>last_year</span> >=3D
<=
> span
> class=3DSpellE>first_year</span>)<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>);<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><o:p> </o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><b><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0=
> pt;
>
font-family:System;mso-bidi-font-family:System;font-weight:bold'>create</sp=
> an></font></b></span><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'> table players<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>(<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>id</span><span
style=3D'mso-tab-count:2'> &n=
>
bsp;  =
> ; </span>serial,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>first_name</span></span><span
style=3D'm=
> so-tab-count:
> 1'> </span><span
class=3DSpellE>varchar=
> </span>(30),<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>last_name</span></span><span
style=3D'ms=
> o-tab-count:
> 1'> </span><span
class=3DSpellE>varchar=
> </span>(30)
> not null,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>bats</span><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span>char(1)
> check (bats in ('L','R','S')),<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>throws</span><span
style=3D'mso-tab-count:2'> &nbs=
> p; </span>char(1)
> check (throws in ('L','R')),<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>dob</span></span><span
style=3D'mso-tab-=
> count:
>
2'> =
>
</span>date,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>primary</span> key(id)<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>);<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><o:p> </o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><b><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0=
> pt;
>
font-family:System;mso-bidi-font-family:System;font-weight:bold'>create</sp=
> an></font></b></span><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'> table
statistics<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>(<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>id</span><span
style=3D'mso-tab-count:3'> &n=
>
bsp;  =
>
; &n=
> bsp; </span>serial,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>year</span><span
style=3D'mso-tab-count:3'> =
>
&nb=
>
sp; =
> </span>integer
> not null,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>g</span><span
style=3D'mso-tab-count:3'> &nb=
>
sp; =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>player_id</span></span><span
style=3D'ms=
> o-tab-count:
>
2'> =
> </span>integer
> not null,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>team_id</span></span><span
style=3D'mso-=
> tab-count:
>
3'> =
>
&nb=
> sp; </span>integer
> not null,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>foreign</span> key(<span class=3DSpellE>player_id</span>)
ref=
> erences
> players(id)<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DGramE>on</span> delete cascade,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>foreign</span> key(<span class=3DSpellE>team_id</span>)
refer=
> ences
> teams(id)<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DGramE>on</span> delete cascade,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>primary</span> key(id)<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>);<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><o:p> </o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><b><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0=
> pt;
>
font-family:System;mso-bidi-font-family:System;font-weight:bold'>create</sp=
> an></font></b></span><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'> table <span
class=3DSpellE>managing_stats</span><=
> o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>(<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>id</span><span
style=3D'mso-tab-count:3'> &n=
>
bsp;  =
>
; &n=
> bsp; </span>integer
> not null,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>w</span><span
style=3D'mso-tab-count:3'> &nb=
>
sp; =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>l</span><span
style=3D'mso-tab-count:3'> &nb=
>
sp; =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></font><=
> /b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>primary</span> key(id),<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>foreign</span> key(id) references
statistics(id)<o:p></o:p></=
> span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DGramE>on</span> delete cascade<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>);<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><o:p> </o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><b><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0=
> pt;
>
font-family:System;mso-bidi-font-family:System;font-weight:bold'>create</sp=
> an></font></b></span><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'> table <span
class=3DSpellE>fielding_stats</span><=
> o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>(<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>id</span><span
style=3D'mso-tab-count:3'> &n=
>
bsp;  =
>
; &n=
> bsp; </span>integer
> not null,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>pos</span><span
style=3D'mso-tab-count:3'> &=
>
nbsp; &nbs=
>
p; &=
> nbsp; </span>char(5),<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>po</span></span><span
style=3D'mso-tab-c=
>
ount:3'> &=
>
nbsp; &nbs=
> p;
</span>integer,<o:p></o:p></sp=
> an></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>a</span><span
style=3D'mso-tab-count:3'> &nb=
>
sp; =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>e</span><span
style=3D'mso-tab-count:3'> &nb=
>
sp; =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>dp</span></span><span
style=3D'mso-tab-c=
>
ount:3'> &=
>
nbsp; &nbs=
> p;
</span>integer,<o:p></o:p></sp=
> an></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>primary</span> key(id),<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>foreign</span> key(id) references
statistics(id)<o:p></o:p></=
> span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DGramE>on</span> delete cascade<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>);<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><o:p> </o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><b><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0=
> pt;
>
font-family:System;mso-bidi-font-family:System;font-weight:bold'>create</sp=
> an></font></b></span><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'> table <span
class=3DSpellE>batting_stats</span><o=
> :p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>(<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>id</span><span
style=3D'mso-tab-count:3'> &n=
>
bsp;  =
>
; &n=
> bsp; </span>integer
> not null,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>ab</span></span><span
style=3D'mso-tab-c=
>
ount:3'> &=
>
nbsp; &nbs=
> p;
</span>integer,<o:p></o:p></sp=
> an></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>r</span><span
style=3D'mso-tab-count:3'> &nb=
>
sp; =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></font><=
> /b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>h</span><span
style=3D'mso-tab-count:3'> &nb=
>
sp; =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>doubles</span><span
style=3D'mso-tab-count:3'> &nb=
>
sp; =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></=
> font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>triples</span><span
style=3D'mso-tab-count:3'> &nb=
>
sp; =
>
</span>integer=
> ,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>hr</span><span
style=3D'mso-tab-count:3'> &n=
>
bsp;  =
>
; &n=
> bsp; </span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>rbi</span></span><span
style=3D'mso-tab-=
> count:
>
3'> =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></=
> font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>sb</span></span><span
style=3D'mso-tab-c=
>
ount:3'> &=
>
nbsp; &nbs=
> p;
</span>integer,<o:p></o:p></sp=
> an></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>cs</span></span><span
style=3D'mso-tab-c=
>
ount:3'> &=
>
nbsp; &nbs=
> p;
</span>integer,<o:p></o:p></sp=
> an></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>bb</span><span
style=3D'mso-tab-count:3'> &n=
>
bsp;  =
>
; &n=
> bsp; </span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>so</span><span
style=3D'mso-tab-count:3'> &n=
>
bsp;  =
>
; &n=
> bsp; </span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>sh</span></span><span
style=3D'mso-tab-c=
>
ount:3'> &=
>
nbsp; &nbs=
> p;
</span>integer,<o:p></o:p></sp=
> an></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>sf</span></span><span
style=3D'mso-tab-c=
>
ount:3'> &=
>
nbsp; &nbs=
> p;
</span>integer,<o:p></o:=
> p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>ibb</span></span><span
style=3D'mso-tab-=
> count:
>
3'> =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></font><=
> /b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>hbp</span></span><span
style=3D'mso-tab-=
> count:
>
3'> =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>primary</span> key(id),<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>foreign</span> key(id) references
statistics(id)<o:p></o:p></=
> span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DGramE>on</span> delete cascade<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>);<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><o:p> </o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><span
> class=3DGramE><b><font size=3D2 face=3DSystem><span
style=3D'font-size:10.0=
> pt;
>
font-family:System;mso-bidi-font-family:System;font-weight:bold'>create</sp=
> an></font></b></span><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'> table <span
class=3DSpellE>pitching_stats</span><=
> o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>(<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>id</span><span
style=3D'mso-tab-count:3'> &n=
>
bsp;  =
>
; &n=
> bsp; </span>integer
> not null,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>w</span><span
style=3D'mso-tab-count:3'> &nb=
>
sp; =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>l</span><span
style=3D'mso-tab-count:3'> &nb=
>
sp; =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></font><=
> /b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>gs</span></span><span
style=3D'mso-tab-c=
>
ount:3'> &=
>
nbsp; &nbs=
> p;
</span>integer,<o:p></o:p></sp=
> an></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>cg</span><span
style=3D'mso-tab-count:3'> &n=
>
bsp;  =
>
; &n=
> bsp; </span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>sh</span></span><span
style=3D'mso-tab-c=
> ount:1'> </span><span
>
style=3D'mso-tab-count:2'> &=
>
nbsp; &nbs=
> p; </span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>sv</span></span><span
style=3D'mso-tab-c=
>
ount:3'> &=
>
nbsp; &nbs=
> p;
</span>integer,<o:p></o:p></sp=
> an></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>ip</span></span><span
style=3D'mso-tab-c=
>
ount:3'> &=
>
nbsp; &nbs=
> p;
</span>numeric(5,1),<o:p=
> ></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>h</span><span
style=3D'mso-tab-count:3'> &nb=
>
sp; =
>
&nb=
> sp;
</span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DSpellE><span class=3DGramE>er</span></span><span
style=3D'mso-tab-c=
>
ount:3'> &=
>
nbsp; &nbs=
> p;
</span>integer,<o:p></o:=
> p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>hr</span><span
style=3D'mso-tab-count:3'> &n=
>
bsp;  =
>
; &n=
> bsp; </span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>bb</span><span
style=3D'mso-tab-count:3'> &n=
>
bsp;  =
>
; &n=
> bsp; </span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>so</span><span
style=3D'mso-tab-count:3'> &n=
>
bsp;  =
>
; &n=
> bsp; </span>integer,<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>primary</span> key(id),<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:1'> =
> </span><span
> class=3DGramE>foreign</span> key(id) references
statistics(id)<o:p></o:p></=
> span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><span
style=3D'mso-tab-count:2'> =
>
&nb=
> sp; </span><span
> class=3DGramE>on</span> delete cascade<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'>);<o:p></o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><o:p> </o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><o:p> </o:p></span></font></b></p>
>
> <p class=3DMsoNormal
style=3D'mso-layout-grid-align:none;text-autospace:non=
> e'><b><font
> size=3D2 face=3DSystem><span
style=3D'font-size:10.0pt;font-family:System;m=
> so-bidi-font-family:
> System;font-weight:bold'><o:p> </o:p></span></font></b></p>
>
> <p class=3DMsoNormal><font size=3D2 face=3DArial><span
style=3D'font-size:1=
> 0.0pt;
> font-family:Arial'><o:p> </o:p></span></font></p>
>
> </div>
>
> </body>
>
> </html>
>
> ------=_NextPart_000_0034_01C1686D.B8B2E3E0--
>