![]() ![]() We then list the ways we want to compare items. We specify gist as the index method, which tells PostgreSQL how to index and access the values to compare them. Afterwards, we add an exclusion constraint by using the EXCLUDE USING syntax. First, specify CREATE EXTENSION btree_gist to make sure the index method we'll be using is enabled in the database. Here, we have a create table statement for hotel bookings with a room number and a booking start and end date. So if we want to remove associated orders from our system when a customer is deleted, we could specify that like this: ![]() These actions can be specified when defining a foreign key constraint by adding ON DELETE followed by the action. So if the customer column in the orders table had a default value and we remove a customer from the customers table, the record in the orders value would be assigned the default value. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |