# [Edu-sig] Repositioning SQL within K-16

kirby urner kirby.urner at gmail.com
Fri Sep 12 05:49:04 CEST 2008

```On Sun, Aug 17, 2008 at 9:10 AM, kirby urner <kirby.urner at gmail.com> wrote:

<< SNIP >>

> So in math class we're maybe more interested in the duals table
> (relates each poly to its unique dual) and the XYZ coordinates, if
> that's how they're stored...
>

K-16 features many gentle on-ramps, which individual students will
sample, staying on some, getting off others.

SQL starts out with simple SELECTs against pre-existing tables.

In our 10th grade geometry class, we learn the "dual" of a polyhedra
is obtained by turning faces into corners (vertices), vertices into
faces, leaving the number of edges alone (V + F = E + 2).

So if we wanted to list duals in our Polyhedra table as a saved view,
we could do something like:

#===

from pysqlite2 import dbapi2 as sqlite

conn = sqlite.connect("newgeom")
curr = conn.cursor()

curr.execute("DROP VIEW duals;")

VIEW = """create view duals as
select a.shortname, b.shortname
from polyhedra a, polyhedra b
where a.faces = b.vertices
and a.vertices = b.faces
and a.edges = b.edges;
"""

curr.execute(VIEW)
conn.commit()

for row in curr.execute("select * from duals").fetchall():
print row[0], "is the dual of", row[1]

#===

To get:

>>>
tetra is the dual of tetra
cube is the dual of octa
octa is the dual of cube
cell is the dual of cubocta
cubocta is the dual of cell

Note that "cell" is my short name for the rhombic dodecahedron, a
space-filling shape fascinating to Kepler.

Note also that sqlite3 has native html tabular output, something to
play with (cut and paste while projecting, view in browser
perhaps?)...

Of course there's this prejudice that XML is not a math topic, but
butter numeracy and "pure math", want to show semi-structure data in
tree format.

Poet Gene Fowler, author of eWriter, always maintained that XHTML
should be studied under the heading of punctuation, i.e. while you're
learning about colons, commas and semi-colons, learn pointy bracket
markup as well.  As such, we might push HTML over to grammar teachers,
but then computer languages have grammar, so they might push right
back.

The bottom line is if teachers feel these are hot potato topics, then
they become no one's responsibility, whereas if they're seen as
excitingly relevant, as injecting new life into tired material, then
we're looking at a bonanza, with plenty to go around.

All we need is that army of curriculum writers ready to tackle the
content in an open source manner -- what I see happening on the Web,
slowly but surely, including on Youtube, fun:
sqlite> .schema polyhedra
CREATE TABLE Polyhedra (
greekname CHAR PRIMARY KEY,
shortname CHAR NOT NULL,
vertices NUMERIC NOT NULL,
edges NUMERIC NOT NULL,
faces NUMERIC NOT NULL,
volume NUMERIC NOT NULL);

sqlite> .mode html

sqlite> select * from polyhedra;
<TR><TD>Tetrahedron</TD>
<TD>tetra</TD>
<TD>4</TD>
<TD>6</TD>
<TD>4</TD>
<TD>1</TD>
</TR>
<TR><TD>Hexahedron</TD>
<TD>cube</TD>
<TD>8</TD>
<TD>12</TD>
<TD>6</TD>
<TD>3</TD>
</TR>
<TR><TD>Octahedron</TD>
<TD>octa</TD>
<TD>6</TD>
<TD>12</TD>
<TD>8</TD>
<TD>4</TD>
</TR>
<TR><TD>Rhombic Dodecahedron</TD>
<TD>cell</TD>
<TD>14</TD>
<TD>24</TD>
<TD>12</TD>
<TD>6</TD>
</TR>
<TR><TD>Cuboctahedron</TD>
<TD>cubocta</TD>
<TD>12</TD>
<TD>24</TD>
<TD>14</TD>
<TD>20</TD>
</TR>

Kirby
```