473,386 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to use SET to Update a Pre-exiting Table

Cleo Millet
I'm still fairly new to MySQL and I've been given a task by my lecturer that I just can't make work. She wants us to use SET to add a row to a table instead of the regular VALUE method. Here's my code and the error I received:

Expand|Select|Wrap|Line Numbers
  1. mysql> INSERT INTO Instructors
  2. -> SET FacId = 96
  3. -> SET FirstName = 'Chris'
  4. -> SET LastName = 'Explorer'
  5. -> SET HomePhone = '555-1492';
  6.  
  7. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET FirstName = 'Chris' SET LastName = 'Explorer' SET HomePhone = '555-1492'' at line 3
Oct 4 '11 #1
1 1805
johny10151981
1,059 1GB
Its fairly a wrong Insert statement,

if it is insert statement, then the simplest example is
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tablename(column1, column2,...,columnn) Values(value1,value2,...,valuen);
  2.  
If it is update statement the instruction should be
Expand|Select|Wrap|Line Numbers
  1. UPDATE tablename set Column1=value1,..., columnn=valuen [WHERE condition] [limit value_of_limit]
  2.  
please read the manual to understand instruction in a brief way
Oct 17 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

31
by: John Roth | last post by:
I'm adding a thread for comments on Gerrit Holl's pre-pep, which can be found here: http://tinyurl.com/2578q Frankly, I like the idea. It's about time that all of the file and directory stuff...
13
by: J.P | last post by:
Hi! Anyone knows if it's possible to do an update if, and only if my condition is TRUE. Example: In MYTABLE I have three columns, like this: ID(INT), PUBLISH(ENUM(Y,N)),...
1
by: toedipper | last post by:
Hello, PHP4 and MySql I have the code below, a mixture of handcoded and Dreamweaver genaratd php code. Basically it's an update record form - I load the values from a db and bind text boxes...
6
by: chrisg | last post by:
I have installed (what I thought was) DB2 7.2 FP5 (as my starting point, it was 7.2 with FP5 applied) on my AIX 4.3.3 boxes. This is what I get. # lslpp -L | grep db2 db2_07_01.cj ...
6
by: Sam-I-Am | last post by:
Hi There I have several websites that use shared assemblies in the GAC. When I try and update the GAC assemblies I get the following error: "The process cannot access the file because it is...
8
by: Andi Clemens | last post by:
Hi, I want to update our DNS servers periodically with some IP addresses. But I don't know how to do this. I searched the Internet quite a while but I haven't found a good example how to do...
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
4
by: dougans | last post by:
Hey there people, Need help on this one if you can spare me a second!!! No idea why, been trying for 2 hours to fix this now and I feel like a complete loser haha. Anyone have any idea why...
4
ddtpmyra
by: ddtpmyra | last post by:
Im having trouble on updating the file inside mysql database using the php. Should I use <form> or im wrong on how I called the variable from previous page? FORM 1 - that accepts the file pointer...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.