select
  s.id AS id_spoje,
  s.cislo_spoje AS cislo_spoje,
  z.id AS ze,
  zz.jmeno AS ze_zastavky,
  to_char(trunc(sysdate) + z.cas/1440, 'HH24:MI') AS odjezd,
  k.id AS do,
  zk.jmeno AS do_zastavky,
  to_char(trunc(sysdate) + k.cas/1440, 'HH24:MI') AS prijezd,
  d.nazev AS dopravce,
  bus.ridic AS ridic,
  (k.vzdalenost - z.vzdalenost) AS vzdalenost,
  (k.vzdalenost - z.vzdalenost) * d.cena_za_km AS cena,
  volna_sedadla(s.id) AS volna_sedadla
FROM
  trasa z,
  trasa k,
  zastavka zz,
  zastavka zk,
  spoje s,
  autobus bus,
  dopravce d
where
  z.id_zastavka = zz.id AND
  k.id_zastavka = zk.id AND
  z.id_spoje = k.id_spoje AND
  z.id_spoje = s.id AND
  s.id_autobus = bus.id AND
  bus.id_dopravce = d.id AND
  zz.jmeno = 'Praha, Zličín' AND
  zk.jmeno = 'Plzeň, CAN'
ORDER BY odjezd;