You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done.
myString = "This is a string, containing some words. Try it, if you don't believe ;-)";
// Get the count of commas in the string:
cntCommas = myString.split(",").length-1;
// => 2
199
JavaScript
Strings
String auf Wunschlänge zuschneiden
myString = "abc";
mySubString = myString.substring(0,2);
// ab
200
JavaScript
Datum, Zeit
Aktuelles Datum/Uhrzeit
date = new Date();
// Sat Jun 14 2014 13:15:27 GMT+0200 (CEST)
dateStringISO = date.toISOString();
// "2014-06-14T11:15:27.097Z" // Attention: Time is different because of the timezone
date.toISOString().substring(0,10);
//"2014-06-14"
dateStringISO.split("T")[1];
// 11:15:27.097Z
260
SQLite
Datenbank
Temporäre DB-Tabelle
CREATE TEMPORARY TABLE myTempTable1
(
id INT
,myText TEXT
)
263
SQLite
Datenbank
CTAS
CREATE TABLE newDestinationTable AS
SELECT * FROM oldSourceTable
264
SQLite
Datenbank
Eine Menge B reduziert um Menge A
-- Es soll die Menge an Datensätze ausgegeben reduziert um eine andere Menge (Rest)
-- Die einzelnen Tabellen oder Subqueries müssen die gleichen Spalten im Statement haben
SELECT
FieldA
,FieldB
,FieldC
FROM myTable1
EXCEPT
SELECT
FieldA
,FieldB
,FieldC
FROM myTable2
291
SQLite
Strings
Führende Nullen vor einer Zahl
WITH cte_example AS
(
SELECT 5 AS int_example UNION ALL
SELECT 10 AS int_example UNION ALL
SELECT 50 AS int_example
)
SELECT
int_example,
substr('0000000'||ROW_NUMBER() OVER(ORDER BY int_example)||'00', -8, 8) AS example_result
FROM cte_example
;
141
SQLite
Datenbank
Fremdschlüsselprüfung aktivieren
-- http://www.sqlite.org/foreignkeys.html
PRAGMA foreign_keys = ON;
-- !! this is only valid for the current session.
-- If you want to use this permanent, you have to use this statement every time you start a new session
168
SQLite
Datum, Zeit
Erster und letzter Tag des Monats ermitteln
select date('now','start of month'); --first day of current month
select date('now','start of month', '+1 months','-1 day'); --last day of current month