REMINDER
How to use Foreign Key concept ?
-
Hi team,
I want to use a foreign key in reference with a primary key of another table.
For one of my local projects, i'm using a sql server user table where all the unique ids are stored(primary key). And in another table, im using foreign key to reference that unique ids to ensure only registered users are allowed.
I tried with Linked field (by reference) datatype. But still, i can able to insert records which are not part of primary key.
Please guide me to achieve that scenario.
-
Hey Vinoth,
Our DB UI don't have an option to enfore foreign key,
but it's something you can do with our query executor (New Query) since we are 100% compatible with MySQL and it's a standard feature of MySQL.Example to add a foreign key:
ALTER TABLE Orders ADD FOREIGN KEY (PersonID) REFERENCES Persons(PersonID);
More details here:
https://www.w3schools.com/sql/sql_foreignkey.asp -
Thanks. Will give a try.