//pohlavi
SELECT
prijmeni AS Příjmení,
jmeno AS Jméno,
IF (SUBSTRING(rodne_cislo,3,2) > 12, 'žena', 'muž') AS Pohlaví,
SUBSTRING(rodne_cislo,5,2)-0 AS Den,
IF (SUBSTRING(rodne_cislo,3,2) > 12, SUBSTRING(rodne_cislo,3,2)-50,
SUBSTRING(rodne_cislo,3,2)-0) AS Měsíc,
CONCAT('19',LEFT(rodne_cislo,2)) AS Rok
FROM `osoby`
WHERE rodne_cislo < '900101'
ORDER BY Pohlaví
//datum z rc
SELECT
prijmeni AS Příjmení,
jmeno AS Jméno,
IF( SUBSTRING( rodne_cislo, 3, 2 ) >12, 'žena', 'muž' ) AS Pohlaví,
CONCAT_WS('.',SUBSTRING( rodne_cislo, 5, 2 ) -0,IF( SUBSTRING( rodne_cislo, 3,
2 ) >12, SUBSTRING( rodne_cislo, 3, 2 ) -50, SUBSTRING( rodne_cislo, 3, 2 )
-0 ),CONCAT( '19', LEFT( rodne_cislo, 2 ) )) AS `Datum narození`
FROM `osoby`
WHERE rodne_cislo < '900101'
//
SELECT tridy_trida as `Třída`, SUM(absence) as `Celková absence`,
ROUND(AVG(absence),2) as `Průměrná absence`, MAX(absence) as
`Maximální absence`
FROM studenti
GROUP BY tridy_trida
ORDER BY tridy_trida
//cpp
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Auto.cpp
* Author: ucitel
*
* Created on 13. listopadu 2017, 11:39
*/
bool Auto::kontrolaSPZ(const char* spz) const{
if(strlen(spz)<5 || strlen(spz)>7)
return false;
for(int i = 0;i < strlen(spz);i++){
if((spz[i]<'A'||spz[i]>'Z')&&(spz[i]<'0'||spz[i]>'9')
||(spz[i]=='G'|| spz[i]=='O' || spz[i]=='W' || spz[i]=='Q'))
return false;
}
return true;
}
//hpp
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Auto.hpp
* Author: ucitel
*
* Created on 13. listopadu 2017, 11:39
*/
#ifndef AUTO_HPP
#define AUTO_HPP
class Auto {
public:
Auto();
Auto(const Auto &);
Auto(const char*,float, int);
bool setSpz(char *);
bool setSpotreba(float);
bool setRokVyroby(int);
char *getSpz()const;
float getSpotreba()const;
int getRok()const;
int stariVozu()const;
virtual ~Auto();
private:
char *spz;
float spotreba;
int rok;
bool kontrolaSPZ(const char*)const;
int sysRok()const;
bool kontrolaRoku(int)const;
bool kontrolaSpotreby(float)const;
};
#endif /* AUTO_HPP */
//main
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: main.cpp
* Author: student
*
* Created on 13. listopadu 2017, 11:39
*/