2
0

Compare commits

...

2 Commits

Author SHA1 Message Date
cwikladaniel
3a3c99701f add task two of today 2025-12-11 12:30:05 +01:00
cwikladaniel
576d664240 remove array outputs and add confirmation 2025-12-11 11:40:54 +01:00
4 changed files with 61 additions and 5 deletions

View File

@@ -27,8 +27,6 @@ if(!$fp){
$header_array =fgetcsv($fp, 0, ";"); $header_array =fgetcsv($fp, 0, ";");
print_r($header_array);
// CREATE XML DOM // CREATE XML DOM
$xmlDoc = new DOMDocument("1.0", "utf-8"); $xmlDoc = new DOMDocument("1.0", "utf-8");
$xmlDoc->formatOutput=true; $xmlDoc->formatOutput=true;
@@ -55,7 +53,6 @@ while(($row_array = fgetcsv($fp, 0, ";")) !== false){
// get current collumn // get current collumn
$column = $header_array[$i]; $column = $header_array[$i];
echo "$row_array[$i]<br>";
// create a new element with name of column and row data // create a new element with name of column and row data
$xmlSchuelerDaten = $xmlDoc->createElement($column, $row_array[$i]); $xmlSchuelerDaten = $xmlDoc->createElement($column, $row_array[$i]);
@@ -66,5 +63,7 @@ while(($row_array = fgetcsv($fp, 0, ";")) !== false){
} }
// Save whole XML file // Save whole XML file
$fileXml = "e2fi2.xml"; $fileXML = "e2fi2.xml";
$xmlDoc->save(__DIR__ . "/$fileXml"); $xmlDoc->save(__DIR__ . "/$fileXML");
echo "CSV FILE ($fileCSV) CONVERTED TO XML ($fileXML) AND SAVED";

View File

@@ -0,0 +1,6 @@
SELECT book.bibNr, book.titel, COUNT(book.bibNr) AS ausleihAnzahl
FROM buch as book
LEFT JOIN Ausleihe as rent ON book.bibNr = rent.bibNr
AND YEAR(rent.ausleihdatum) = 2015
GROUP BY book.bibNr, book.titel
ORDER BY ausleihAnzahl ASC

View File

@@ -0,0 +1,4 @@
SELECT ProductID, SUM(Quantity) AS orderAnzahl
FROM OrderDetails
GROUP BY ProductID
ORDER BY orderAnzahl ASC;

View File

@@ -0,0 +1,47 @@
# 2.2 XML
## 2.2.1
- Namen sind klar und deutlich
- inhaltlich korrekt geordnet
## 2.2.2
````xml
<?xml version="1.0" encoding="utf-8"?>
<data>
<buch>
<bibNr> </bibNr>
<title> </title>
<zustand> </zustand>
<seitenanzahl> </seitenanzahl>
</buch>
<avmedium>
<bibNr> </bibNr>
<title> </title>
<zustand> </zustand>
<dauer> </dauer>
</avmedium>
</data>
````
### 2.3 SQL
## 2.3.1
```sql
SELECT book.bibNr, book.titel, COUNT(book.bibNr) AS wieOftAusgeliehen
FROM buch AS book
LEFT JOIN Ausleihe AS rent ON book.bibNr = rent.bibNr
AND YEAR(rent.ausleihdatum) = 2015
GROUP BY book.bibNr, book.titel
ORDER BY wieOftAusgeliehen ASC
```
## 2.3.2
X
## 2.3.3
Gute Frage, frag chatgpt!