FIND YOUR NEXT FEW LINES

Results for “SQL”

Small, practical examples. Search by task or narrow things down below.

500 snippets foundClear filters
SQL ServerTransactions & tables

Catch a T-SQL error

Handle an expected conversion error in TRY/CATCH.

TRY CATCH✓ Tested
SQLGetting Started

Accept either of two conditions

SQL: Use OR to keep matching names or out-of-stock rows.

SQL✓ Tested
SQL ServerGetting Started

Accept either of two conditions

SQL Server: Use OR to keep matching names or out-of-stock rows.

SQL Server✓ Tested
SQLiteGetting Started

Accept either of two conditions

SQLite: Use OR to keep matching names or out-of-stock rows.

SQLite✓ Tested
SQLSchema design & transactions

Add an optional field to an existing table

SQL: A nullable column permits existing rows to remain valid while data is filled later.

SQL✓ Tested
SQL ServerSchema design & transactions

Add an optional field to an existing table

SQL Server: A nullable column permits existing rows to remain valid while data is filled later.

SQL Server✓ Tested
SQLiteSchema design & transactions

Add an optional field to an existing table

SQLite: A nullable column permits existing rows to remain valid while data is filled later.

SQLite✓ Tested
SQLGetting Started

Add values across several rows

SQL: Use SUM to calculate a total quantity.

SQL✓ Tested
SQL ServerGetting Started

Add values across several rows

SQL Server: Use SUM to calculate a total quantity.

SQL Server✓ Tested
SQLiteGetting Started

Add values across several rows

SQLite: Use SUM to calculate a total quantity.

SQLite✓ Tested
SQLConstraints & defaults

Apply a default when an insert omits a column

SQL: A default supplies an omitted value; an explicit NULL still follows the column’s nullability rules.

SQL✓ Tested
SQL ServerConstraints & defaults

Apply a default when an insert omits a column

SQL Server: A default supplies an omitted value; an explicit NULL still follows the column’s nullability rules.

SQL Server✓ Tested