Navigation

    APPDRAG Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular

    REMINDER

    Please be respectful of all AppDragers! Keep it really civil so that we can make the AppDrag community of builders as embracing, positive and inspiring as possible.

    How to use Foreign Key concept ?

    Cloud Backend (Cloud DB, API Builder)
    2
    3
    284
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • vinoth kumar
      vinoth kumar last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • Joseph Benguira
        Joseph Benguira last edited by

        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

        vinoth kumar 1 Reply Last reply Reply Quote 0
        • vinoth kumar
          vinoth kumar @Joseph Benguira last edited by

          @Joseph-Benguira,

          Thanks. Will give a try.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post