This collection of SQL code snippets ranges from Select to Exist. Find the data you need as quickly as possible with this set of super useful SQL code snippets.
Add to PiecesSQL has a lot of repetitive statements, and with the following SQL command list, you will be able to grab many common SQL operations to make your ability to grab data even quicker!
When adding any of the following SQL developer snippets to Pieces, developers will receive relevant tags for easy and fast search in Pieces, a description for context, and related links.
Tags: sql, select
Use the select SQL command to select data from a table.
Related links:
Tags: sql, order by
Use the SQL order by command to sort the result-set in ascending or descending order.
Related links:
Tags: sql, select, distinct
The select distinct command in SQL is used to return only distinct values.
Related links:
Tags: sql, and
This sample SQL code displays a record if all the conditions separated by AND are true.
Related links:
Tags: sql, or
The OR command in SQL displays a record if any of the conditions separated by OR is TRUE.
Related links:
Tags: sql, not
This NOT SQL sample code snippet displays a record if the condition(s) is NOT TRUE.
Related links:
Tags: sql, insert into
This SQL code snippet inserts new records into a table.
Related links:
Tags: sql, update
The Update command in SQL is used to modify the existing records in a table.
Related links:
Tags: sql, delete
The Delete command in SQL is used to delete existing records in a table.
Related links:
Tags: sql, count
The Count command in SQL returns the number of rows that matches a specified criterion.
Related links:
Tags: sql, average, avg
The Avg command in SQL returns the average value of a numeric column.
Related links:
Tags: sql, sum
The Sum command in SQL returns the total sum of a numeric column.
Related links:
Tags: sql, like
The Like command in SQL is used to search for a specified pattern in a column.
Related links:
Tags: sql, in
The IN command in SQL allows you to specify multiple values in a WHERE clause.
Related links:
Tags: sql, between
The Between command in SQL selects values within a given range.
Related links:
Tags: sql, inner join
The Inner Join Command in SQL selects records that have matching values in both tables.
Related links:
Tags: sql, left join
The Left Join command in SQL returns all records from the left table and the matching records from the right table. The result is no records from the right side if there is not a match.
Related links:
Tags: sql, right join
The right join command in SQL returns all records from the right table and the matching records from the left table. The result is no records from the left side if there is not a match.
Related links:
Tags: sql, full join
The Full Join SQL command returns all records when there is a match in left or right table records.
Related links:
Tags: sql, self join
The Self Join SQL command is a regular join but the table is joined with itself.
Related links:
Tags: sql, group by
The Group By command in SQL groups rows that have the same values into summary rows.
Related links:
Tags: sql, union
The Union command in SQL is used to combine the result-set of two or more SELECT statements.
Related links:
Tags: sql, having
The Having command in SQL specifies conditions that filter which group results appear in the results.
Related links:
Tags: sql, exists
The Exists Command in SQL tests for the existence of any record in a subquery.
Related links:
Tags: sql, database, create
Use the SQL create DB Command to create a new SQL database.
Related links:
Tags: sql, table, create
Use this SQL snippet to create a new table.
Related links:
Want to use these SQL code snippets in your IDE? Download our IntelliJ plugin or VS Code extension to create your own SQL code snippet library and improve your developer productivity wherever you code.
Let us know what you think! Would you like to see other useful SQL code snippets not listed on this page? Suggest a collection you’d like to see to help other developers speed up their workflows.