Skip to content

Tag: postgresql

PostgreSQL: FOREIGN KEY/ON DELETE CASCADE

I have two tables like here: So the logic is simple, after user removes all book under category x, x gets removed from cats, i tried method above but doesn’t work, after i clean table book, table category still populated, what’s wrong? Answer A foreign key with a cascade delete means that if a rec…

Query using ILIKE with IN

Is it possible to run a query using ILIKE with the IN function? For example: I want to run the results returned from the nested query through the ILIKE function. Is there a way to do this? Answer Can be simpler: You can check the resulting query plan with EXPLAIN ANALYZE. You may need to add leading and trail…