PostgreSQL - Relačný model¶
Schema¶
DROP TABLE IF EXISTS source; DROP TABLE IF EXISTS target; DROP TABLE IF EXISTS category; DROP TABLE IF EXISTS detector; DROP TABLE IF EXISTS src_port; DROP TABLE IF EXISTS dst_port; DROP TABLE IF EXISTS alerts; CREATE TABLE alerts( ID text UNIQUE, DetectTime timestamp, alert jsonb ); CREATE TABLE source( ID text, source_min inet, source_max inet ); CREATE TABLE target( ID text, target_min inet, target_max inet ); CREATE TABLE category( ID text, Category text ); CREATE TABLE detector( ID text, Node_Name text ); CREATE TABLE src_port( ID text, source_port integer ); CREATE TABLE dst_port( ID text, target_port integer );
Dotazy¶
MENTAT
SELECT alert FROM alerts WHERE (DetectTime >= ':start' AND DetectTime <= ':end');
HAWAT1
HAWAT2
HAWAT3
HAWAT4
HAWAT5
HAWAT6
HAWAT7
OTHER1
OTHER2