MySQL export command -
I have a MySQL DB, which should be exported in the CSV file. Google told me about so many examples to do this, but all the examples are for exporting only one table.
Can someone help export some data (given below) in a particular way?
The album
the artist
Title
- ID
- artist_id
- Name < / Li>
There are FK fields in the title, which point to artist name and album name. P>
Export How can so that the output CSV file looks like this:
Column 1 (artist), column 2 (album), column 3 (title)
John newest first song
John, progress, best song
John, California, oh SF - Luke, my Music, a song
Luke, my songs, two Songs
Luke, Archived Tom, My Works, Second Song - Tom, My Works, III Songs
TIA
You can create a view and export from there.
Extending query Mahesh:
View See as select name as visual editor artist_name, album.name as album_name, title.name AS title , Titled Artist, Album, Title WHERE artist.id = title.artist_id and album.id = title.album_id; SELECT * FROM 'OUTFILE' example_output.csv 'FIELDS defined by FIELDS' in 'view_example', ';
I tested it and it works.
Comments
Post a Comment