tags:

views:

39

answers:

2

Can someone please show me how to pouplate the following table with my own tags, ids and count numbers using the phpMyAdmin or a MySQL command prompt?

CREATE TABLE tags (
id int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
tag varchar(100) NOT NULL,
count int(11) NOT NULL DEFAULT '0'
);
A: 

Something like this?

INSERT INTO tags (id, tag, `count`) VALUES (1, 'foo', 1), (2, 'bar', 1);
danb
+1  A: 

Since you are using a SQL reserved word for a column name (unadvisable), you'll need to surround that column name with backticks in your SQL statement. Try this:

insert into tags (tag, `count`) values
('java', 14),
('mysql', 3),
('php, 7);

the id column will be auto-populated by auto_increment.

Asaph