diff options
| author | lonkaars <loek@pipeframe.xyz> | 2022-09-16 13:44:30 +0200 |
|---|---|---|
| committer | lonkaars <loek@pipeframe.xyz> | 2022-09-16 13:44:30 +0200 |
| commit | df85f06afad20a75d4942dd1f0784a7d0a7ddc0b (patch) | |
| tree | 5bf27bfc7bdc7a2e8dc0e6634dd51c5c0d4e2627 | |
huiswerkopdrachten t/m 1.18 + initial commit
| -rw-r--r-- | huiswerk.md | 104 | ||||
| -rw-r--r-- | license | 21 | ||||
| -rw-r--r-- | readme.md | 5 |
3 files changed, 130 insertions, 0 deletions
diff --git a/huiswerk.md b/huiswerk.md new file mode 100644 index 0000000..4ed078f --- /dev/null +++ b/huiswerk.md @@ -0,0 +1,104 @@ +# sql huiswerk + +|opdracht#|oplossing| +|---------|---------| +|1.01 |`select * from activiteit;`| +|1.02 |`select * from opleiding;`| +|1.03 |`select naam from student;`| +|1.04 |`select naam,oplcode from student;`| +|1.05 |`select oplcode from opleiding;`| +|1.06 |`select distinct oplcode from student;`| +|1.07 |[`select distinct * from opleiding;`](#107)| +|1.08 |[`select distinct academie from opleiding;`](#108)| +|1.09 |[`select distinct academie,oplcode from opleiding;`](#109)| +|1.10 |`select naam from student order by naam asc;`| +|1.11 |`select * from opleiding order by omschrijving desc;`| +|1.12 |`select actomschr,prijs from activiteit order by prijs asc;`| +|1.13 |`select distinct oplcode from student order by oplcode asc;`| +|1.14 |`select oplcode,studentnr,naam from student order by oplcode asc, naam desc;`| +|1.15 |[`select distinct * from opleiding;`](#115)| +|1.16 |`select * from activiteit where actcode = "KLS";`| +|1.17 |`select * from activiteit where prijs > 10.0;`| +|1.18 |`select * from activiteit where prijs >= 15.0 order by prijs;`| +|1.19 |``| + +## 1.07 + +``` +MariaDB [mysql]> select distinct * from opleiding; ++---------+--------------------------+----------+ +| oplcode | omschrijving | academie | ++---------+--------------------------+----------+ +| BK | Bouwkunde | ABCT | +| CT | Civiele Techniek | ABCT | +| ET | Electrotechniek | AII | +| IN | Informatica | AII | +| TBK | Technische Bedrijfskunde | AII | +| TI | Technische Informatica | AII | +| VS | Virtueel Studeren | NULL | +| WTB | Werktuigbouw | AII | ++---------+--------------------------+----------+ +8 rows in set (0.000 sec) + +MariaDB [mysql]> +``` + +Dit commando pakt de distincte resultaten uit de primary key kolom (oplcode), +en weergeeft ook alle andere kolommen voor elk resultaat. + +## 1.08 + +``` +MariaDB [mysql]> select distinct academie from opleiding; ++----------+ +| academie | ++----------+ +| ABCT | +| AII | +| NULL | ++----------+ +3 rows in set (0.000 sec) + +``` + +Dit commando laat alleen de distincte resultaten uit de `academie` kolom van de +`opleiding` tabel zien. + +## 1.09 + +``` +MariaDB [mysql]> select distinct academie,oplcode from opleiding; ++----------+---------+ +| academie | oplcode | ++----------+---------+ +| ABCT | BK | +| ABCT | CT | +| AII | ET | +| AII | IN | +| AII | TBK | +| AII | TI | +| NULL | VS | +| AII | WTB | ++----------+---------+ +8 rows in set (0.001 sec) + +MariaDB [mysql]> +``` + +Dit commando pakt de distincte resultaten uit de primary key kolom (oplcode), en +weergeeft ook de `academie` kolom voor elk resultaat. + +## 1.15 + +``` +MariaDB [mysql]> select * order by actcode from planning; +ERROR 1064 (42000): You have an error in your SQL syntax; +check the manual that corresponds to your MariaDB server version for the right +syntax to use near 'from planning' at line 1 +MariaDB [mysql]> +``` + +Dit commando geeft een foutmelding, maar werkt normaal wanneer het `order by +actcode` gedeelte na het `from planning` gedeelte komt. Dus zijn de volgorde +van SQL statements belangrijk. + @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 lonkaars + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..df907a5 --- /dev/null +++ b/readme.md @@ -0,0 +1,5 @@ +# huiswerk dab + +ik geef hier de opdrachten vrij omdat het er naar mijn mening te veel zijn. +gelieve dit als naslagwerk te gebruiken. + |