.Dd Created:2026-05-14|Updated:2026-05-14| .de ocsi \\$* , .. .de oxr .ocsi .Xr \\$* .. .de oit .It \\$* .. .de obdi .Bl -dash -compact .oit \\$* .. .de obdl .Bd -literal -compact \\$* .. .de onote .Bl -hang -compact .oit \\$* .El .. .de ocomm .Bl -diag -compact .oit \\$* .El .. .de opsy .Pp .Sy - \\$* .. .de obc .Bl -column \\$* .. .de obc2 .obc opt desc .. .de obc3 .obc option arguments description .. .de dm .opsy Archlinux manpages: \\$* .. .Dt SQL_ADMIN oh .Os linux , OpenBSD 7.8 | .Nm sql_admin .Nd SQL admin .Sh DATABASE_ACTIONS .Dl [CREATE|DROP] DB_ELEMENT [IF [NOT] EXISTS] ELEMENT_NAME; .obc db_element .It DB element Ta : can be table, view, trigger. .It Exists Ta : create if item does not exist or drop if it exists. .El .Sh TABLE_ACTIONS .obc2 .It insert Ta : Li INSERT INTO () VALUES(); .It update Ta : Li UPDATE SET = ; .It delete Ta : Li DELETE FROM WHERE ; .El .Sh SCHEMA_DEFINITIONS .Ss Tables .obdl CREATE TABLE ( COLUMN_NAME1 DATA_TYPE, COLUMN_NAME2 DATA_TYPE ); .Ed .Ss Views Queries can be saved as views: .Li create view VIEW_NAME as QUERY; .Ss Triggers Specify action to be executed on events: .obdl create trigger TRIGGER_NAME [BEFORE|AFTER] [EVENT] begin STATEMENT end; .Ed EVENT can be: .obc2 .It insert Ta : Li INSERT ON .It update Ta : Li UPDATE OF ON .It delete Ta : Li DELETE ON .El Field references can be: .obc2 .It insert Ta : new.COLUMN_NAME .It update Ta : new.COLUMN_NAME and old.COLUMN_NAME .It delete Ta : old.COLUMN_NAME .El .Sy Example .obdl CREATE TRIGGER AFTER INSERT on begin UPDATE set = new.; end; .Ed .Sh SEE ALSO .oxr sql oh .oxr sqlite3 oh .Xr mysql oh .Sh AUTHORS .An -nosplit .Xr ohazot oh | .Xr ABOUT_OH oh | .Lk https://ohazot.com ohazot.com .Aq Mt admin@ohazot.com