← Back to team overview

maria-discuss team mailing list archive

Re: Help explain what a SQL line was INTENDING to do?

 

You need ADD COLUMN clauses for those other two columns.  Perhaps this
ALTER TABLE statement was edited from a CREATE TABLE statement incorrectly?

On Apr 17, 2017 2:48 PM, "Justin Swanhart" <greenlion@xxxxxxxxx> wrote:

> I believe there is a missing right parenthesis after the 11.  has_children
> is a third Boolean column.
>
> On Apr 17, 2017 2:29 PM, "David Karr" <davidmichaelkarr@xxxxxxxxx> wrote:
>
>> I've used Mariadb for a couple of small projects.  I prefer to
>> automate as much of the initial creation and config as possible, using
>> SQL scripts executed from JDBC.  I can at least do this for the table
>> creation and population.
>>
>> I'm taking over an existing small project that is organized somewhat
>> funky. There are some scripts that are apparently intended to
>> initialize the database, but I'm seeing one line in one of those
>> scripts that I don't understand, and I don't think is valid.
>>
>> I would appreciate some help explaining what you think this line MIGHT
>> be intending to do:
>> -----------------
>> ALTER TABLE `project` add column (proj_typ_id TINYINT(2) NOT NULL
>> DEFAULT 1, parent_proj_id int(11, has_children BOOLEAN);
>> -----------------
>>
>> The first problem is that first paren. There's no matching right
>> paren, so I can't imagine this can succeed.
>>
>> Second, I don't understand much past that first comma.  Is this
>> intending to add TWO columns, the second being "parent_proj_id"?
>> Assuming that's the case, what exactly does "int(11, has_children
>> BOOLEAN)" mean?  I can see that it's declaring an 11-digit int, but I
>> don't understand the "has_children" part.
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~maria-discuss
>> Post to     : maria-discuss@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~maria-discuss
>> More help   : https://help.launchpad.net/ListHelp
>>
>

References