blob: ae8d13bdaed29bfadc9d4906c9d34f1ab3a7aa65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
--album
SELECT
al.id as "ID",
al.name as "Title",
ar.name as "Artist",
al.original_year as "Release Year",
SUM(s.time) as "Duration"
FROM album al
JOIN artist ar ON ar.id=al.album_artist
JOIN song s ON s.album=al.id
GROUP BY al.id
INTO OUTFILE '/var/lib/mysql-files/albums.csv'
FIELDS ENCLOSED BY '"'
TERMINATED BY ';'
ESCAPED BY '"'
LINES TERMINATED BY '\r\n';
--song
SELECT
s.id as "ID",
s.title as "Title",
ar.name as "Artist",
s.time as "Duration",
s.file as "Content"
FROM song s
JOIN artist ar ON ar.id=s.artist
INTO OUTFILE '/var/lib/mysql-files/songs.csv'
FIELDS ENCLOSED BY '"'
TERMINATED BY ';'
ESCAPED BY '"'
LINES TERMINATED BY '\r\n';
--playlist
SELECT
p.id as "ID",
p.name as "Name",
s.title as "Song"
FROM playlist_data pd
JOIN playlist p ON p.id=pd.playlist
JOIN song s ON s.id=pd.object_id
INTO OUTFILE '/var/lib/mysql-files/playlists.csv'
FIELDS ENCLOSED BY '"'
TERMINATED BY ';'
ESCAPED BY '"'
LINES TERMINATED BY '\r\n';
|