This document provides SQL syntax examples for common SQL statements including SELECT, INSERT, UPDATE, DELETE, ALTER TABLE, CREATE TABLE, JOIN, WHERE and more. Each statement is listed along with its basic syntax structure to retrieve, manipulate and manage data within database tables.
This tutorial will give you a quick start to SQL including examples. It covers most of the topics required for a basic understanding of SQL and to get a feel of how it works.
This tutorial will give you a quick start to SQL including examples. It covers most of the topics required for a basic understanding of SQL and to get a feel of how it works.
Fastest way to revise for the a business analyst interview. A compact yet comprehensive guide to SQL commands, Joins, examples, syntax, data types and lot more...
Here is the list of all important MySQL functions. Each function has been explained along with suitable example.
*
MySQL Group By Clause - The MySQL GROUP BY statement is used along with the SQL aggregate functions like SUM to provide means of grouping the result dataset by certain database table column(s).
*
MySQL IN Clause - This is a clause which can be used alongwith any MySQL query to specify a condition.
*
MySQL BETWEEN Clause - This is a clause which can be used alongwith any MySQL query to specify a condition.
*
MySQL UNION Keyword - Use a UNION operation to combine multiple result sets into one.
*
MySQL COUNT Function - The MySQL COUNT aggregate function is used to count the number of rows in a database table.
*
MySQL MAX Function - The MySQL MAX aggregate function allows us to select the highest (maximum) value for a certain column.
*
MySQL MIN Function - The MySQL MIN aggregate function allows us to select the lowest (minimum) value for a certain column.
*
MySQL AVG Function - The MySQL AVG aggregate function selects the average value for certain table column.
*
MySQL SUM Function - The MySQL SUM aggregate function allows selecting the total for a numeric column.
*
MySQL SQRT Functions - This is used to generate a square root of a given number.
*
MySQL RAND Function - This is used to generate a random number using MySQL command.
*
MySQL CONCAT Function - This is used to concatenate any string inside any MySQL command.
*
MySQL DATE and Time Functions - Complete list of MySQL Date and Time related functions.
*
MySQL Numeric Functions - Complete list of MySQL functions required to manipulate numbers in MySQL.
*
MySQL String Functions - Complete list of MySQL functions required to manipulate strings in MySQL.
A. Table Basic Data Types- Char, varchar/varchar2, long, number, Fixed Commands to create table Commands for table handling- Alter table, Drop table, Insert records B. Commands for record handling Update, Delete Select with operators like arithmetic, comparison, logical Query Expression operators Ordering the records with orderby Grouping the records C. SQL functions Date, Numeric, Character, conversion Group functions avg, max, min, sum, count Set operations- Union, Union all, intersect, minu
This is a word file for SQL COMMANDS and including some basic information regarding SQL. I hope it will help you a lot while doing SQL and its functions and commands.
An tutorial for sql learners in very easy way. It contains all the sql commands like ddl, dml, etc. with suitable examples.
at the end there are 3 sets of question with their solution with explanation. each set contains 40+ questions.
Game Design Course Development Panel at the Foundations of Digital Games Conference held on a Royal Caribbean cruise to Cozumel, Mexico. The panel speakers were Dr. Ken Hoganson, Dr. Cynthia Calongne, Dr. Mario Guimaraes (our mastermind) and Dr. Barbara Truman. Dr. Jing (Selena) He was unable to join us. Slides by Dr. Calongne from her games and simulation design classes with Dr. Andrew Stricker at Colorado Technical University.
Fastest way to revise for the a business analyst interview. A compact yet comprehensive guide to SQL commands, Joins, examples, syntax, data types and lot more...
Here is the list of all important MySQL functions. Each function has been explained along with suitable example.
*
MySQL Group By Clause - The MySQL GROUP BY statement is used along with the SQL aggregate functions like SUM to provide means of grouping the result dataset by certain database table column(s).
*
MySQL IN Clause - This is a clause which can be used alongwith any MySQL query to specify a condition.
*
MySQL BETWEEN Clause - This is a clause which can be used alongwith any MySQL query to specify a condition.
*
MySQL UNION Keyword - Use a UNION operation to combine multiple result sets into one.
*
MySQL COUNT Function - The MySQL COUNT aggregate function is used to count the number of rows in a database table.
*
MySQL MAX Function - The MySQL MAX aggregate function allows us to select the highest (maximum) value for a certain column.
*
MySQL MIN Function - The MySQL MIN aggregate function allows us to select the lowest (minimum) value for a certain column.
*
MySQL AVG Function - The MySQL AVG aggregate function selects the average value for certain table column.
*
MySQL SUM Function - The MySQL SUM aggregate function allows selecting the total for a numeric column.
*
MySQL SQRT Functions - This is used to generate a square root of a given number.
*
MySQL RAND Function - This is used to generate a random number using MySQL command.
*
MySQL CONCAT Function - This is used to concatenate any string inside any MySQL command.
*
MySQL DATE and Time Functions - Complete list of MySQL Date and Time related functions.
*
MySQL Numeric Functions - Complete list of MySQL functions required to manipulate numbers in MySQL.
*
MySQL String Functions - Complete list of MySQL functions required to manipulate strings in MySQL.
A. Table Basic Data Types- Char, varchar/varchar2, long, number, Fixed Commands to create table Commands for table handling- Alter table, Drop table, Insert records B. Commands for record handling Update, Delete Select with operators like arithmetic, comparison, logical Query Expression operators Ordering the records with orderby Grouping the records C. SQL functions Date, Numeric, Character, conversion Group functions avg, max, min, sum, count Set operations- Union, Union all, intersect, minu
This is a word file for SQL COMMANDS and including some basic information regarding SQL. I hope it will help you a lot while doing SQL and its functions and commands.
An tutorial for sql learners in very easy way. It contains all the sql commands like ddl, dml, etc. with suitable examples.
at the end there are 3 sets of question with their solution with explanation. each set contains 40+ questions.
Game Design Course Development Panel at the Foundations of Digital Games Conference held on a Royal Caribbean cruise to Cozumel, Mexico. The panel speakers were Dr. Ken Hoganson, Dr. Cynthia Calongne, Dr. Mario Guimaraes (our mastermind) and Dr. Barbara Truman. Dr. Jing (Selena) He was unable to join us. Slides by Dr. Calongne from her games and simulation design classes with Dr. Andrew Stricker at Colorado Technical University.
SQL stands for Structured Query Language.
SQL is a database management language for relational databases.
SQL lets you access and manipulate databases.
(INNER) JOIN: , LEFT (OUTER) JOIN: ,RIGHT (OUTER) JOIN: , FULL (OUTER) JOIN: , SQL UNION Operator, SQL GROUP BY HAVING statement, The SQL EXISTS Operator, The SQL ANY and ALL Operators, The SQL SELECT INTO Statement, The SQL INSERT INTO SELECT StatementThe SQL INSERT INTO SELECT Statement
1. SQL Statement Syntax
AND / OR SELECT column_name(s)
FROM table_name
WHERE condition
AND|OR condition
ALTER TABLE ALTER TABLE table_name
ADD column_name datatype
or
ALTER TABLE table_name
DROP COLUMN column_name
AS (alias) SELECT column_name AS column_alias
FROM table_name
or
SELECT column_name
FROM table_name AS table_alias
BETWEEN SELECT column_name(s)
FROM table_name
WHERE column_name
BETWEEN value1 AND value2
CREATE DATABASE CREATE DATABASE database_name
CREATE TABLE CREATE TABLE table_name
(
column_name1 data_type,
column_name2 data_type,
column_name2 data_type,
...
)
CREATE INDEX CREATE INDEX index_name
ON table_name (column_name)
or
CREATE UNIQUE INDEX index_name
ON table_name (column_name)
CREATE VIEW CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
2. WHERE condition
DELETE DELETE FROM table_name
WHERE some_column=some_value
or
DELETE FROM table_name
(Note: Deletes the entire table!!)
DELETE * FROM table_name
(Note: Deletes the entire table!!)
DROP DATABASE DROP DATABASE database_name
DROP INDEX DROP INDEX table_name.index_name (SQL Server)
DROP INDEX index_name ON table_name (MS Access)
DROP INDEX index_name (DB2/Oracle)
ALTER TABLE table_name
DROP INDEX index_name (MySQL)
DROP TABLE DROP TABLE table_name
GROUP BY SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING SELECT 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 SELECT column_name(s)
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 SELECT column_name(s)
FROM table_name1
INNER JOIN table_name2
ON table_name1.column_name=table_name2.column_name
LEFT JOIN SELECT column_name(s)
FROM table_name1
LEFT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
RIGHT JOIN SELECT column_name(s)
FROM table_name1
3. RIGHT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
FULL JOIN SELECT column_name(s)
FROM table_name1
FULL JOIN table_name2
ON table_name1.column_name=table_name2.column_name
LIKE SELECT column_name(s)
FROM table_name
WHERE column_name LIKE pattern
ORDER BY SELECT column_name(s)
FROM table_name
ORDER BY column_name [ASC|DESC]
SELECT SELECT column_name(s)
FROM table_name
SELECT * SELECT *
FROM table_name
SELECT DISTINCT SELECT DISTINCT column_name(s)
FROM table_name
SELECT INTO SELECT *
INTO new_table_name [IN externaldatabase]
FROM old_table_name
or
SELECT column_name(s)
INTO new_table_name [IN externaldatabase]
FROM old_table_name
SELECT TOP SELECT TOP number|percent column_name(s)
FROM table_name
TRUNCATE TABLE TRUNCATE TABLE table_name
UNION SELECT column_name(s) FROM table_name1
UNION
SELECT column_name(s) FROM table_name2
UNION ALL SELECT column_name(s) FROM table_name1
UNION ALL
SELECT column_name(s) FROM table_name2
UPDATE UPDATE table_name
SET column1=value, column2=value,...
WHERE some_column=some_value
WHERE SELECT column_name(s)
FROM table_name
WHERE column_name operator value