Mastering SQL: Part 4: LIKE, WITH

Learning SQL

Using SQL

Mastering SQL

Structured Query Language (SQL) is a declarative programming language used for accessing data storied in relational databases. It appears in or is a core part of many common software packages like MySQL, PostgreSQL, Microsoft SQL Server, and Oracle Database.

To help retrieve, organize, and sort data, there are a large number of keywords connected to using SELECT statements. Many of these are also used with UPDATE and DELETE to help work on only those rows and columns needed.


The LIKE keyword compares similar values. Instead of finding an exact value, the LIKE keyword is used to find values that might match the value submitted.

FROM Books
WHERE Author LIKE 'Jemisin'


To work with the LIKE keyword, there are some special characters used to find similar values.

  • “%”: Representing one or more characters.
  • “_”: Representing a single character
FROM Books
WHERE Author LIKE '%Jemisin'


The WITH keyword allows a query to have a sub-query. Often paired with the keyword AS, the results of a SELECT statement can be combined into a more complex statement where one query feeds into another.

WITH temporaryTable (ID, Name) 
WHERE OrderNumber = '4567'

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.