Avatar of Kathryn Johnson
Kathryn Johnson

asked on 

Help with MySQL Workbench Tables/Data Types Using Mac OS

Hi! I'm completely new to SQL and having some trouble.

I have tried altering data types in a table in MySQL after importing a csv file into MySQL on my Mac and I end up with 2 scenarios where I either lose my data or keep my data from the imported file, but I cannot change the data types. I have tried 2 different methods below.

Method #1: After creating a database in MySQL, I use the the "Table Data Import Wizard" option to import my excel csv file into the table.

By default, the data types are automatically inputted as "text" but some columns are meant to be integers (e.g.: sales numbers or percentages).
Before completing the import process using the wizard table tool, I have tried to use the dropdown icon to alter the data types into "int".

When I execute this, the data import fails, but the table updates with the correct column names, but there is no data.

Method #2: After creating a database in MySQL, I use the the "Table Data Import Wizard" option to import my excel csv file into the table.

I use all default settings using the wizard tool and my data uploads successfully into my chosen database table.

I try to then alter my table by clicking the wrench icon that appears on the left side panel when hovering over the table name.

Then, I attempt to change the first column by checking the "primary key" box and "NN". I alter the rest of my column's data types accordingly.

When I apply this, it always returns an error message.

Thanks!

User generated imageUser generated imageUser generated image
Operating SystemsDatabasesSalesRESTSQL

Avatar of undefined
Last Comment
Kathryn Johnson
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

do you have and do you need the column "unknown" in your table?

you can do it step by step, first to remove this "unknown" column if it's not needed. After that, simply continue by changing other column's data types
Avatar of Kathryn Johnson
Kathryn Johnson

ASKER

Hello,

Thank you for answering!

Yes, I need the "unknown" column in my table. I've just dropped the table and tried to recreate it again using the import table wizard tool.

I first renamed the "unknown" table as "sales" before importing the new csv file.

After I tried to importe the file, I received a message saying that it failed to execute. I will attach some pictures now.


User generated imageUser generated imageUser generated image
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Kathryn Johnson

ASKER

Thank you! I got rid of the commas and dollar signs in my file and then converted to a new csv, then imported the data using the wizard tool.
It executed successfully.
Thanks!!!!
Databases
Databases

Databases are organized collections of data, most commonly accessed through management systems including schemas, tables, queries and processes that allow users to enter and manipulate the information or utilize it in other fashions, such as with web applications or for reporting purposes.

62K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo