phpMyAdmin -- import one table into existing database - import

I have a new table I want to add to an existing db, the structure of which I exported to a file table.sql.
table.sql has 75 columns, so naturally I would rather find a way to copy/import the structure into the existing db than creating a new table and manually defining each of the 75 fields.
Is there a way to import this table structure into my database mydb (which is populated with data)? There has to be -- this is computing. I am staring at phpmyadmin and can't figure out how to do this.
Any suggestions would be welcome.
Thanks in advance.

okay, figured out how to do it. I just opened the exported .sql file, and copied/pasted the "CREATE TABLE..." statement into the DB's SQL window in phpMyAdmin and it worked -- I now have that new 75-column table.
But I'm still a bit mystified over why phpmyadmin gave a success message when I tried to import the .sql file but did not display the allegedly imported table.

There is an Import tab in phpMyAdmin.
Open the database you would like to import into, then click on the "Import" tab and upload your file.
You can learn more here: http://www.techrepublic.com/blog/smb-technologist/import-and-export-databases-using-phpmyadmin/
An alternate way would be to copy the mySQL statement(s) in your table.sql file, open the "SQL" tab, paste it in the box, and then the run the query.
I hope this helps!

It's easy. You should choose your database then in the Import tab, select choose file. Select your file then press Go. It worked for me. You can find the new table in your database.

Related

Postgres/PGAdmin exporting empty CSV

I've generated a large table (1.1 million rows) in Postgres/PGAdmin that I'd like to export to CSV. When I click the "Save results to file (F8)" button, I get the "Downloading Results..." spinning wheel, and then the window letting me name the CSV and save it where I want on my computer. But once that CSV is on my computer it's empty. I've tried restarting PGAdmin and my computer but it's still happening.
Does anyone know why this is happening / how to fix? I would just copy/paste the table into a text file, but I think it's too large.
I couldn't find any prior questions about this.
Thanks.
I ran into the same problem. My solution was to create a table using your intended select statement.
Example:
CREATE TABLE query_results AS (
Select * from XXXX
)
Then, export the table to CSV.

Exporting Sqlite Tables to a File and Reimporting It in Flutter

Is there a way to one click export and import Sqlite tables? I don't really have any code to show, since it's a simple Sqlite table with rows and columns. Is there a one click (onTap) solution in Flutter to export and import the whole table?
There is no magic that you can use it with a single line of code, but you can use a package, something like this:
https://github.com/tekartik/sqflite_more/tree/master/sqflite_porter
https://github.com/tekartik/sqflite_more

PowerDesigner : Import table structure with columns and types with Excel

I'm trying to find a way for import my structures in Powerdesigner with Excel.
There is an option for importing Excel file so it possible but noway...
I don't know how must be the Excel file, can I find a template somewhere ?
Have you ever success to import this kind of files or are we forced to write manually each columns from each tables ?
Thanks for your help
I have never used it, so I am not sure that my way is the right way...
Via Model>Extensions>Attach An extension, attach the Excel Import to your model.
You can now find Excel Import File in the contextual menu of your model in the Browser.
Here is my sample Excel file:
<Sheet1>
Name,Code
A,AA
B,BB
<Sheet2>
Name,Code,Table
C,CC,A
D,DD,B
E,EE,F
I launch Excel Import File, select my Excel file.
I import the table Sheet1 as Table, and use the default mapping Name to Name, and Code to Code...
I import the table Sheet2 as Table.Column, and use the default mappings Name to Name, Code to Code, Table to "Parent"
And I get these tables (I have also selected the Create Symbols in Active Diagram option).
Open the Model menu, go to (for instance) Tables, then you will see an Excel icon on the overview. Click that and it will allow you to export the list to Excel. The Excel export has the exact same format as your input needs to be in order to automatically map to the correct columns.

How do you change a table's schema?

We have a MySQL Workbench project with two tabs (two schemas/two databases).
If we create a table in the first tab, it's attached to the schema
magikweb_dev_igcweb.
If we create a table in the second tab, it's attached to the schema
magikweb_dev_igcweb_archive.
If we copy-paste/duplicate a table from the first tab to the second tab, the resulting table remains in the first schema. How can you change a table's schema?
Each schema is linked with a specific database, so when we use the "Synchronize Model..." feature, it links all the tables properly.
Use the model tab. You can cut out a table from one schema tab and insert it into another.
The cut-and-paste method described in another answer works well for tables with no foreign keys, and for a reasonable number of tables.
An alternative that preserves foreign keys is to export the model as a SQL script, edit it, and then import the new script into a new model.
Using MySQL Workbench v6.3:
File -> Export -> Forward Engineer SQL Script
Carefully edit SQL script. Replace references to one schema with the other, for the tables you want to move. Do this both for CREATE TABLE commands and foreign key references.
File -> New Model
File -> Import -> Reverse Engineer SQL Script
Unfortunately you will then need to recreate any diagrams. But that can be straightforward if you have the original diagram as reference (take a screenshot or export it to PNG or PDF.)
Follow this simple steps (never miss step 4 and 5) :
Open Model Tab
Choose source schema. In my case, I want to copy table users from schema abc_develop_v1 to schema abc_develop_v2 then paste to diagram . So I choose schema abc_develop_v1, right-click table users then Copy 'users'
Go to the targeted schema. In my case is schema abc_develop_v2, right-click then Paste 'users'
Next, copy table users from schema abc_develop_v2. Right-click table users then Copy 'users'
Go to your diagram and Paste 'users'.
That's all. Your table is ready in your diagram with the right schema :-)
Notes: You can double check by double-click on the table in your diagram, and look at the right corner. It will show the Schema name.
I found a less painful way to do this.
Save and backup your diagram and your schema.
Display schema's name before table's names in diagram. This will make the next step easier.
Right-click on the tables which are on the wrong schema, and select "Copy SQL to clipboard". Paste the script in a new SQL window. Repeat for each table you want to migrate.
Edit the script to change the schema name. Watch for any miss in entries, the wrong schema might be a reference at any line. Mine was mydb, which I don't remember creating. Execute the script. Now you have the tables on the right schema.
Synchronize your model. Be sure to check "Update the model" for each missing table, otherwise, the tables will be deleted from the schema :)
Drag'n'drop the newly created tables into the diagram. Then remove the ones which are using the wrong schema. Tip: tables that are not in diagram won't display a dot next to their name.
Optionally, you can delete the faulty schema from the model so this never happens again. Be sure to know what you're doing first!

SQLite Manager - Copy table to another .sqlite database

Working on my first iOS App with SQLite database. In Project I have 2 Database, in which First Database is having only one table and the another one is working as a main database. I want to merge those databases into one (the Second one), by copy the table from first database to second database. The First database Table contains more than 32K records. So, I want to copy the entire table with Data.
I want to achieve this using SQLManager AddOn of firefox.
Any Idea?
Instead of SQLManager, You can simply do this with one command line:
$ echo '.dump tablename' | sqlite3 sourcedb | sqlite3 destdb
Export the required table contents in to an excel sheet in sqlite manager and then import the excel file in the target database.
you can see the controls for import and export in sqlite manager itself.
I hope this may help u, since I used it.