I have a sqlite database and I'm populating sample data into my tables. The sample data needs a little messaging if the related data is going work properly, i.e. I need to start putting in primary and foreign keys in my tables.
First question is, how do I update the projectID column in my Project table for all the rows so that each row number is the value stored in the projectID field. I want this to be sequential and update the index.
update "project" set "projectID"= Count(*)
Second question is, I have to also update the customerID foreign key field in the project table. The only problem with this is, I want it to update between values 1 through to 50 and I want the rows to be updated randomly. Is this possible with sql, or am I going to have to export the data out of sqlite and process in a third party application and reimport.
Many thanks
Aucun commentaire:
Enregistrer un commentaire