sql_cheat_sheet
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
sql_cheat_sheet [2021/04/13 22:22] – [Search All Text in a Database] stephen | sql_cheat_sheet [2025/01/13 22:44] (current) – stephen | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== SQL Cheat Sheet ====== | ====== SQL Cheat Sheet ====== | ||
+ | |||
+ | For Postgres SQL, see [[postgres_sql_cheat_sheet|Postgres SQL Cheat Sheet]] | ||
===== CREATE ===== | ===== CREATE ===== | ||
Line 28: | Line 30: | ||
FROM | FROM | ||
Table2 | Table2 | ||
+ | |||
+ | -- INSERTing multiple rows. | ||
+ | INSERT INTO Table1 | ||
+ | (Col1, | ||
+ | VALUES | ||
+ | (Data1, Data2, Data3) | ||
+ | , (Data1, Data2, Data3) | ||
</ | </ | ||
Line 39: | Line 48: | ||
Table1.Col1 = Table2.Col1 | Table1.Col1 = Table2.Col1 | ||
, Table1.Col2 = Table2.Col2 | , Table1.Col2 = Table2.Col2 | ||
+ | FROM | ||
+ | Table1 | ||
+ | INNER JOIN | ||
+ | Table2 | ||
+ | ON | ||
+ | Table2.Id = Table1.Id | ||
+ | </ | ||
+ | |||
+ | ===== DELETE ===== | ||
+ | |||
+ | <code sql> | ||
+ | -- Combining an UPDATE with a JOIN. | ||
+ | DELETE | ||
+ | Table1 | ||
FROM | FROM | ||
Table1 | Table1 | ||
Line 310: | Line 333: | ||
WHERE | WHERE | ||
SourceObjects.object_id IS NULL OR NewObjects.object_id IS NULL | SourceObjects.object_id IS NULL OR NewObjects.object_id IS NULL | ||
+ | </ | ||
+ | |||
+ | ===== Export a .bacpac By Command Line ===== | ||
+ | |||
+ | Install SqlPackage: | ||
+ | < | ||
+ | dotnet tool install -g microsoft.sqlpackage | ||
+ | </ | ||
+ | |||
+ | Export .backpac. Only add the '' | ||
+ | < | ||
+ | SqlPackage / | ||
</ | </ | ||
sql_cheat_sheet.1618352553.txt.gz · Last modified: 2021/04/14 23:22 (external edit)