Mastering SQL: Part 3: OR, AS, LIMIT

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.

OR

Like the AND keyword, the OR keyword is used to add more conditional clauses to a SELECT statement.

SELECT Name FROM People WHERE Name = 'Dan' OR Name = Steve

AS

The AS keyword is used to alias a column in some results. It renames a column “as” something else in the query.

SELECT CustomerName AS Customer, ContactName AS [Contact Person]
FROM Customers;

LIMIT

The LIMIT keyword describes the maximum number of results to return.

SELECT Name FROM People WHERE Name = 'Dan' LIMIT 5

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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.