public static void saveDataAsTable(File file) throws Exception {
		
		check();
		
		String query = "SELECT aname, mname, COUNT(date) FROM namedata n LEFT JOIN artistname a ON n.aid = a.aid LEFT JOIN medianame m ON m.mid = n.mid GROUP BY aname, mname;";
		
		String out[][] = sc.getStringArrayByQuery(query);
		
		if (!file.exists()) {
			file.createNewFile();
		}
		
		BufferedWriter bw = new BufferedWriter(new FileWriter(file.getAbsolutePath()));
		
		HashMap<String, Integer> indAName = new HashMap<String, Integer>();
		HashMap<String, Integer> indMName = new HashMap<String, Integer>();
		
		ArrayList<String> aNames = new ArrayList<String>();
		ArrayList<String> mNames = new ArrayList<String>();
		
		for(int i = 0; i < out.length; i++) {
			
			String[] o = out[i];
			
			String aName = o[0];
			String mName = o[1];
			
			if(!indAName.containsKey(aName)) {
				aNames.add(aName);
				indAName.put(aName, aNames.size()-1);
			}
			
			if(!indMName.containsKey(mName)) {
				mNames.add(mName);
				indMName.put(mName, mNames.size()-1);
			}
			
		}
		
		int[][] result = new int[aNames.size()][mNames.size()];
		
		for(int i = 0; i < out.length; i++) {
			
			String[] o = out[i];
			
			String aName = o[0];
			String mName = o[1];
			Integer res = Integer.parseInt(o[2]);
			
			Integer aInd = indAName.get(aName);
			Integer mInd = indMName.get(mName);
			
			result[aInd][mInd] = res;
			
		}
		
		// Spaltennamen
		for(int i = 0; i < mNames.size(); i++) {
			String l = mNames.get(i);
			if(i < mNames.size() - 1) {
				l += ";";
			}
			bw.write(l);
		}
		bw.newLine();
		
		// Zeilennamen + Daten
		for(int i = 0; i < result.length; i++) {
			
			bw.write(aNames.get(i));
			int[] row = result[i];
			for(int j = 0; j < row.length; j++) {
				bw.write(";" + row[j]);
			}
			bw.newLine();
		}
		
		bw.flush();
		bw.close();
	}