tags:

views:

32

answers:

2
INSERT INTO sitelist(id,rank,websiteaddress,tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10)
VALUES 
 ('','','','search','searchengine','discover','find','tag5','tag6','tag7','tag8','tag9','tag10') WHERE `id`=1

The thing is that the first row is like this

1 1 google.com nothing nothing etc

I want to insert search searchengine discover find tag5 tag6 etc instead of nothing.

A: 

you need an UPDATE query, instead of insert. And the case of Update, it's easier to just write the update, than some automation, if there are not so many fields.

If you want default values to be inserted instead of nulls, simply assign default values to those fields, and next time you insert, if you don't specify a value, it will be the default. The changes will "come into effect" on the next time you insert a row with null values.

Alexander
I replaced the tags with example strings. I want to insert tags like "search","search engine" etc
Karthik Kottapalli
+2  A: 

Perform an UPDATE query instead.

Ignacio Vazquez-Abrams
Is not possible to insert values into a specific column if it is empty?
Karthik Kottapalli
You do not insert new values into columns, you insert new rows into a table. Just as such, you update an existing row with new values.
Ignacio Vazquez-Abrams