Reputation: 157
I would like alter my table so that the table is sorted alphabetically as well as then reset my AUTO_INCREMENT Field (prof_id).
Attached is the database structure. The Foreign Key in 'my_contacts' is still NULL.
I have run an "ALTER TABLE profession ORDER BY profession"
Upvotes: 0
Views: 237
Reputation: 77866
I would like alter my table so that the table is sorted alphabetically
That's strange and doesn't happen that way. You should rather get the sorted/ordered data while doing a SELECT
statement using an ORDER BY
clause like below
select * from profession order by profession;
Again I would suggest, change you column name different than the table name. In your case, table name and column name both the profession
.
then reset my AUTO_INCREMENT Field (prof_id).
Not sure why you would want to reset the PK field; anyways you can do the same using an ALTER
statement like
ALTER TABLE profession AUTO_INCREMENT = 1;
Upvotes: 1