(i)SQL – Cheat Sheet

Informix never forget 😉

Creation/Manipulation of tables:

CREATE TABLE tabelle (nummer int, text char(10), time datetime, date date);
DROP table tabelle;
ALTER TABLE table_name MODIFY (name char(100));
ALTER TABLE table_name ADD column_name column-definition;

can be positioned with AFTER/BEFORE

Unloading tables:

unload to '/home/content.csv'
delimiter ';'
SELECT * FROM content

Transactional Stuff:

BEGIN WORK;
ROLLBACK WORK;

Query Time:

SELECT |ALL|DISTINCT|UNIQUE|FIRST 
FROM table (WHERE)
GROUP BY columnname
HAVING COUNT(**)>1
ORDER BY columnname (ASC|DESC), ....
INTO TEMP tablename

WHERE-Clause:

bla (NOT) BETWEEN bla AND 
bla (NOT) IN (List, of, bla)
bla (NOT) LIKE "bla"
bla (NOT) EXISTS 
bla IS (NOT) NULL

to combine multiple selects

UNION

TO_CHAR transformation for query:

SELECT nr FROM numbers WHERE nr MATCHES "38*"
Error 219: Wildcard matching may not be used with non-character types.

SELECT nr FROM numbers WHERE TO_CHAR(nr) MATCHES "38*"
0

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.