Académique Documents
Professionnel Documents
Culture Documents
YOUR DATA
An intro to Structured Query Language (SQL)
WHO IS RICHARD
MATHIS?
CTO of CHSI Technologies
Min-maxer, constantly looking for the best new thing to eke out
1-2% more performance.
COURSE OBJECTIVES
Crystal Reports
Access
Custom Applications
DATABASE
LAYOUT
Each table is like a
spreadsheet.
We try to avoid
duplicating data
Almost any column
ending with the suffix ID
translates to another table.
Helpful tables included
as a supplement
THE ABCS OF
DATABASES
Tables
Columns
Rows
Primary Keys
ResultSet
CaSe InSeNsItIvItY
SELECT
SELECT
Creates a resultset, usually the contents of a table
Typical Syntax
SELECT columnlist FROM tablename
Columnlist represents one or more columns
separated by commas.
Asterisk (*) can be used as a wildcard to list all
columns.
You dont want ALL the data, just the data you need, thus, the WHERE statement.
Comparison Operators like =, <> (not equal), >, < , >=, <= all work
Like is used for wildcards, almost always with % as a wildcard operator like ch% for all words starting
with ch or %ed for all words ending with ed.
Example: SELECT * FROM clients WHERE clienttype = client and startdate >= 1/1/2015 ORDER BY startdate
You can filter one query into another by using the IN command, like
SELECT * FROM clients WHERE clientid in (SELECT clientid FROM locations WHERE city=jasper)
FORMAT IN SQL