>create table cities
>(
>id integer primary key not null,
>name text not null
>);
>
>create table people
>(
>id integer primary key not null,
>name text not null,
>cities_id integer not null,
>foreign key(cities_id) references cities(id)
>);
>
>insert into cities(name) values('Campos');
>insert into cities(name) values('Araraquara');
>insert into cities(name) values('Porto');
>insert into cities(name) values('Curitiba');
>insert into people(name, cities_id) values('John', 3);
>insert into people(name, cities_id) values('Mary', 2);
>
>Regarding cities don't have the Id = 8, this statement should fail:
>insert into people(name, cities_id) values('Pedro', 8);

This last insert fails here (3.6.21) with constraint violation.

Can you check which version you're actually running:

select sqlite_version();
3.6.21


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to