On 28 Jan 2017, at 7:27pm, David Niklas <[email protected]> wrote: > # ALTER TABLE processors ADD CONSTRAINT bit NOT NULL > Error: near "CONSTRAINT": syntax error > > # ALTER TABLE processors DROP bit; > Error: near "DROP": syntax error > > I expected that both of the above would add the constraint.
Neither adding nor deleting a constraint are supported by ALTER in SQLite. If you didn’t create the constraint when you originally made the table you can’t do it. Generally, to get this effect in SQLite, rename the original table, create a new table with the constraint, and copy the data across using something like INSERT INTO processors (SELECT * FROM processors_old) > # SELECT boards.*,processors.*,storage.emmc FROM processors INNER >> JOIN storage ON processors.board = storage.board; > Error: no such table: boards > > # .schema > CREATE TABLE boards( > board varchar(30) PRIMARY KEY NOT NULL, > price SMALLINT NOT NULL, > vendor varchar(27) NOT NULL, > oses varchar(32)); > ... > > I expected that the table boards would exist. You didn’t mention the table 'boards' in the list of tables in the JOIN. It’s neither the main column of the SELECT (processors) nor the table you’ve joined to it (storage). > I also can't figure out how to join 3 tables, each on the board column. My initial thought is that you would have JOIN clauses in the same SELECT. > # SELECT processors.*,storage.* FROM processors INNER JOIN storage ON >> processors.board = storage.board WHERE processors.board LIKE "%Rose%"; > Roseapple Pi Actions S500 4x A9 @ 1.6GHz PowerVR SGX544 256MB0 > Roseapple Pi 4GB eMMC 0 0 0 0 > > I wanted the board section of both tables to be joined and the one of > them displayed (they have to be identical to join right?), not to > be repeated, one after the other. Not sure i’ve grasped what you want here, but you might want to JOIN with the UNION of two tables. Or for your SELECT to to a UNION of two tables with JOINs. Simon. _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

