Examples of basic SQL commands and statements, simple queries.
- Concatenate in SQL Server
- Convert rows to columns using CTE
- Convert rows to columns using PIVOT
- Create table
- Create Temporary Table
- Create Table with Primary Key
- Create Table with Foreign Key
- Create Table with Primary Key autoincrement
- Create Table with Primary key and Foreign key
- Check if table exists
- Check if column exists in a table
- Check if column is not null or empty
- Check if row exists in table
- Check if index exists on column
- Check if string contains letters
- Date format DD-MM-YYYY
- Declare variable date
- Declare variable string
- Declare variable table
- Insert multiple rows
- Find duplicates rows
- Delete duplicates rows
- Drop table if exists
- Select records from a table
- Select from two tables
- How to add second to date
- How to add minute to date
- How to add hour to date
- How to add days to date
- How to add month to date
- How to add year to date
- How to extract data from an XML column
- How to list all nodes from an XML column
- How to insert XML into SQL table
- How to find percentage
- Get date difference
- Get month from date
- Get total number of rows
- Remove first n characters from string or column
- Convert SQL to JSON in SQL Server
- Split JSON data in a SQL Server columns
- Store JSON data in SQL Server
- Using Where clause with Order by
- XML SELECT child nodes dynamically
- SQL examples
- SQL Server examples