×

Loading...

Topic

This topic has been archived. It cannot be replied.
  • 工作学习 / IT技术讨论 / questions about java and database design.
    请高手回答:

    1) I build a table on my database, the table's structure is people(int ID, string Name, string Address), Now I want to give ID a default value, the value is (表中最后一条记录的ID+1), my purpose is that everytime I insert a new record to the people table, I don't need to specify ID's value, the database system can automatically give me a unique value for ID.

    2) If I just want to get the last record in a table(only one record), how to implement this with java.

    For the first question, I think it's very easy for a database expert. The second question is not difficult too. But I just don't know, please help.
    • 不须高手回答,你还是老实做你的HOME WORK.
    • forget one thing.
      I use MS SQL2000.
    • 1. use IDENTITY such as people(ID int IDENTITY(1,1) ,...) 2. maybe" select top 1 ID ,... order by ID;"