The Notes for Professionals book is compiled from Stack Overflow Documentation, the content is written by the beautiful people at Stack Overflow. Text content is released under Creative Commons BY-SA. See credits at the end of this book whom contributed to the various chapters. Images may be copyright of their respective owners unless otherwise specified
Book created for educational purposes and is not affiliated with group(s), company(s) nor Stack Overflow. All trademarks belong to their respective company owners
https://goalkicker.com/
章节目录
1-1
Content list
1-2
About
1-3
Chapter 1: Getting started with Microsoft SQL Server
1-4
Section 1.1: INSERT / SELECT / UPDATE / DELETE: the basics of Data Manipulation Language
1-5
Section 1.2: SELECT all rows and columns from a table
1-6
Section 1.3: UPDATE Specific Row
1-7
Section 1.4: DELETE All Rows
1-8
Section 1.5: Comments in code
1-9
Section 1.6: PRINT
1-10
Section 1.7: Select rows that match a condition
1-11
Section 1.8: UPDATE All Rows
1-12
Section 1.9: TRUNCATE TABLE
1-13
Section 1.10: Retrieve Basic Server Information
1-14
Section 1.11: Create new table and insert records from old table
1-15
Section 1.12: Using Transactions to change data safely
1-16
Section 1.13: Getting Table Row Count
1-17
Chapter 2: Data Types
1-18
Section 2.1: Exact Numerics
1-19
Section 2.2: Approximate Numerics
1-20
Section 2.3: Date and Time
1-21
Section 2.4: Character Strings
1-22
Section 2.5: Unicode Character Strings
1-23
Section 2.6: Binary Strings
1-24
Section 2.7: Other Data Types
1-25
Chapter 3: Converting data types
1-26
Section 3.1: TRY PARSE
1-27
Section 3.2: TRY CONVERT
1-28
Section 3.3: TRY CAST
1-29
Section 3.4: Cast
1-30
Section 3.5: Convert
1-31
Chapter 4: User Defined Table Types
1-32
Section 4.1: creating a UDT with a single int column that is also a primary key
1-33
Section 4.2: Creating a UDT with multiple columns
1-34
Section 4.3: Creating a UDT with a unique constraint:
1-35
Section 4.4: Creating a UDT with a primary key and a column with a default value:
1-36
Chapter 5: SELECT statement
1-37
Section 5.1: Basic SELECT from table
1-38
Section 5.2: Filter rows using WHERE clause
1-39
Section 5.3: Sort results using ORDER BY
1-40
Section 5.4: Group result using GROUP BY
1-41
Section 5.5: Filter groups using HAVING clause
1-42
Section 5.6: Returning only first N rows
1-43
Section 5.7: Pagination using OFFSET FETCH
1-44
Section 5.8: SELECT without FROM (no data souce)
1-45
Chapter 6: Alias Names in SQL Server
1-46
Section 6.1: Giving alias after Derived table name
1-47
Section 6.2: Using AS
1-48
Section 6.3: Using =
1-49
Section 6.4: Without using AS
1-50
Chapter 7: NULLs
1-51
Section 7.1: COALESCE ()
1-52
Section 7.2: ANSI NULLS
1-53
Section 7.3: ISNULL()
1-54
Section 7.4: Is null / Is not null
1-55
Section 7.5: NULL comparison
1-56
Section 7.6: NULL with NOT IN SubQuery
1-57
Chapter 8: Variables
1-58
Section 8.1: Declare a Table Variable
1-59
Section 8.2: Updating variables using SELECT
1-60
Section 8.3: Declare multiple variables at once, with initial values
1-61
Section 8.4: Updating a variable using SET
1-62
Section 8.5: Updating variables by selecting from a table
1-63
Section 8.6: Compound assignment operators
1-64
Chapter 9: Dates
1-65
Section 9.1: Date & Time Formatting using CONVERT
1-66
Section 9.2: Date & Time Formatting using FORMAT
1-67
Section 9.3: DATEADD for adding and subtracting time periods
1-68
Section 9.4: Create function to calculate a person's age on a specific date
1-69
Section 9.5: Get the current DateTime
1-70
Section 9.6: Getting the last day of a month
1-71
Section 9.7: CROSS PLATFORM DATE OBJECT
1-72
Section 9.8: Return just Date from a DateTime
1-73
Section 9.9: DATEDIFF for calculating time period dierences
1-74
Section 9.10: DATEPART & DATENAME
1-75
Section 9.11: Date parts reference
1-76
Section 9.12: Date Format Extended
1-77
Chapter 10: Generating a range of dates
1-78
Section 10.1: Generating Date Range With Recursive CTE
1-79
Section 10.2: Generating a Date Range With a Tally Table
1-80
Chapter 11: Database Snapshots
1-81
Section 11.1: Create a database snapshot
1-82
Section 11.2: Restore a database snapshot
1-83
Section 11.3: DELETE Snapshot
1-84
Chapter 12: COALESCE
1-85
Section 12.1: Using COALESCE to Build Comma-Delimited String
1-86
Section 12.2: Getting the first not null from a list of column values
1-87
Section 12.3: Coalesce basic Example
1-88
Chapter 13: IF...ELSE
1-89
Section 13.1: Single IF statement
1-90
Section 13.2: Multiple IF Statements
1-91
Section 13.3: Single IF..ELSE statement
1-92
Section 13.4: Multiple IF... ELSE with final ELSE Statements
1-93
Section 13.5: Multiple IF...ELSE Statements
1-94
Chapter 14: CASE Statement
1-95
Section 14.1: Simple CASE statement
1-96
Section 14.2: Searched CASE statement
1-97
Chapter 15: INSERT INTO
1-98
Section 15.1: INSERT multiple rows of data
1-99
Section 15.2: Use OUTPUT to get the new Id
1-100
Section 15.3: INSERT from SELECT Query Results
1-101
Section 15.4: INSERT a single row of data
1-102
Section 15.5: INSERT on specific columns
1-103
Section 15.6: INSERT Hello World INTO table
1-104
Chapter 16: MERGE
1-105
Section 16.1: MERGE to Insert / Update / Delete
1-106
Section 16.2: Merge Using CTE Source
1-107
Section 16.3: Merge Example - Synchronize Source And Target Table
1-108
Section 16.4: MERGE using Derived Source Table
1-109
Section 16.5: Merge using EXCEPT
1-110
Chapter 17: CREATE VIEW
1-111
Section 17.1: CREATE Indexed VIEW
1-112
Section 17.2: CREATE VIEW
1-113
Section 17.3: CREATE VIEW With Encryption
1-114
Section 17.4: CREATE VIEW With INNER JOIN
1-115
Section 17.5: Grouped VIEWs
1-116
Section 17.6: UNION-ed VIEWs
1-117
Chapter 18: Views
1-118
Section 18.1: Create a view with schema binding
1-119
Section 18.2: Create a view
1-120
Section 18.3: Create or replace view
1-121
Chapter 19: UNION
1-122
Section 19.1: Union and union all
1-123
Chapter 20: TRY/CATCH
1-124
Section 20.1: Transaction in a TRY/CATCH
1-125
Section 20.2: Raising errors in try-catch block
1-126
Section 20.3: Raising info messages in try catch block
1-127
Section 20.4: Re-throwing exception generated by RAISERROR
1-128
Section 20.5: Throwing exception in TRY/CATCH blocks
1-129
Chapter 21: WHILE loop
1-130
Section 21.1: Using While loop
1-131
Section 21.2: While loop with min aggregate function usage
1-132
Chapter 22: OVER Clause
1-133
Section 22.1: Cumulative Sum
1-134
Section 22.2: Using Aggregation functions with OVER
1-135
Section 22.3: Dividing Data into equally-partitioned buckets using NTILE
1-136
Section 22.4: Using Aggregation funtions to find the most recent records
1-137
Chapter 23: GROUP BY
1-138
Section 23.1: Simple Grouping
1-139
Section 23.2: GROUP BY multiple columns
1-140
Section 23.3: GROUP BY with ROLLUP and CUBE
1-141
Section 23.4: Group by with multiple tables, multiple columns
1-142
Section 23.5: HAVING
1-143
Chapter 24: ORDER BY
1-144
Section 24.1: Simple ORDER BY clause
1-145
Section 24.2: ORDER BY multiple fields
1-146
Section 24.3: Custom Ordering
1-147
Section 24.4: ORDER BY with complex logic
1-148
Chapter 25: The STUFF Function
1-149
Section 25.1: Using FOR XML to Concatenate Values from Multiple Rows
1-150
Section 25.2: Basic Character Replacement with STUFF()
1-151
Section 25.3: Basic Example of STUFF() function
1-152
Section 25.4: stu for comma separated in sql server
1-153
Section 25.5: Obtain column names separated with comma (not a list)
1-154
Chapter 26: JSON in SQL Server
1-155
Section 26.1: Index on JSON properties by using computed columns
1-156
Section 26.2: Join parent and child JSON entities using CROSS APPLY OPENJSON
1-157
Section 26.3: Format Query Results as JSON with FOR JSON
1-158
Section 26.4: Parse JSON text
1-159
Section 26.5: Format one table row as a single JSON object using FOR JSON
1-160
Section 26.6: Parse JSON text using OPENJSON function
1-161
Chapter 27: OPENJSON
1-162
Section 27.1: Transform JSON array into set of rows
1-163
Section 27.2: Get key:value pairs from JSON text
1-164
Section 27.3: Transform nested JSON fields into set of rows
1-165
Section 27.4: Extracting inner JSON sub-objects
1-166
Section 27.5: Working with nested JSON sub-arrays
1-167
Chapter 28: FOR JSON
1-168
Section 28.1: FOR JSON PATH
1-169
Section 28.2: FOR JSON PATH with column aliases
1-170
Section 28.3: FOR JSON clause without array wrapper (single object in output)