I need to import data from CSV file into MySql database using YII Framework,
CSV files contains datas which should to imported to two tables in Mysql DB, Please provide any information to proceed.
try this
Importing CSV file to mysql table using "LOAD DATA" command
You can take a look at this extension:
www.yiiframework.com/extension/importcsv/
Related
I have downloaded a CSV file and am trying to use it for a SQL project (I am using Jupyter notebooks). Do I even need the CSV file or is there a way to use it without downloading it? I'm very new to all of this!
This is the link to the data that I downloaded:
https://github.com/new-york-civil-liberties-union/NYPD-Misconduct-Complaint-Database
What's your goal? Are you trying to learn SQL, or do you just want to work with the data?
If all you want is to load that csv into a table in a SQLite database, it would be easiest to do using the sqlite command line shell.
I'm on Windows, so forgive me if you aren't...
Open the Command Prompt
Navigate to the folder in which you want the new sqlite db file (e.g. cd C:\Users\User\Data)
sqlite3 NewDBName.db (e.g. sqlite3 MyNewDb.db)
.mode csv
.import path/to/downloaded/csv.csv NewTableName (e.g. .import C:\Users\User\Downloads\CCRB_database_raw.csv CCRB
That should be it. You can check it worked by running .schema- you should see the structure of your new tables.
Now you can try out some sql statements:
SELECT * FROM CCRB LIMIT 10;
Here are some more detailed instructions.
I want to export data from my database to a csv file using IBEscript for a Firebird database. Everything works fine just the columns with blob data don't work. they just miss within the csv file.
When I run the same query in the IBexpert and export the data to csv I check the box "export text blob values" and the data is included. How can I use this option with the script as well?
I need the script since I want an automatic export using the task planer.
Thanks!!!
csv format with blobs makes no sense,since any delimiter (tab,semikolon, etc) can be part of the blob and will destroy your structure.
but automated import/export also with blobs is no real problem in scripts (ibeblock is not available in personal edition)
http://ibexpert.net/ibe/index.php?n=Doc.InsertingFileDataIntoADatabase
http://ibexpert.net/ibe/index.php?n=Doc.IbecLoadFromFile
http://ibexpert.net/ibe/index.php?n=Doc.IbecSaveToFile
Holger
www.ibexpert.com
Any ideas how I can extract data from a SQL database, put it into a CSV file in a specific format and push it to an external url?
Most SQL databases have some sort of Export utility that can produce a CSV file. Google "Export " and you should find it. It is not a part of SQL standard, so every product does it differently.
I need to import few columns from csv file into firebird temp table
but not using any tool only from sql editor aka openrowset in SQL server.
is it supported?
thanks
firebird doesn't have a load statement, but several tools have an import module. Easest is to edit the file into a set of insert statements
You can have look at Data Transformer (disclaimer - I'm its developer). It can convert between CSV (an other formats) to SQL. The generated SQL contains "insert" statements for each line and a "create table" statement.
It works offline - the data never leaves your computer.
You can get it from the Mac App Store or the Microsoft Store.
I have to import an csv file to SQL database table which already created (empty and has the same number of named columns). It would be great if you could suggest any tutorials or give some tips.
I assume you are using Microsoft SQL Server. Do you need to do this in a program or manually? There is a tutorial on using the bcp command for that, or alternatively a SQL command. If you need to parse the CSV file for your own code, see this previous SO question.