What is wrong with my MySQL syntax

where am I going wrong with the Syntax?
$sql = "INSERT INTO iowa (universityName) VALUES
('Des Moines College') BETWEEN universityName='Cornell College' AND universityName='Divine Word College'";

Open in new window


I know everything is spelled right, there must be a logic error
NewWebDesignerAsked:
Who is Participating?
 
NorieVBA ExpertCommented:
If you want to just insert Des Moines then lose the Between.

You can't specify that a particular record is inserted in a particular position in a table, and you shouldn't need to anyway.
0
 
brutaldevCommented:
That 'BETWEEN' syntax is incorrect. You should split it into three separate inserts or insert using a SELECT:
 
INSERT INTO iowa (universityName) VALUES ('Des Moines College');
INSERT INTO iowa (universityName) VALUES ('Cornell College');
INSERT INTO iowa (universityName) VALUES ('Divine Word College');

Open in new window

0
 
Jagadishwor DulalBraces MediaCommented:
INSERT INTO iowas (universityName) VALUES ('Cornell College'), ('Divine Word College');

Open in new window

0
 
Ray PaseurCommented:
Have you got any nearby community colleges that teach the basics of SQL?  If so, sign up right now.  If not, this book might help you get started.  It will not make you a pro, but it will get you some foundation and will help you get "from zero to sixty" in the query language.
http://www.sitepoint.com/books/phpmysql4/

HTH, ~Ray
0
 
Dave BaldwinFixer of ProblemsCommented:
None of the SQL databases preserve any particular order to the rows except that defined by an ORDER BY expression in a SELECT statement.  BETWEEN doesn't work in an INSERT statement.  It is only useful to tell whether something is in a range.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.