×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

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.
Report

Replies, comments and Discussions:

  • 工作学习 / 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;"