当前位置: 动力学知识库 > 问答 > 编程问答 >

sql - How to insert a new row into a table related to a row in another table

问题描述:

I am trying to insert a row into a table while having the FK field reference the PK field in the related table, but it does not compile. this is what i have so far.

Insert into Location(LocNo, FacNo, LocName)

values('L120', 'F111','Door');

The FacNo needs to relate to the PK facNo in the Facility table, so i have made the FacNo here the same, but when i try and run this it does not compile. What am i doing wrong?

  1. Insert a new row into the Facility table with facility name Swimming Pool.
  2. Insert a new row in the Location table related to the Facility row in modification problem 1. The new row should have Door for the

    location name.

I have already done question one, but i am having trouble with the second question.

分享给朋友:
您可能感兴趣的文章:
随机阅读: