Commit c1ca5b86 authored by K9272's avatar K9272
Browse files

H1

parent 64f63406
# TTC2020-Tietokannat
Tietokannat-opintojakson palautukset
\ No newline at end of file
Tietokannat-opintojakson palautukset
## Viikkotehtävät
[H1](harjoitukset/1.md)
\ No newline at end of file
# Viikko 1 Työkalut
## T1
Asenna MySQL XAMPPista ja MySQL WorkBench
![](H1/t1-mysql.png)
Asenna MySQL WorkBench ja luo esimerkkitietokanta.
![](H1/t1-workbench.png)
## T2
Luo ohjeen mukaisesti itsellesi mariaDB-tunnus.
```
Authenticated as: K9272
Account created: yes
A database 'K9272' has been created.
You can also manually create K9272_1, K9272_2, and K9272_3.
```
Ota yhteys tunnuksellasi Labranetin MariaDB-palvelimelle
```
[K9272@student ~]$ mysql -u K9272 -p********** -h mariadb.labranet.jamk.fi
```
Valitaan sallittu nimi
```
MariaDB [(none)]> use K9272
Database changed
MariaDB [K9272]>
```
Ja CopyPaste init-tiedoston sisältö
tulkkiin ja esimerkkitietokanta on valmis.
Suoritetaan esimerkkikyselyt
```
MariaDB [K9272]> SELECT * FROM students;
OM courses;+-----------+----------+-----------+------------+----------+----------+---------+----------+
| studentID | lastname | firstname | birthdate | eyecolor | incomes | taxrate | hometown |
+-----------+----------+-----------+------------+----------+----------+---------+----------+
| 2001 | Guru | Ken | 2001-11-11 | Ruskea | 12010.12 | 5.10 | 1 |
| 2002 | Saurus | Tino | 2002-11-11 | Ruskea | 14010.22 | 6.20 | 1 |
| 2003 | Tiainen | Sini | 2003-11-11 | Sininen | 16010.32 | 7.30 | 1 |
| 2004 | Vainio | Vilja | 2004-11-11 | Sininen | 0.00 | 0.00 | 3 |
| 2005 | Vainio | Elo | 2005-11-11 | Sininen | 0.00 | 0.00 | 3 |
| 2006 | Rahainen | Muu | 2006-11-11 | Harmaa | 13010.12 | 5.80 | 2 |
| 2007 | Alainen | Kim | 2007-11-11 | NULL | 18010.12 | 8.80 | 2 |
| 2008 | Ana | Ruut | 2008-11-11 | NULL | 20010.12 | 9.90 | NULL |
+-----------+----------+-----------+------------+----------+----------+---------+----------+
8 rows in set (0.001 sec)
MariaDB [K9272]> SELECT * FROM courses;
+----------+-------------+---------+
| courseID | coursename | credits |
+----------+-------------+---------+
| 1 | Ohjelmointi | 5 |
| 2 | Tietokannat | 4 |
| 3 | Ruotsi | 3 |
+----------+-------------+---------+
3 rows in set (0.001 sec)
MariaDB [K9272]>
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment