[Cialug] SQL Question: Advanced INSERT INTO
tdwalton at gmail.com
Fri Sep 3 16:50:48 CDT 2010
On Fri, Sep 3, 2010 at 4:40 PM, Todd Walton <tdwalton at gmail.com> wrote:
> On Fri, Sep 3, 2010 at 2:41 PM, Josh More
> <MoreJ at alliancetechnologies.net> wrote:
>> Most databases will have the primary key set to a SERIAL type or the like, so it should auto increment. Just leave that field blank and do a test INSERT. See if it autofills.
> Ah. I knew there must be some way of handling this. It seems too
> integral to the task to not have some way of handling it.
> But I checked, it's an int.
I was being silly: I *can* use an INSERT INTO ... SELECT. I had a
mental block thinking I had to use a VALUES because I had literal
values that I was not grabbing from somewhere else. But you can make
select statements with literal values:
...and so on.
More information about the Cialug