Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am trying to rename a column in a table in my DB. I already tried
ALTER TABLE TableName RENAME COLUMN OldColumnName TO NewColumnName
and i am getting an error reply saying - You have an error in your SQL syntax; Please whats the right syntax for this? Thanks.
Try using this syntax:
ALTER TABLE TableName CHANGE OldColumnName NewColumnName varchar(10) ;
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am trying to move a MYSQL database from one computer to another.
I did a dump file on the computer with the database, I created the database on the second
computer and duplicated the table definitions and checked it make sure they are the same many times. When I use Load data infile I get the duplicate'0' key primary error.
I am using Windows 10 pro MYSQL 5.7.9
This error might indicate that the table's PRIMARY KEY is not set to auto-increment.
Solution:
Check that there is a PRIMARY KEY set on your table, and that the PRIMARY KEY is set to AUTO-INCREMENT.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
with "drop table if exists student"
without "drop table if exists student"
So,I connected the database to amazon rds.
I want to find the way to avoid the error without using "drop and flush".
I've spent few days to find the solution, but i haven't found any.
Thanks for all your help!
I think what you are looking for is CREATE TABLE IF NOT EXISTS Student.
For the whole mysql create table Syntax look at the official documentation
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have a database called "members" and in that there's a table called "test". I'm trying to add a column to the table "test" but am getting the following error
MySQL Error 1064: You have an error in your SQL syntax.
My SQL code:
ALTER TABLE 'test'
ADD COLUMN 'Email' VARCHAR(25)
NULL AFTER 'LastName';
alter table classtest add column Email varchar(25);
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
In my database there are tables below:
temp;
2012;
2013;
2014;
2015;
I'd like to list the tables except temp
It should be something like
show tables from database like ...;
I also tried the operator NOT
But I failed. Can anyone help me for a correct SQL command?
select table_schema
from information_schema.tables
where table_schema <> 'temp'
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i have this in my script:
$db->q("INSERT INTO 'keys' (key,grupo,dias) VALUES ('$key','VIP',$love);");
which generates sql like this
INSERT INTO 'keys' ('key','grupo','dias') VALUES ('35F3','VIP',28)
but i get
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 ''keys' ('key','grupo','dias') VALUES ('35F3','VIP',28)' at line
1
I'm adding screenshot of my table's structure: http://i.stack.imgur.com/luKfm.png
Thanks for ur help!
Tables names are identfiers not string literals. So in the case that they are escape, you should use backticks,
INSERT INTO `keys` (`key`,`grupo`,`dias`) VALUES ('35F3','VIP',28)
MySQL - when to use single quotes, double quotes, and backticks?
MySQL Reserved Keywords List (where backticks are applicable)