SQL SERVER CHEAT SHEET -4-

Bartu bozkurt
2 min readJun 17, 2021

--

The SQL HAVING Clause

Customers Table

Lists the number of customers in each country. Only include countries with more than 5 customers

Lists the number of customers in each country, sorted high to low (Only include countries with more than 5 customers)

lists the employees that have registered more than 10 orders

The SQL ORDER BY Keyword

The ORDER BY keyword is used to sort the result-set in ascending or descending order.

The ORDER BY keyword sorts the records in ascending order by default. To sort the records in descending order, use the DESC keyword.

DEMO DATABASE

Customers Table

The SQL LIKE Operator

The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.

  • The percent sign (%) represents zero, one, or multiple characters
  • The underscore sign (_) represents one, single character

SELECT DISTINCT

The SELECT DISTINCT statement is used to return only distinct (different) values.

--

--

Bartu bozkurt
Bartu bozkurt

Written by Bartu bozkurt

blockchain dev, messing with security, analytics, and AI. Contributed over 300 projects

No responses yet