-- Vytvorenie relácie
CREATE TABLE r (
  meno VARCHAR(20),
  vek SMALLINT
);

INSERT INTO r (meno, vek) VALUES
  ('Smith', 18),
  ('Jones', 35);

-- Projekcia
SELECT meno FROM r;

-- Restrikcia
SELECT * FROM r WHERE vek<30;

-- Premenovanie
SELECT meno AS m, vek AS v FROM r;

-- Pridanie stĺpca
SELECT meno, vek, vek >= 18 AS plnolety FROM r;

-- Natural join
SELECT * FROM r NATURAL JOIN t;

SELECT * FROM r, s WHERE s.id = r.id;

-- order
SELECT * FROM r ORDER BY vek;

-- group
SELECT meno, COUNT(meno) FROM r GROUP BY meno;