SQL Quick Reference

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

8/24/2010 SQL Quick Reference

Search W3Schools Se a rch

HOME HTML CSS XML JA VA SCRIPT A SP PHP SQL MORE... References Examples Forum A bout

YOUR FREE WEBSITE

Free Flash Website


Free Website Builder
Free Web Design

SQL Basic WEB HOSTING


SQL HOME
SQL Quick Reference From W3Schools Best Web Hosting
SQL Intro
SQL Syntax « Previous Next Chapter » PHP MySQL Hosting
SQL Select Top 10 Web Hosting
SQL Distinct SQL Statement Syntax
SQL Where UK Reseller Hosting
SQL And & Or AND / OR SELEC T column_name(s)
FROM table_name Web Hosting
SQL Order By
SQL Insert WHERE condition Top Web Hosting
SQL Update AND|OR condition
SQL Delete $0 Web Hosting
ALTER TABLE ALTER TABLE table_name
ADD column_name datatype
SQL Demo WEB BUILDING
SQL Try It or Download XML Editor
ALTER TABLE table_name FREE Flash Website
SQL Advanced
DROP C OLUMN column_name
SQL Top SEO C ompany
SQL Like
SQL Wildcards AS (alias) SELEC T column_name AS column_alias W3SCHOOLS EXAMS
SQL In FROM table_name
Get C ertified in:
SQL Between
or HTML, C SS, JavaScript,
SQL Alias
XML, PHP, and ASP
SQL Joins SELEC T column_name
SQL Inner Join FROM table_name AS table_alias W3SCHOOLS BOOKS
SQL Left Join
SQL Right Join New Books:
SQL Full Join BETWEEN SELEC T column_name(s) HTML, C SS
SQL Union FROM table_name JavaScript, and Ajax
SQL Select Into WHERE column_name
SQL C reate DB BETWEEN value1 AND value2
STATISTICS
SQL C reate Table C REATE DATABASE C REATE DATABASE database_name
SQL C onstraints Browser Statistics
SQL Not Null C REATE TABLE C REATE TABLE table_name Browser OS
SQL Unique ( Browser Display
SQL Primary Key column_name1 data_type,
SQL Foreign Key column_name2 data_type, SHARE THIS PAGE
SQL C heck column_name2 data_type,
Share with »
SQL Default ...
SQL C reate Index )
SQL Drop C REATE INDEX C REATE INDEX index_name
SQL Alter ON table_name (column_name)
SQL Increment
SQL Views or
SQL Dates
SQL Nulls C REATE UNIQUE INDEX index_name
SQL isnull() ON table_name (column_name)
SQL Data Types
C REATE VIEW C REATE VIEW view_name AS
SQL Functions SELEC T column_name(s)
SQL Functions FROM table_name
SQL avg() WHERE condition
SQL count()
DELETE DELETE FROM table_name
SQL first()
WHERE some_column=some_value
SQL last()
SQL max() or
SQL min()
SQL sum() DELETE FROM table_name
SQL Group By (Note: Deletes the entire table!!)
SQL Having
SQL ucase() DELETE * FROM table_name
SQL lcase() (Note: Deletes the entire table!!)
SQL mid()
SQL len()
DROP DATABASE DROP DATABASE database_name
SQL round()
SQL now() DROP INDEX DROP INDEX table_name.index_name (SQL Server)
SQL format() DROP INDEX index_name ON table_name (MS Access)
DROP INDEX index_name (DB2/Oracle)
SQL Quick Ref ALTER TABLE table_name
SQL Hosting DROP INDEX index_name (MySQL)
SQL Summary
DROP TABLE DROP TABLE table_name
SQL Quiz GROUP BY SELEC T column_name, aggregate_function(column_name)
SQL Quiz FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING SELEC T column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING aggregate_function(column_name) operator value
IN SELEC T column_name(s)

www.w3schools.com/sql/sql_quickref.asp 1/3
8/24/2010 SQL Quick Reference
FROM table_name
WHERE column_name
IN (value1,value2,..)
INSERT INTO INSERT INTO table_name
VALUES (value1, value2, value3,....)

or

INSERT INTO table_name


(column1, column2, column3,...)
VALUES (value1, value2, value3,....)

INNER JOIN SELEC T column_name(s)


FROM table_name1
INNER JOIN table_name2
ON table_name1.column_name=table_name2.column_name
LEFT JOIN SELEC T column_name(s)
FROM table_name1
LEFT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
RIGHT JOIN SELEC T column_name(s)
FROM table_name1
RIGHT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
FULL JOIN SELEC T column_name(s)
FROM table_name1
FULL JOIN table_name2
ON table_name1.column_name=table_name2.column_name
LIKE SELEC T column_name(s)
FROM table_name
WHERE column_name LIKE pattern
ORDER BY SELEC T column_name(s)
FROM table_name
ORDER BY column_name [ASC |DESC ]
SELEC T SELEC T column_name(s)
FROM table_name
SELEC T * SELEC T *
FROM table_name
SELEC T DISTINC T SELEC T DISTINC T column_name(s)
FROM table_name
SELEC T INTO SELEC T *
INTO new_table_name [IN externaldatabase]
FROM old_table_name

or

SELEC T column_name(s)
INTO new_table_name [IN externaldatabase]
FROM old_table_name

SELEC T TOP SELEC T TOP number|percent column_name(s)


FROM table_name
TRUNC ATE TABLE TRUNC ATE TABLE table_name
UNION SELEC T column_name(s) FROM table_name1
UNION
SELEC T column_name(s) FROM table_name2
UNION ALL SELEC T column_name(s) FROM table_name1
UNION ALL
SELEC T column_name(s) FROM table_name2
UPDATE UPDATE table_name
SET column1=value, column2=value,...
WHERE some_column=some_value
WHERE SELEC T column_name(s)
FROM table_name
WHERE column_name operator value

Source : http://www.w3schools.com/sql/sql_quickref.asp

« Previous Next Chapter »

Free Online Website Builder - No Downloading Needed


C reate a free Flash website with our simple, online web design editing platform. Stunning templates and user-
friendly tools make website building easy and fun.

Start C reating your free website now!

Altova® XMLSpy® - The industry's leading XML editor!

Whether you're new to XML or already an advanced user, the user-friendly views and powerful entry helpers,
wizards, and debuggers in XMLSpy are designed to meet your XML and Web development needs from start to
finish. New features in Version 2010!

www.w3schools.com/sql/sql_quickref.asp 2/3
8/24/2010 SQL Quick Reference

XML editor
Graphical XML Schema / DTD editors
XSLT 1.0/2.0 editor, debugger, profiler
XQuery editor, debugger, profiler
XBRL validator, taxonomy editor, taxonomy wizard
Support for Office Open XML (OOXML)
Graphical WSDL 1.1/2.0 editor & SOAP debugger
JSON editing & conversion
Java, C #, C ++ code generation
32-bit and 64-bit versions
And much more!

Download a free trial today!

SQLserver on VMware
Use Veloxum to improve performance
immediately, Free Trial
youtube.com/kscruzen

HO ME | TO P | P RINT | FO RUM | ABO UT

W3Schools is for training only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user.
While using this site, you agree to have read and accepted our terms of use and privacy policy.
C opyright 1999-2010 by Refsnes Data. All Rights Reserved.

www.w3schools.com/sql/sql_quickref.asp 3/3

You might also like