Introduction To SQL
Introduction To SQL
The FULL JOIN keyword returns all the rows from the
left table (Persons), and all the rows from the right
table (Orders). If there are rows in "Persons" that do
not have matches in "Orders", or if there are rows in
"Orders" that do not have matches in "Persons",
those rows will be listed as well.
"Employees_Norway":E_ID E_Name
01 Hansen, Ola
02 Svendson, Tove
03 Svendson, Stephen
04 Pettersen, Kari
"Employees_USA":E_ID E_Name
01 Turner, Sally
02 Kent, Clark
03 Svendson, Stephen
04 Scott, Stephen
ResultE_Name
Hansen, Ola
Svendson, Tove
Svendson, Stephen
Pettersen, Kari
Turner, Sally
Kent, Clark
Svendson, Stephen
Scott, Stephen
The users cannot see the indexes, they are just used
to speed up searches/queries.
SQL Views
Oracle
Oracle does not have an ISNULL() function.
However, we can use the NVL() function to achieve
the same result:SELECT
ProductName,UnitPrice*(UnitsInStock+NVL(UnitsOn
Order,0))
FROM Products
MySQL
SQL Functions
SQL has many built-in functions for performing
calculations on data.
SQL Aggregate Functions
Parameter Description
column_name Required. The field to extract
characters from
start Required. Specifies the starting position
(starts at 1)
length Optional. The number of characters to
return. If omitted, the MID() function returns the rest
of the text
Parameter Description
column_name Required. The field to round.
decimals Required. Specifies the number of
decimals to be returned.
SQL ROUND() Example
Parameter Description
column_name Required. The field to be formatted.
format Required. Specifies the format.
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
or
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
Source :
http://www.w3schools.com/sql/sql_quickref.asp
SQL Hosting
SQL Hosting
MS SQL Server
MySQL