Charlotte Collis wrote:
> I am new to Mysql. I am creating a new databae and
> have created a table with varioius columns and
> have specified the data type for each column. The
> table was created successfuly. I now want to
> insert some data into the table. Using the insert
> into syntax I want to insert the data "f00105"
> into the column name "familyId" the table is
> called "familyContactInfo" the column "familyId"
> is set to varchar(7) and is the primary key
>
> I created the following query:
>
> insert into familyContactInfo, (familyId) values ("F00105")
>
> however it returns an error message saying the syntax is wrong. What am I doing wrong? Any help
> would be appreciated!
The error msg will have told you where the error occurs. If you can't work it out, it would of course help to paste the error on the forum too ;-)
But I think I can work it out anyway, you need to ditch the comma after familyContactinfo.
On a sidenote, a VARCHAR(7) is not a good candidate for a primary key. It can lead to some inefficiencies. Generally, a primary key should be a type of integer, preferably auto-increment.
Regards, Arjen.
--
Arjen Lentz, Exec.Director @ Open Query (http://openquery.com)
Remote expertise & maintenance for MySQL/MariaDB server environments.
Follow us at
http://openquery.com/blog/ &
http://twitter.com/openquery