Skip to content

Koodiapinan SQL-haaste Mystery Cache

Hidden : 7/17/2018
Difficulty:
3.5 out of 5
Terrain:
4 out of 5

Size: Size:   micro (micro)

Join now to view geocache location details. It's free!

Watch

How Geocaching Works

Please note Use of geocaching.com services is subject to the terms and conditions in our disclaimer.

Geocache Description:


FIN:

Koodiapina on tietokoneohjelmoijista käytetty haukkuma-/hellittelynimi, joka sopii erinomaisesti myös allekirjoittaneeseen työnkuvan ja kätköilypreferenssien johdosta. Kaksi rakkauttani ovat SQL-ohjelmointikieli ja apinakätköt, jotka täten tässä yhdistän.

SQL on kauan sitten 70-luvulla kehitetty ohjelmointikieli, jota käytetään erityisesti tietokanta- ja nykyään myös big data-ympäristöissä. Se on edelleen yksi yleisimmistä ohjelmointikielistä ja kuuluu jokaisen itseään kunnioittavan old school-ohjelmoijan työkalupakkiin. Esimerkiksi bogusnaateissa sijaitsevan firman tiloissa on epäilemättä kirjoitettu kilometreittäin SQL:ää.

Mysteerin vaikeusaste riippuu täysin kätköilijän ohjelmointitaustasta.

Laskutehtäviä tehdessä saattaa tulla vastaan yksi tulkinnanvarainen kohta. Tähän vinkkinä: kätkö EI sijaitse alle 60m päässä Vanhasta Turun tiestä (tie 110).

Purkin luomuttaminen on täysin mahdollista. Kiivettävää ei ole paljoa, mutta oksat ovat harvassa ja siksi T4.

Oma kynä mukaan.

 

Tehtävät:

A) mikä seuraavista EI OLE yleinen SQL-komento?

1: insert

2: load

3: update

4: delete

B) millä seuraavista luodaan / määritellään SQL-tauluja?

1: DML

2: DQL

3: DDL

4: DCL

Sitten ohjelmoimaan!

Lähtötaulut (lihavoidut ja alleviivatut rivit ovat sarakkeiden nimiä):

Taulu a1:

avain                  arvo

1                         jotain

1                         jotain

2                         jotain

2                         jotain

2                         jotain

2                         jotain

2                         jotain

3                         jotain

3                         jotain

3                         jotain

 

Taulu a2:

avain                  arvo2

1                         jotainmuuta

3                         jotainmuuta

3                         jotainmuuta

4                         jotainmuuta

4                         jotainmuuta

4                         jotainmuuta

 

Taulu a3:

avain                  arvo

1                        2

1                        5

1                        8

1                       15

5                        2

5                        5

5                        8

5                       15

8                       15

8                        2

8                        5

8                        8

10                     15

10                      2

10                      8

10                      5

12                      2

12                      5

12                      8

12                     15

15                      2

15                      5

15                      8

15                     15

 

C) kuinka monta riviä syntyy tauluun b seuraavalla SQL-lauseella?

create table b as

select a1.avain, a2.arvo2

from a1 inner join a2

on a1.avain=a2.avain;

D) mikä tulee "summa":n arvoksi seuraavalla SQL-lauseella?

select sum(arvo) as summa

from a3 where avain>(select count(*) from b)

and arvo<=(select count(*)/2+1 from b);

 

Kätkö sijaitsee seuraavissa koordinaateissa:

N 60° (15-A).(C*50+A*19) E 024° (49-B).(D*4)

 

Ohessa linkki geocheckeriin:

Tarkasta geocache.fi:n palvelussa onko ratkaisusi oikea

 

******************************************************************************************************************************************************************

ENG:

Programmers are sometimes called (affectionately or less so) as code monkeys. The name suits yours truly well, both professionally and geocachingly. My two loves are the SQL programming language and climbing caches, which I here combine.

SQL is a programming language developed way back in the 70’s, and it is used especially in database and nowadays also in big data environments. It is still one of the most common programming languages, and is a must-have for any self-respecting old school programmer. There have been undoubtedly several kilometers of SQL written for example in the company located in the bogus coordinates.

The difficulty of this mystery depends totally on the cachers programming background.

There may be one ambiguous thing in doing the math. If uncertain: the cache is NOT located under 60m from the old Turku highway (road 110).

Logging the cache without any equipment is totally doable. There is not a lot to climb, but the braches are a bit far between, thus T4.

Bring your own pen.

 

Puzzles:

A) which of the following is NOT a common SQL statement?

1: insert

2: load

3: update

4: delete

B) which of the following is used to create / define SQL tables?

1: DML

2: DQL

3: DDL

4: DCL

Then some programming!

Source tables (bolded and underlined rows are the column names):

Table a1:

avain                  arvo

1                        jotain

1                        jotain

2                        jotain

2                        jotain

2                        jotain

2                        jotain

2                        jotain

3                        jotain

3                        jotain

3                        jotain

 

Table a2:

avain                  arvo2

1                        jotainmuuta

3                        jotainmuuta

3                        jotainmuuta

4                        jotainmuuta

4                        jotainmuuta

4                        jotainmuuta

 

Table a3:

avain                  arvo

1                        2

1                        5

1                        8

1                       15

5                        2

5                        5

5                        8

5                       15

8                       15

8                        2

8                        5

8                        8

10                     15

10                      2

10                      8

10                      5

12                      2

12                      5

12                      8

12                     15

15                      2

15                      5

15                      8

15                     15

 

C) how many rows does table b have with the following SQL syntax?

create table b as

select a1.avain, a2.arvo2

from a1 inner join a2

on a1.avain=a2.avain;

D) what is the value of ”summa” with the following SQL syntax?

select sum(arvo) as summa

from a3 where avain>(select count(*) from b)

and arvo<=(select count(*)/2+1 from b);

 

The cache is located in the following coordinates:

N 60° (15-A).(C*50+A*19) E 024° (49-B).(D*4)

 

Link to a geochecker:

Check your solution in geocache.fi

 

Additional Hints (No hints available.)