Search results
15 wrz 2008 · From SQL Server 2012 you can use the IIF function for this. SELECT IIF(Obsolete = 'N' OR InStock = 'Y', 1, 0) AS Salable, * FROM Product This is effectively just a shorthand (albeit not standard SQL) way of writing CASE .
12 wrz 2022 · Learn how to build conditional logic when writing SQL code using IF, BEGIN, END, ELSE, and ELSEIF logic.
Whether you're new to databases or have some programming experience, this repository provides step-by-step guidance, code examples, exercises, and resources to help you master SQL. Let's unlock the power of data with SQL!
The IF...ELSE statement is a control-flow statement that allows you to execute or skip a statement block based on a specified condition. The IF statement. The following illustrates the syntax of the IF statement: IF boolean_expression . BEGIN . { statement_block } END Code language: SQL (Structured Query Language) (sql)
1 cze 2021 · Standard SQL Functions Cheat Sheet. TEXT FUNCTIONS. CONCATENATION. Use the || operator to concatenate two strings: SELECT 'Hi ' || 'there!'; -- result: Hi there! Remember that you can concatenate only character strings using ||. Use this trick for numbers: SELECT '' || 4 || 2; -- result: 42.
Our SQL tutorial will teach you how to use SQL in: MySQL, SQL Server, MS Access, Oracle, Sybase, Informix, Postgres, and other database systems. Start learning SQL now » Examples in Each Chapter
17 sie 2023 · 20 Basic SQL Query Examples for Beginners. Tihomir Babic. sql basics. Table of Contents. What Is SQL? Dataset. 1. Selecting All Columns From One Table. 2. Selecting One Column From One Table. 3. Selecting Two Columns From One Table. 4. Selecting Two (or More) Columns From One Table and Filtering Using Numeric Comparison in WHERE. 5.