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.
SELECT
*
FROM (
VALUES
(1, 2),
(3, 4)
) AS q (col1, col2)
GO
-- the same as:
SELECT 1 AS col1, 2 AS col2 UNION ALL
SELECT 3 AS col1, 4 AS col2
GO
-- col1 | col2
-- ===========
-- 1 | 2
-- -----------
-- 3 | 4
245
PL/pgSQL
Datenbank
SQL SELECT Statische Werte
SELECT
*
FROM (
VALUES
(1, 2),
(3, 4)
) AS q (col1, col2)
;
-- the same as:
SELECT 1 AS col1, 2 AS col2 UNION ALL
SELECT 3 AS col1, 4 AS col2
;
-- col1 | col2
-- ===========
-- 1 | 2
-- -----------
-- 3 | 4
246
Bash Script
Filehandling
Filename-Manipultation Basics
#!/bin/sh
myFilename="$1"
# or
myFilename="/tmp/Test/myFile.txt"
# Get only the path
path_only=$(dirname "$myFilename")
# /tmp/Test
# if it is a local file in the path, then . will be prompted e.g. myFilename="myFile.txt"
# Filename only
filename_only=$(basename "$myFilename")
# myFile.txt
# get only filename without extention
filename_without_ext="${filename_only%.*}"
# myFile
# get only the extension
filename_extention_only="${myFilename##*.}"
# txt
# put them together again
myFilename_together="${path_only}/${filename_without_ext}.${filename_extention_only}"
# /tmp/Test/myFile.txt
247
ORACLE PL/SQL
Datenbank
CSV erstellen
SELECT FieldA, LISTAGG(CSVItem, ',') WITHIN GROUP (ORDER BY FieldA) AS Members
FROM TableWithItems
GROUP BY FieldA;
248
PowerShell
Fallunterscheidung
Ternary operator
## Example from here: https://www.kongsli.net/2012/02/23/powershell-another-alternative-to-ternary-operator/
$thisVar='OK'
$resultVar = @{$true=1;$false=2}[$thisVar -eq 'OK']
// same as if-else construction
if ($thisVar -eq 'OK')
{
$resultVar = 1;
}
else
{
$resultVar = 2;
}
249
Python
Systeminfo
Betriebssystem ermitteln
import os
os.name
# nt, posix
import platform
platform.system()
# 'Windows', 'Linux', 'Darwin'
platform.release()
# Linux, Windows, Windows, Darwin
'2.6.22-15-generic', 'Vista' ,'10', '8.11.1'
# Example from https://stackoverflow.com/questions/1854/python-what-os-am-i-running-on
from sys import platform as _platform
if _platform == "linux" or _platform == "linux2":
# linux
elif _platform == "darwin":
# MAC OS X
elif _platform == "win32":
# Windows
elif _platform == "win64":
# Windows 64-bit
# Modes
# r: Read mode which is used when the file is only being read
# w: Write mode which is used to edit and write new information to the file (any existing files with the same name will be erased when this mode is activated)
# a: Appending mode, which is used to add new data to the end of the file; that is new information is automatically amended to the end
# r+: Special read and write mode, which is used to handle both actions when working with a file
myFile = open("myFile.txt","w")
myFile.write("Hello World")
myFile.close()