MySQL workbench, Can't create table error#1050 [closed] - mysql

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

Related

table i created is not showing in SSMS even after refreshing [closed]

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 10 days ago.
Improve this question
i saved a table in my SSMS database but its not showing even after i refresh it. any idea what should be done??
Try reconnect and asure yourself that you are creating table rather than temporary table which disapear after closing or interupting session.
When reconnect will help. It means that table was created but only view of it wasn't available yet.
Data from temporary table begin name with # sign. To check if you using temporary table you can perform code shown below:
if object_id('tempdb..#yourtablename') is null
PRINT N'Temporary table is not created';
if object_id('tempdb..#yourtablename') is not null
PRINT N'Temporary table is created';
if object_id('dbo.yourtablename') is null
PRINT N'Normal table is not created';
if object_id('dbo.yourtablename') is not null
PRINT N'Normal table is created';
Make sure that you are in the database where you previously created the table
A couple of basics you can try for this:
Try running:
SELECT * FROM [<YOUR_DATABASE>..<YOUR_TABLE>];
If an exception is returned, the table did not create.
In the left sidebar, expand:
Databases > your db > Tables
Right-click tables and press 'refresh'. See if it appears in the list.
If not, the table did not create.

MYSQL Duplicate entry '0' for key Primary' [closed]

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.

How to rename a column in MySQL [closed]

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) ;

Can a stored procedure call truncate veiw table and enter data to the view table in MySql [closed]

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
How to truncate a view table from a stored procedure in MySql.First tried executing the following query which failed what can be the error "TRUNCATE TABLE tester ". Tester is a view table which I created from create view in mysql. I want to truncate the view table and enter new rows via a stored procedure.
TRUNCATE TABLE does not work for views.
You can DELETE FROM tester and if the view is an updatable view it will apply the DELETE to the underlying table. But DELETE is slower than TRUNCATE, because DELETE has to do some bookkeeping to make sure it can be rolled back, whereas TRUNCATE cannot be rolled back.
You can instead do TRUNCATE TABLE table_tester_is_based_on, but as #fancyPants mentions, be sure this is what you want to do, because it will dispose of all the data in the base table. MySQL views don't store a copy of the base table, they are more like an alias for a query against the base table.

MYSQL "SHOW TABLES FROM" [closed]

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'