Very simple.
Always check here:
mysql -u root -p -e "SELECT * FROM employees" my_database > employees.csv
mysql -u posao_statistike -p -e "SELECT d.*, s.grad FROM daljincinecitani d LEFT JOIN sap_maticna_nis_copy_nova_copy s ON d.SER_BR like concat('%',s.fab_broj)" posao_statistike > ~/rezultat.csv
https://www.geeksforgeeks.org/how-to-export-query-result-in-mysql/
SELECT ShortURL, l.LongURL, tag
FROM Links l LEFT JOIN
Domain d
ON l.LongURL LIKE concat('%', d.url, '%');
https://stackoverflow.com/questions/42026673/join-mysql-tables-based-on-partial-match-of-strings