bafybeia3nb2uenxgrob3lm4uxh3b2rgqivtojwjhblvs2tsyyntxfdijlu.ipfs.fleek.cool Open in urlscan Pro
178.128.142.154  Public Scan

URL: https://bafybeia3nb2uenxgrob3lm4uxh3b2rgqivtojwjhblvs2tsyyntxfdijlu.ipfs.fleek.cool/
Submission: On July 27 via api from US — Scanned from NL

Form analysis 2 forms found in the DOM

<form class="md-header__option" data-md-component="palette"> <input class="md-option" data-md-color-media="" data-md-color-scheme="slate" data-md-color-primary="green" data-md-color-accent="light-green" aria-label="Switch to light mode" type="radio"
    name="__palette" id="__palette_0"> <label class="md-header__button md-icon" title="Switch to light mode" for="__palette_1" hidden=""> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
      <path d="M17 7H7a5 5 0 0 0-5 5 5 5 0 0 0 5 5h10a5 5 0 0 0 5-5 5 5 0 0 0-5-5m0 8a3 3 0 0 1-3-3 3 3 0 0 1 3-3 3 3 0 0 1 3 3 3 3 0 0 1-3 3Z"></path>
    </svg> </label> <input class="md-option" data-md-color-media="" data-md-color-scheme="default" data-md-color-primary="deep-purple" data-md-color-accent="purple" aria-label="Switch to dark mode" type="radio" name="__palette" id="__palette_1">
  <label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_0" hidden=""> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
      <path d="M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zM7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"></path>
    </svg> </label> </form>

Name: search

<form class="md-search__form" name="search"> <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false"
    data-md-component="search-query" required=""> <label class="md-search__icon md-icon" for="__search"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
      <path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"></path>
    </svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
      <path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"></path>
    </svg> </label>
  <nav class="md-search__options" aria-label="Search"> <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
        <path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"></path>
      </svg> </button> </nav>
</form>

Text Content

Skip to content

0xfab1
MS SQL

Initializing search
GitHub
0xfab1
GitHub
 * Welcome
 * About
   About
    * Overview
    * 0xfab1
      0xfab1
       * 0xfab1.net
   
    * Life
      Life
       * Overview
       * Fun Advice
       * Goals
       * Health
       * Invest
       * Reflect
       * Rules
   
    * Me
      Me
       * Me
       * Books
       * Contact
       * Games
       * Music
       * News
       * Pets
       * Quotes
       * Support
       * Watch

 * Make
   Make
    * Overview
    * 3dprints
      3dprints
       * 3D Prints
       * Figures
       * Food
       * Games
       * Sort Stuff
   
    * Electronics
      Electronics
       * Electronics
       * Billy Bass
       * Keyboards
   
    * Food
      Food
       * Overview
       * Coffee
         Coffee
          * Espresso
      
       * Desert
         Desert
          * Deserts
          * Rhabarberkuchen
          * Apfelkuchen
          * Apfelwaffeln
          * Bananenbrot
          * Himbeer-Joghurt Cupcakes
          * Krümeltorte
          * Müsliriegel
          * Muffins
          * Nußecken
          * Schokoladenkuchen
          * Zimtsterne
      
       * Meal
         Meal
          * Bratkartoffeln
          * Brokkoli-Kartoffel-Gratin
          * Hühnchen Curry
          * Hühnchen Wrap
          * Chili Con Carne
          * Fenchelrisotto
          * Giouvetsi
          * Hackfleisch Gemüse Pfanne
          * Hackfleisch Kichererbsen Pfanne
          * Hühnerfrikassee
          * Kartoffel Mangold Gratin
          * Kartoffeleintopf
          * Lasagne
          * Mangold-Linsen-Curry
          * Ofen Hähnchen
          * Paprika Hack Pfanne
          * Paprikasoße mit Reis
          * Pasta mit Feta und Tomate
          * Pfannkuchen
          * Pizza
          * Sandwich
          * Spaghetti Bolognese
          * Spirelli Tuna
          * Zucchini Risotto
      
       * Other
         Other
          * Erdbeermarmelade
          * Rote Linsen und Oliven Aufstrich
      
       * Salad
         Salad
          * Italienischer Kartoffelsalat
          * Nudelsalat
      
       * Soup
         Soup
          * Kürbniskremesuppe
          * Linsensuppe
          * Mango Kokos Currysuppe
          * Tomatensuppe
   
    * Games
      Games
       * Overview
       * Boardgames
         Boardgames
          * Ideas
            Ideas
             * ChessPlus
             * HexDraw
             * HexaLogic
             * HexaRoll
             * LogicGate Duell
             * PowerDuell
         
          * Chessacre
            Chessacre
             * Rules
             * Examples
             * Notes
         
          * Einhorn
            Einhorn
             * Rules
             * Build
             * Details
         
          * Hagge
            Hagge
             * Rules
             * Build
             * Details
         
          * Jenga extreme
            Jenga extreme
             * Rules
         
          * Nagelbrett
            Nagelbrett
             * Rules
         
          * Prömpeln
            Prömpeln
             * Rules
             * Build
      
       * Collection
         Collection
          * Board Games
          * Dice Throne
      
       * Console builds
         Console builds
          * Overview
          * ZX Spectrum Next
          * Clockwork Gameshell
          * Controller
          * PiBoy
          * Pi Gaming Station
          * Retro Console
          * Retroball
          * SNES
          * Switch Pinball
          * Switch Taiko
      
       * Upgrades
         Upgrades
          * Hanamikoji
          * TMNT Game
          * Catan
          * Dixit
          * Fuchs im Wald
          * Life Counter
          * Lost Cities Duell
          * Mastermind
          * Odins Ravens
          * Royal Game of Ur
          * Tatsu
          * Tides of Madness
          * Vegas
   
    * Lasercutter
      Lasercutter
       * Laser Cutter
       * Bottles
       * Cup
       * Easter
       * Escher Tessellation
       * Flask
       * Pencil Box
       * Phone Holder
   
    * Lego
      Lego
       * Lego
       * Lego Builds
   
    * Music
      Music
       * Notes
       * My Setup
   
    * Workshop
      Workshop
       * Werkstatt
       * Bird House
       * Boulder Bag
       * Dice Mosaic
       * Guitar
       * Hörbert
       * Strandbeest
       * Whiskey Guitar

 * Tech
   Tech
    * Overview
    * Art
      Art
       * Art Overview
       * Database
         Database
          * Functions
          * Spatial Data
          * SQL Queries
          * Stored Procedures
      
       * Games
         Games
          * Painstations
      
       * Html
         Html
          * CSS
          * HTML
      
       * Machine learning
         Machine learning
          * Midjourney
          * Elegant Owl
          * pytorch
          * Stable Diffusion
      
       * Qrcode
         Qrcode
          * Pixel
          * Stable Diffusion
          * Text QR Codes
      
       * Random
         Random
          * Context Free Art
          * Movement Logs
          * Movies
          * Programming
          * The Scene
          * Shader
          * Sound
      
       * Text
         Text
          * Text Art
          * ANSI
          * ASCII
          * BBS
          * CurL
          * SSH
          * Telnet
          * Tracert
   
    * Cloud
      Cloud
       * Cloud Overview
       * Aws
         Aws
          * Amazon Web Services
          * FinOps
          * Locations
      
       * Azure
         Azure
          * Azure
          * Certs
            Certs
             * DP 203
               DP 203
                * Exam Topics
                * Glossary
                * Summery
         
          * Commandline
            Commandline
             * Azure CLI
             * Azure Powershell
             * Bicep
             * Azure Cloud Shell
             * Query Azure CLI
             * Terraform
         
          * Design
            Design
             * Azure Regions
             * CAF and WAF
             * Landing Zone
             * Licensing
             * Network
             * Policies
             * Services
         
          * Devops
            Devops
             * DevOps
         
          * Services
            Services
             * Azure Portal
             * Cogntive Services
             * Container
             * M365
             * Static Website
             * Storage Account
             * Tags
             * Azure VM
      
       * Gcp
         Gcp
          * Google Cloud Platform
   
    * Dev
      Dev
       * Dev Overview
       * Database
         Database
          * MS SQL MS SQL
            Table of contents
             * JOIN
                * INNER JOIN
                * LEFT JOIN (or LEFT OUTER JOIN)
                * RIGHT JOIN (or RIGHT OUTER JOIN)
                * FULL OUTER JOIN
                * CROSS JOIN
            
             * CASE
             * COALESCE
             * Receive XML as query result
             * Enter Ids manually (bad!)
             * Builtin functions
             * UPSERT
         
          * SQLite
      
       * Go
         Go
          * Go
      
       * Powershell
         Powershell
          * Powershell Snippets
          * Powershell Advice
          * Powershell Setup
      
       * Python
         Python
          * Python
          * Borb
          * Jupyter Notebooks
          * Snippets
      
       * R
         R
          * R
      
       * Ruby
         Ruby
          * Ruby
      
       * Web
         Web
          * Basics
          * Deploy
          * JS Libraries
          * Markdown
          * Node-js
          * Static Site Generators
          * Web Assembly
   
    * Hack
      Hack
       * Wisdom
       * Notes
         Notes
          * Attack Tools
          * Helper
          * Information Gathering
          * Post Exploit
          * Reverse Engineering
          * Steganography
          * Vulnerability Analysis
      
       * Writeups
         Writeups
          * Cryptohack.org
            Cryptohack.org
             * Encoding
             * FavByte
             * Gotta go fast
             * LemurXOR
             * No Leaks 13372
             * XOR
         
          * Hackthebox.com
            Hackthebox.com
             * Cube Madness 1
             * Lightning Fast
         
          * Tryhackme.com
            Tryhackme.com
             * Advent of Cyber
             * Attacktive Directory
             * Binex
             * Boogeyman 1
             * Capture
             * DogCat
             * Internal
             * Kenobi
             * Mr. Robot
             * Post-Exploitation
             * Relevant
             * Res
             * Wonderland
   
    * Hardware
      Hardware
       * Hardware Overview
       * Hack
         Hack
          * Open DSKY
          * USB Armory
          * USB WiFi Logger
      
       * Iot
         Iot
          * MQTT broker
          * ESP32
          * Linux IoT
      
       * Keyboards
         Keyboards
          * Keyboard
          * Keyboard Only
          * My Keyboards
      
       * Maker tools
         Maker tools
          * 3D Printing
          * Laser cutter
          * WLKATA Mirobot
      
       * Other
         Other
          * LED Name Tag
          * Bitcoin miner
          * Creative Coder
          * Drone
          * M5Stack Core2
      
       * Pc
         Pc
          * BIOS
          * Computer
   
    * Os
      Os
       * Operating Systems
       * iOS Apps
       * Kali
       * Linux
       * MAC OS
       * Raspberry Pi
       * Ubuntu
       * Windows
   
    * Standards
      Standards
       * Standards Overview
       * IT Humor
       * IT Gender
       * Codes
       * IT-Conferences
       * Crypto Currency
       * Character encoding
       * Falsehoods
       * Hardware
       * Network
       * Projects
       * Protocols
       * XKCD
       * RFCs
       * Speed
       * Time
       * X-Gram
   
    * Tools
      Tools
       * Tool Overview
       * Squoosh
       * adb
       * asciinema
       * Blender
       * Calibre
       * Chocolatey
       * CLI Tools
       * Cloudron
       * Croc
       * curl
       * CyberChef
       * Discord
       * Docker
       * Draw.io
       * Email
       * Excel
       * EXIFtool
       * FFmpeg
       * File Recovery
       * Firefox
       * Fritzbox
       * gallery-dl
       * Git
       * Gitea
       * Github
       * Gitlab
       * GPG
       * ImageMagick
       * Inkscape
       * IPFS
       * IRC
       * Jitsi Meet
       * Joplin
       * JSON Tools
       * Keybase
       * Kubernetes
       * MobaXterm
       * mRemoteNG
       * Mumble
       * Navi
       * ncspot
       * Nmap
       * NocoDB
       * OBS
       * Obsidian
       * OMG.lol
       * OpenAI
       * OpenSSL
       * Pandoc
       * Playnite
       * Podman
       * qbittorrent
       * rclone
       * Restic
       * Robocopy
       * rsync
       * SCP
       * screego
       * Size Bench
       * SSH
       * Steam
       * Syncthing
       * Sysinternals
       * Tailscale
       * Teleport
       * Tor
       * Umami
       * usbipd
       * VeraCrypt
       * VIM
       * VLC
       * VScode
       * Wget
       * WinGet
       * Windows Terminal
       * WinSCP
       * Wireguard
       * Wireshark
       * WSL
       * yt-dlp

Table of contents
 * JOIN
    * INNER JOIN
    * LEFT JOIN (or LEFT OUTER JOIN)
    * RIGHT JOIN (or RIGHT OUTER JOIN)
    * FULL OUTER JOIN
    * CROSS JOIN

 * CASE
 * COALESCE
 * Receive XML as query result
 * Enter Ids manually (bad!)
 * Builtin functions
 * UPSERT


MS SQL

   _..------.._
.-~            ~-.
|                |
|"-..________..-"|
|                |  ____   ___  _
|                | / ___| / _ \| |
|"-..________..-"| \___ \| | | | |
|                |  ___) | |_| | |___
|                | |____/ \__\_|_____|
|"-..________..-"|
|                |
|                |
 "-..________..-"



JOIN

Assume table1 has the following columns and data:

 * id (unique identifier)
 * name (name of an individual)

id name 1 Alice 2 Bob 3 Charlie

And table2 has the following columns and data:

 * id (unique identifier)
 * table1_id (foreign key referencing id in table1)
 * hobby (hobby of the individual)

id table1_id hobby 1 1 Reading 2 2 Swimming 3 3 Painting 4 3 Dancing




INNER JOIN

This join returns rows when there is a match in both tables.

SELECT table1.id, table1.name, table2.hobby
FROM dbo.table1
INNER JOIN dbo.table2 ON table1.id = table2.table1_id;



LEFT JOIN (OR LEFT OUTER JOIN)

This join returns all rows from the left table, and the matched rows from the
right table. If there is no match, NULLs are returned for columns of the right
table.

SELECT table1.id, table1.name, table2.hobby
FROM dbo.table1
LEFT JOIN dbo.table2 ON table1.id = table2.table1_id;



RIGHT JOIN (OR RIGHT OUTER JOIN)

This join returns all rows from the right table, and the matched rows from the
left table. If there is no match, NULLs are returned for columns of the left
table.

SELECT table1.id, table1.name, table2.hobby
FROM dbo.table1
RIGHT JOIN dbo.table2 ON table1.id = table2.table1_id;



FULL OUTER JOIN

This join returns rows when there is a match in one of the tables. It combines
the result of both LEFT and RIGHT joins.

SELECT table1.id, table1.name, table2.hobby
FROM dbo.table1
FULL OUTER JOIN dbo.table2 ON table1.id = table2.table1_id;



CROSS JOIN

This join returns the Cartesian product of the two tables, meaning every
combination of rows from the two tables.

SELECT table1.id, table1.name, table2.hobby
FROM dbo.table1
CROSS JOIN dbo.table2;



CASE

This example translates[table1].[statusID] into a given text value.

SELECT [Table] =
CASE [Table].[statusID]
    WHEN 0 THEN 'Created'
    WHEN 200 THEN 'Running'
    WHEN 300 THEN 'HALTED'
    WHEN 400 THEN 'Canceled'
    WHEN 500 THEN 'Finished'
    ELSE '-undefined-'
END
FROM [dbo].[table1]



COALESCE

COALESCE((SELECT [...] option1), (SELECT [...] option2), (SELECT [...] option3))



RECEIVE XML AS QUERY RESULT

FOR XML AUTO, TYPE, XMLSCHEMA, ELEMENTS XSINIL



ENTER IDS MANUALLY (BAD!)

SET IDENTITY_INSERT [dbo].[Table] ON
\-- DO STUFF
SET IDENTITY_INSERT [dbo].[Table] OFF



BUILTIN FUNCTIONS

SELECT HOST_NAME() -- GET Local System Name
SELECT GETUTCDATE() -- GET Local Time (UTC - Zone)
SELECT SUSER_NAME() -- GET SuperUser Name of DB



UPSERT

UPSERT is an operation that inserts new records into the database and updates
existing ones. This operation is particularly useful for maintaining data
integrity and ensuring efficient data manipulation.

 * Check for Existence: The operation first checks if a record with a specified
   key (usually a primary key or a unique key) already exists in the table.
 * Update or Insert:
 * If the record exists: The operation updates the existing record. Typically,
   this involves modifying one or more fields with new values.
 * If the record does not exist: The operation inserts a new record into the
   table with the given values.

The specific behavior and implementation of an UPSERT operation can vary between
different SQL database systems, but the core concept remains the same. Here are
some databases and when they introduced UPSERT, if at all:

 * PostgreSQL: Uses the ON CONFLICT clause as part of an INSERT statement. The
   UPSERT functionality was introduced in PostgreSQL 9.5, which was released in
   January 2016. It uses the ON CONFLICT clause.
 * MySQL: Offers the INSERT ON DUPLICATE KEY UPDATE statement. MySQL has had a
   form of UPSERT since version 4.1 through the INSERT ON DUPLICATE KEY UPDATE
   syntax.
 * SQLite: SQLite supports UPSERT as of version 3.24.0, released in June 2018.
 * SQL Server: Microsoft SQL Server doesn't have a specific UPSERT command but
   uses the MERGE statement to achieve similar functionality. The MERGE
   statement was introduced in SQL Server 2008.
 * Oracle: Oracle Database uses the MERGE statement, like SQL Server, to perform
   UPSERT operations.

Back to top