Adding auto_increment after table creation
Say the table is created like this,
mysql> CREATE TABLE customer (id int, fname varchar(20));
The above table would be created without having an index. If there is a need to make id primary key, then
mysql> ALTER TABLE customer ADD PRIMARY KEY (id);
Then adding auto_increment would be as:
mysql> ALTER TABLE customer CHANGE id id int NOT NULL AUTO_INCREMENT;
Trying to assign auto_increment before making it a primary key – if it is not already done during creation, might produce an error. Actually trying to drop the primary key before neutralizing the auto_increment would also might create an error.
The following query would take out the auto_increment part from the table
ALTER TABLE customer CHANGE id id int not null;
And, of course, after this it is possible to drop primary key.
See how you would solve these known algorithm problems
Kadane’s algorithm in C – Dynamic ProgrammingFind the first occurence of number in the sorted array
Java solution for checking anagram strings – tell if phrases are anagrams
Get maximum occurring character
Changing decimal number to its binary equivalent
find longest word in the sentence
Check if two strings are anagrams or not
Finding missing numbers from billion sequential number list file
Find longest palindrom from sequence of characters
Flatten nested javascript array