<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-4778812847288789714</atom:id><lastBuildDate>Sun, 08 Sep 2024 17:31:10 +0000</lastBuildDate><category>SQL</category><category>Totorial</category><category>Statement</category><category>Select</category><category>Database</category><category>Table</category><category>Create</category><category>DELETE</category><category>Index</category><category>Syntax</category><category>ALTER</category><category>AND</category><category>Alias</category><category>BETWEEN</category><category>Clause</category><category>DBMS</category><category>Drop</category><category>Functions</category><category>GROUP BY</category><category>HAVING</category><category>IN</category><category>INSERT</category><category>INSERT INTO</category><category>INTO</category><category>Introduction</category><category>JOIN</category><category>OR</category><category>ORDER BY</category><category>Quick</category><category>RDBMS</category><category>Reference</category><category>SELECT INTO</category><category>Summary</category><category>Truncate</category><category>UNION</category><category>Update</category><category>VIEW</category><category>Where</category><category>home</category><category>start</category><title>SQL Tutorial</title><description>SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.</description><link>http://thesqltutorial.blogspot.com/</link><managingEditor>noreply@blogger.com (karnoi)</managingEditor><generator>Blogger</generator><openSearch:totalResults>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><language>en-us</language><itunes:explicit>no</itunes:explicit><itunes:keywords>SQL,Tutorial</itunes:keywords><itunes:summary>SQL is a standard computer language for accessing and manipulating databases. In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.</itunes:summary><itunes:subtitle>SQL is a standard computer language for accessing and manipulating databases. In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.</itunes:subtitle><itunes:category text="Education"><itunes:category text="Training"/></itunes:category><itunes:owner><itunes:email>noreply@blogger.com</itunes:email></itunes:owner><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-214050570035332926</guid><pubDate>Wed, 21 May 2008 09:43:00 +0000</pubDate><atom:updated>2008-05-21T02:49:22.906-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">home</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL HOME</title><description>&lt;h2 class="tutheader"&gt;SQL Tutorial&lt;/h2&gt;  &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td valign="middle" width="150"&gt;&lt;img src="http://www.w3schools.com/sql/SQL2.gif" alt="SQL" border="0" height="77" width="94" /&gt;&lt;/td&gt; &lt;td valign="top"&gt; &lt;p&gt;&lt;b&gt;SQL is a standard computer language for accessing and manipulating  databases.&lt;/b&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;In this tutorial you will learn how to use SQL to access and manipulate data in Oracle,  Sybase, SQL Server, DB2, Access, and other database systems.&lt;/b&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/introduction-to-sql.html"&gt;&lt;b&gt;Start learning SQL now!&lt;/b&gt;&lt;/a&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;h2 class="tutheader"&gt;Table Of Content&lt;/h2&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/introduction-to-sql.html"&gt;SQL Intro&lt;/a&gt;&lt;br /&gt;An introduction to SQL.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-select-statement.html"&gt;SQL SELECT&lt;/a&gt;&lt;br /&gt;How the SELECT statement is used to select data from a database.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-where-clause.html"&gt;SQL WHERE&lt;/a&gt;&lt;br /&gt;How the WHERE clause is used to conditionally select data.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-insert-into-statement.html"&gt;SQL INSERT INTO&lt;/a&gt;&lt;br /&gt;How the INSERT INTO statement inserts new records (rows) into a database table.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-update-statement.html"&gt;SQL UPDATE&lt;/a&gt;&lt;br /&gt;How to modify data in a database using the UPDATE statement.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-delete-statement.html"&gt;SQL DELETE&lt;/a&gt;&lt;br /&gt;How to delete records (rows) in a database, using the DELETE statement.&lt;/p&gt;&lt;br /&gt;&lt;h2 class="tutheader"&gt;SQL Advanced&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-order-by.html"&gt;SQL ORDER BY&lt;/a&gt;&lt;br /&gt;The ORDER BY keyword is used to sort the result.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-and-or.html"&gt;SQL AND &amp;amp; OR&lt;/a&gt;&lt;br /&gt;AND and OR join two or more conditions in a WHERE clause.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-in.html"&gt;SQL IN&lt;/a&gt;&lt;br /&gt;The IN operator may be used if you know the exact value(s) to search for.&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-between.html"&gt;SQL BETWEEN&lt;/a&gt;&lt;br /&gt;The BETWEEN operator selects a range of data between two values.&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-alias.html"&gt;SQL ALIAS&lt;/a&gt;&lt;br /&gt;Aliases can be used for column names and table names.&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-join.html"&gt;SQL JOIN&lt;/a&gt;&lt;br /&gt;How to use the JOIN operator to select data from two or more tables. &lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-union-and-union-all.html"&gt;SQL UNION&lt;/a&gt;&lt;br /&gt;The UNION operator is used to select related information from two tables.&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-create-database-table-and-index.html"&gt;SQL CREATE&lt;/a&gt;&lt;br /&gt;How to create a new database and / or a new database table.&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-drop-index-table-and-database.html"&gt;SQL DROP&lt;/a&gt;&lt;br /&gt;How to drop (delete) a database and /or a database table.&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-alter-table.html"&gt;SQL ALTER&lt;/a&gt;&lt;br /&gt;How to user ALTER to add or delete table columns.&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-functions.html"&gt;SQL Functions&lt;/a&gt;&lt;br /&gt;SQL has a lot of built-in functions for counting and calculations.&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-group-by-and-having.html"&gt;SQL GROUP BY&lt;/a&gt;&lt;br /&gt;How to use GROUP BY to group aggregated data.&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-select-into-statement.html"&gt;SQL SELECT INTO&lt;/a&gt;&lt;br /&gt;How to use SELECT INTO to save selected data in tables (create backup copies).&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-create-view-statement.html"&gt;SQL CREATE VIEW&lt;/a&gt;&lt;br /&gt;How to create a virtual table using CREATE VIEW.&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-servers-rdbms.html"&gt;SQL Server&lt;/a&gt;&lt;br /&gt;About Database Management Systems (DBMS).&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-quick-reference.html"&gt;SQL Quick Reference&lt;/a&gt;&lt;br /&gt;An SQL Quick Reference. Print it, fold it, and put it in your pocket.&lt;/p&gt; &lt;p&gt;&lt;a href="http://thesqltutorial.blogspot.com/2008/05/sql-summary.html"&gt;SQL Summary&lt;/a&gt;&lt;br /&gt;A summary of this tutorial.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-home_21.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-7120735652015047785</guid><pubDate>Wed, 21 May 2008 09:31:00 +0000</pubDate><atom:updated>2008-05-21T02:31:36.827-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Summary</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL Summary</title><description>&lt;p&gt;This tutorial has taught you the standard computer language for accessing and manipulating database  systems.&lt;/p&gt; &lt;p&gt;You have learned how to execute queries, retrieve data, insert new records,  delete records and update records in a database with SQL.&lt;/p&gt; &lt;p&gt;SQL is a standard language that works  with database programs like MS Access, DB2, Informix, MS SQL Server, Oracle,  MySQL,  Sybase, and other database systems.&lt;/p&gt; &lt;hr /&gt; &lt;h2&gt;Now You Know SQL, What's Next?&lt;/h2&gt; &lt;p&gt;The next step is to learn ADO.&lt;/p&gt; &lt;p&gt;ADO is a programming interface to access data in a database from a web site.&lt;/p&gt; &lt;p&gt;ADO uses SQL to query data in a database.&lt;/p&gt; &lt;p&gt;If you want to learn more about ADO, please  visit our &lt;a href="http://www.w3schools.com/ado/default.asp"&gt;ADO tutorial&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-summary.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-5388401133791711605</guid><pubDate>Wed, 21 May 2008 09:27:00 +0000</pubDate><atom:updated>2008-05-21T02:28:25.400-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Quick</category><category domain="http://www.blogger.com/atom/ns#">Reference</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Statement</category><category domain="http://www.blogger.com/atom/ns#">Syntax</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL Quick Reference</title><description>&lt;hr /&gt; &lt;p class="intro"&gt;SQL Quick Reference from W3Schools. Print it, and fold it in your pocket.&lt;/p&gt; &lt;hr /&gt;  &lt;h3&gt;SQL Syntax&lt;/h3&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left" valign="top" width="35%"&gt;Statement&lt;/th&gt;       &lt;th align="left" valign="top" width="65%"&gt;Syntax&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;AND / OR&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT column_name(s)&lt;br /&gt;  FROM table_name&lt;br /&gt;  WHERE condition&lt;br /&gt;  AND|OR condition&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;ALTER TABLE (add column)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;ALTER TABLE table_name&lt;br /&gt;  ADD column_name datatype&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;ALTER TABLE (drop column)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;ALTER TABLE table_name&lt;br /&gt;  DROP COLUMN column_name&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;AS (alias for column)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT column_name AS column_alias&lt;br /&gt;  FROM table_name&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;AS (alias for table)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT column_name&lt;br /&gt;  FROM table_name  AS table_alias&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;BETWEEN&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT column_name(s)&lt;br /&gt;  FROM table_name&lt;br /&gt;  WHERE column_name&lt;br /&gt;  BETWEEN value1 AND value2&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;CREATE DATABASE&lt;/td&gt;       &lt;td align="left" valign="top"&gt;CREATE DATABASE database_name&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;CREATE INDEX&lt;/td&gt;       &lt;td align="left" valign="top"&gt;CREATE INDEX index_name&lt;br /&gt;  ON table_name (column_name)&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;CREATE TABLE&lt;/td&gt;       &lt;td align="left" valign="top"&gt;CREATE TABLE table_name&lt;br /&gt;  (&lt;br /&gt;  column_name1 data_type,&lt;br /&gt;  column_name2 data_type,&lt;br /&gt;  .......&lt;br /&gt;  )&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;CREATE UNIQUE INDEX&lt;/td&gt;       &lt;td align="left" valign="top"&gt;CREATE UNIQUE INDEX index_name&lt;br /&gt;  ON table_name (column_name)&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;CREATE VIEW&lt;/td&gt;       &lt;td align="left" valign="top"&gt;CREATE VIEW view_name AS&lt;br /&gt;  SELECT column_name(s)&lt;br /&gt;  FROM table_name&lt;br /&gt;  WHERE condition&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;DELETE FROM&lt;/td&gt;       &lt;td align="left" valign="top"&gt;DELETE FROM table_name&lt;br /&gt;  (&lt;b&gt;Note: &lt;/b&gt;Deletes the entire table!!)&lt;p&gt;&lt;i&gt;or&lt;/i&gt;&lt;/p&gt;   &lt;p&gt;DELETE FROM table_name&lt;br /&gt;  WHERE condition&lt;/p&gt;&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;DROP DATABASE&lt;/td&gt;       &lt;td align="left" valign="top"&gt;DROP DATABASE database_name&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;DROP INDEX&lt;/td&gt;       &lt;td align="left" valign="top"&gt;DROP INDEX table_name.index_name&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;DROP TABLE&lt;/td&gt;       &lt;td align="left" valign="top"&gt;DROP TABLE table_name&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;GROUP BY&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT column_name1,SUM(column_name2)&lt;br /&gt;  FROM table_name&lt;br /&gt;  GROUP BY column_name1&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;HAVING&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT column_name1,SUM(column_name2)&lt;br /&gt;  FROM table_name&lt;br /&gt;  GROUP BY column_name1&lt;br /&gt;  HAVING SUM(column_name2) condition value&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;IN&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT column_name(s)&lt;br /&gt;  FROM table_name&lt;br /&gt;  WHERE column_name&lt;br /&gt;  IN (value1,value2,..)&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;INSERT INTO&lt;/td&gt;       &lt;td align="left" valign="top"&gt;INSERT INTO table_name&lt;br /&gt;  VALUES (value1, value2,....)&lt;p&gt;&lt;i&gt;or&lt;/i&gt;&lt;/p&gt;   &lt;p&gt;INSERT INTO table_name&lt;br /&gt;  (column_name1, column_name2,...)&lt;br /&gt;  VALUES (value1, value2,....)&lt;/p&gt;&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;LIKE&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT column_name(s)&lt;br /&gt;  FROM table_name&lt;br /&gt;  WHERE column_name&lt;br /&gt;  LIKE pattern&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;ORDER BY&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT column_name(s)&lt;br /&gt;  FROM table_name&lt;br /&gt;  ORDER BY column_name [ASC|DESC]&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;SELECT&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT column_name(s)&lt;br /&gt;  FROM table_name&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;SELECT *&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT *&lt;br /&gt;  FROM table_name&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;SELECT DISTINCT&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT DISTINCT column_name(s)&lt;br /&gt;  FROM table_name&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;SELECT INTO&lt;br /&gt;  (used to create backup copies of    tables)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT *&lt;br /&gt;  INTO new_table_name&lt;br /&gt;  FROM original_table_name&lt;p&gt;&lt;i&gt;or&lt;/i&gt;&lt;/p&gt;   &lt;p&gt;SELECT column_name(s)&lt;br /&gt;  INTO new_table_name&lt;br /&gt;  FROM original_table_name&lt;/p&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;TRUNCATE TABLE&lt;br /&gt;  (deletes only the data inside    the table)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;TRUNCATE TABLE table_name&lt;/td&gt;     &lt;/tr&gt;  &lt;tr&gt;       &lt;td align="left" valign="top"&gt;UPDATE&lt;/td&gt;       &lt;td align="left" valign="top"&gt;UPDATE table_name&lt;br /&gt;  SET column_name=new_value&lt;br /&gt;  [, column_name=new_value]&lt;br /&gt;  WHERE column_name=some_value&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;WHERE&lt;/td&gt;       &lt;td align="left" valign="top"&gt;SELECT column_name(s)&lt;br /&gt;  FROM table_name&lt;br /&gt;  WHERE condition&lt;/td&gt;     &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Source : http://www.w3schools.com/sql/sql_quickref.asp&lt;/b&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-quick-reference.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-880372663984643920</guid><pubDate>Wed, 21 May 2008 09:26:00 +0000</pubDate><atom:updated>2008-05-21T02:27:08.334-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Database</category><category domain="http://www.blogger.com/atom/ns#">DBMS</category><category domain="http://www.blogger.com/atom/ns#">RDBMS</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL Servers - RDBMS</title><description>&lt;hr /&gt;  &lt;p class="intro"&gt;Modern SQL Servers are built on RDBMS.&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;DBMS - Database Management System&lt;/h2&gt; &lt;p&gt;A Database Management System (DBMS) is a computer program that can access  data in a database.&lt;/p&gt; &lt;p&gt;The DBMS program enables you to extract, modify, or store information in a  database.&lt;/p&gt; &lt;p&gt;Different DBMS programs provides different functions for querying data,  reporting data, and modifying data. &lt;br /&gt;&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;RDBMS - Relational Database Management System&lt;/h2&gt; &lt;p&gt;A Relational Database Management System (RDBMS) is a Database Management  System (DBMS) where the database is organized and accessed according to the relationships  between data.&lt;/p&gt; &lt;p&gt;RDBMS was invented by IBM in the early 1970's.&lt;/p&gt; RDBMS is the basis for SQL, and for all modern database systems like Oracle,  SQL Server, IBM DB2, Sybase, MySQL, and Microsoft Access.&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-servers-rdbms.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-1304462097865196036</guid><pubDate>Wed, 21 May 2008 09:25:00 +0000</pubDate><atom:updated>2008-05-21T02:26:10.694-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Create</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Statement</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><category domain="http://www.blogger.com/atom/ns#">VIEW</category><title>SQL CREATE VIEW Statement</title><description>&lt;p class="intro"&gt;A view is a virtual table based on the result-set of a SELECT  statement.&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;What is a View?&lt;/h2&gt; &lt;p&gt;In SQL, a VIEW is a virtual table based on the result-set of a SELECT  statement.&lt;/p&gt; &lt;p&gt;A view contains rows and columns, just like a real table. The fields in a view  are fields from one or more real tables in the database. You can add SQL  functions, WHERE, and JOIN statements to a view and present the data as if the data were  coming from a single table.&lt;/p&gt; &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; The database design and structure will NOT be affected by the  functions, where, or join statements in a view.&lt;/p&gt; &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="ex" id="table5" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;CREATE VIEW view_name AS&lt;br /&gt;SELECT column_name(s)&lt;br /&gt;FROM table_name&lt;br /&gt;WHERE condition&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; The database does not store the view data! The database engine  recreates the data, using the view's SELECT statement, every time a user queries  a view. &lt;/p&gt; &lt;hr /&gt; &lt;h2&gt;Using Views&lt;/h2&gt; &lt;p&gt;A view could be used from inside a query, a stored  procedure, or from inside another view. By adding functions, joins, etc., to a view, it allows you to present  exactly the data you want to the user.&lt;/p&gt; &lt;p&gt;The sample database Northwind has some views installed by default. The  view "Current Product List" lists all active products (products that are not  discontinued) from the Products table. The view is created with the following  SQL:&lt;/p&gt;  &lt;table class="ex" id="table13" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;CREATE VIEW [Current Product List] AS&lt;br /&gt;SELECT ProductID,ProductName&lt;br /&gt;FROM Products&lt;br /&gt;WHERE Discontinued=No&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;We can query the view above as follows:&lt;/p&gt;  &lt;table class="ex" id="table14" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT * FROM [Current Product List]&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Another view from the Northwind sample database selects every product in the Products table that has a unit price  that is higher than the average unit price:&lt;/p&gt;  &lt;table class="ex" id="table6" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt; &lt;pre&gt;CREATE VIEW [Products Above Average Price] AS&lt;br /&gt;SELECT ProductName,UnitPrice&lt;br /&gt;FROM Products&lt;br /&gt;WHERE UnitPrice&gt;(SELECT AVG(UnitPrice) FROM Products)&lt;/pre&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;We can query the view above as follows:&lt;/p&gt;  &lt;table class="ex" id="table8" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt; &lt;pre&gt;SELECT * FROM [Products Above Average Price]&lt;/pre&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Another example view from the Northwind database calculates  the total sale for each category in 1997. Note that this view selects its data  from another view called "Product Sales for 1997":&lt;/p&gt;  &lt;table class="ex" id="table7" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt; &lt;pre&gt;CREATE VIEW [Category Sales For 1997] AS&lt;br /&gt;SELECT DISTINCT CategoryName,Sum(ProductSales) AS CategorySales&lt;br /&gt;FROM [Product Sales for 1997]&lt;br /&gt;GROUP BY CategoryName&lt;/pre&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;We can query the view above as follows:&lt;/p&gt;  &lt;table class="ex" id="table9" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt; &lt;pre&gt;SELECT * FROM [Category Sales For 1997]&lt;/pre&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;We can also add a condition to the query. Now we want to see the total sale  only for the category "Beverages":&lt;/p&gt;  &lt;table class="ex" id="table10" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt; &lt;pre&gt;SELECT * FROM [Category Sales For 1997]&lt;br /&gt;WHERE CategoryName='Beverages'&lt;/pre&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-create-view-statement.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-8898613694992811633</guid><pubDate>Wed, 21 May 2008 09:24:00 +0000</pubDate><atom:updated>2008-05-21T02:25:06.019-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">INTO</category><category domain="http://www.blogger.com/atom/ns#">Select</category><category domain="http://www.blogger.com/atom/ns#">SELECT INTO</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Statement</category><title>SQL SELECT INTO Statement</title><description>&lt;h2&gt;The SELECT INTO Statement&lt;/h2&gt;  &lt;p&gt;The SELECT INTO statement is most often used to create backup copies of tables or  for archiving records.&lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT column_name(s) INTO newtable [IN externaldatabase]&lt;br /&gt;FROM source&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Make a Backup Copy&lt;/h2&gt;  &lt;p&gt;The following example makes a backup copy of the "Persons" table:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT * INTO Persons_backup&lt;br /&gt;FROM Persons&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The IN clause can be used to copy tables into another database:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT Persons.* INTO Persons IN 'Backup.mdb'&lt;br /&gt;FROM Persons&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;If you only want to copy a few fields, you can do so by listing them after  the SELECT statement:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT LastName,FirstName INTO Persons_backup&lt;br /&gt;FROM Persons&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;You can also add a WHERE clause. The following example  creates a "Persons_backup" table with two columns (FirstName and  LastName) by extracting the persons who  lives in "Sandnes" from the "Persons"  table:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT LastName,Firstname INTO Persons_backup&lt;br /&gt;FROM Persons&lt;br /&gt;WHERE City='Sandnes'&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Selecting data from more than one table is also possible. The following example creates  a new table "Empl_Ord_backup" that contains data from the two tables Employees and  Orders:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT Employees.Name,Orders.Product&lt;br /&gt;INTO Empl_Ord_backup&lt;br /&gt;FROM Employees&lt;br /&gt;INNER JOIN Orders&lt;br /&gt;ON Employees.Employee_ID=Orders.Employee_ID&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-select-into-statement.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-7281327401592663129</guid><pubDate>Wed, 21 May 2008 09:23:00 +0000</pubDate><atom:updated>2008-05-21T02:23:50.741-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">GROUP BY</category><category domain="http://www.blogger.com/atom/ns#">HAVING</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL GROUP BY and HAVING</title><description>&lt;p class="intro"&gt;Aggregate functions (like SUM) often need an added GROUP BY functionality.&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;GROUP BY...&lt;/h2&gt;  &lt;p&gt; GROUP BY... was added to SQL because aggregate functions (like SUM) return the  aggregate of all column values every time they are called, and without the GROUP BY function  it was impossible to find the sum for each individual group of column values. &lt;/p&gt;  &lt;p&gt;The syntax for the GROUP BY function is:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;SELECT column,SUM(column) FROM table GROUP BY column&lt;/pre&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;GROUP BY Example&lt;/h2&gt; &lt;p&gt;This "Sales" Table:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;Company&lt;/th&gt;       &lt;th align="left"&gt;Amount&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;W3Schools&lt;/td&gt;       &lt;td&gt;5500&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;IBM&lt;/td&gt;       &lt;td&gt;4500&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;W3Schools&lt;/td&gt;       &lt;td&gt;7100&lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;And This SQL:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;SELECT Company, SUM(Amount) FROM Sales&lt;/pre&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Returns this result:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;Company&lt;/th&gt;       &lt;th align="left"&gt;SUM(Amount)&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;W3Schools&lt;/td&gt;       &lt;td&gt;17100&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;IBM&lt;/td&gt;       &lt;td&gt;17100&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;W3Schools&lt;/td&gt;       &lt;td&gt;17100&lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;The above code is invalid because the column returned is not part of an aggregate. A GROUP BY clause will solve this problem: &lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;SELECT Company,SUM(Amount) FROM Sales&lt;br /&gt;GROUP BY Company&lt;/pre&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Returns this result:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;Company&lt;/th&gt;       &lt;th align="left"&gt;SUM(Amount)&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;W3Schools&lt;/td&gt;       &lt;td&gt;12600&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;IBM&lt;/td&gt;       &lt;td&gt;4500&lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;HAVING...&lt;/h2&gt;  &lt;p&gt; HAVING... was added to SQL because the WHERE keyword could not be used against  aggregate functions (like SUM), and without HAVING... it would be impossible to test for  result conditions. &lt;/p&gt; &lt;p&gt;The syntax for the HAVING function is:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;SELECT column,SUM(column) FROM table&lt;br /&gt;GROUP BY column&lt;br /&gt;HAVING SUM(column) condition value&lt;/pre&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;This "Sales" Table:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;Company&lt;/th&gt;       &lt;th align="left"&gt;Amount&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;W3Schools&lt;/td&gt;       &lt;td&gt;5500&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;IBM&lt;/td&gt;       &lt;td&gt;4500&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;W3Schools&lt;/td&gt;       &lt;td&gt;7100&lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;This SQL:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;SELECT Company,SUM(Amount) FROM Sales&lt;br /&gt;GROUP BY Company&lt;br /&gt;HAVING SUM(Amount)&gt;10000&lt;/pre&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Returns this result&lt;/p&gt;      &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;Company&lt;/th&gt;       &lt;th align="left"&gt;SUM(Amount)&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;W3Schools&lt;/td&gt;       &lt;td&gt;12600&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-group-by-and-having.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-2042508788594858818</guid><pubDate>Wed, 21 May 2008 09:21:00 +0000</pubDate><atom:updated>2008-05-21T02:22:59.437-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Functions</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Syntax</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL Functions</title><description>&lt;p class="intro"&gt;SQL has a lot of built-in functions for counting and calculations.&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;Function Syntax&lt;/h2&gt;  &lt;p&gt;The syntax for built-in SQL functions is:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;SELECT function(column) FROM table&lt;/pre&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Types of Functions&lt;/h2&gt; &lt;p&gt;There are several basic types and categories of functions in SQL. The basic types of functions are: &lt;/p&gt; &lt;ul&gt;&lt;li&gt;Aggregate Functions&lt;/li&gt;&lt;li&gt;Scalar functions&lt;/li&gt;&lt;/ul&gt;  &lt;hr /&gt;  &lt;h2&gt;Aggregate functions&lt;/h2&gt; &lt;p&gt;Aggregate functions operate against a collection of values, but return a  single value.&lt;/p&gt; &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; If used among many other expressions in the item list of a  SELECT statement, the SELECT must have a GROUP BY clause!!&lt;/p&gt;  &lt;h3&gt;"Persons" table (used in most examples)&lt;/h3&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;Name&lt;/th&gt;       &lt;th align="left"&gt;Age&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Hansen, Ola&lt;/td&gt;       &lt;td&gt;34&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Svendson, Tove&lt;/td&gt;       &lt;td&gt;45&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Pettersen, Kari&lt;/td&gt;       &lt;td&gt;19&lt;/td&gt;     &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;h3&gt;Aggregate functions in MS Access&lt;/h3&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left" valign="top" width="35%"&gt;Function&lt;/th&gt;       &lt;th align="left" valign="top" width="65%"&gt;Description&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_avg.asp"&gt;AVG(column)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the average value of a column&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_count.asp"&gt;COUNT(column)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the number of rows (without a NULL        value) of a column&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_count_ast.asp"&gt;COUNT(*)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the number of selected rows&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;FIRST(column)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the value of the first record in a        specified field&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;LAST(column)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the value of the last record in a        specified field&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_max.asp"&gt;MAX(column)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the highest value of a column&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_min.asp"&gt;MIN(column)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the lowest value of a column&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;STDEV(column)&lt;/td&gt;       &lt;td align="left" valign="top"&gt; &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;STDEVP(column)&lt;/td&gt;       &lt;td align="left" valign="top"&gt; &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_sum.asp"&gt;SUM(column)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the total sum of a column&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;VAR(column)&lt;/td&gt;       &lt;td align="left" valign="top"&gt; &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;VARP(column)&lt;/td&gt;       &lt;td align="left" valign="top"&gt; &lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;h3&gt;Aggregate functions in SQL Server&lt;/h3&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left" valign="top" width="35%"&gt;Function&lt;/th&gt;       &lt;th align="left" valign="top" width="65%"&gt;Description&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_avg.asp"&gt;AVG(column)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the average value of a column&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;BINARY_CHECKSUM&lt;/td&gt;       &lt;td align="left" valign="top"&gt; &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;CHECKSUM&lt;/td&gt;       &lt;td align="left" valign="top"&gt; &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;CHECKSUM_AGG&lt;/td&gt;       &lt;td align="left" valign="top"&gt; &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_count.asp"&gt;COUNT(column)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the number of rows (without a NULL        value) of a column&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_count_ast.asp"&gt;COUNT(*)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the number of selected rows&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_count_distinct.asp"&gt;COUNT(DISTINCT column)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the number of distinct results&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_first.asp"&gt;FIRST(column)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the value of the first record in a        specified field (not supported in SQLServer2K)&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_last.asp"&gt;LAST(column)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the value of the last record in a        specified field (not supported in SQLServer2K)&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_max.asp"&gt;MAX(column)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the highest value of a column&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_min.asp"&gt;MIN(column)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the lowest value of a column&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;STDEV(column)&lt;/td&gt;       &lt;td align="left" valign="top"&gt; &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;STDEVP(column)&lt;/td&gt;       &lt;td align="left" valign="top"&gt; &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;&lt;a href="http://www.w3schools.com/sql/func_sum.asp"&gt;SUM(column)&lt;/a&gt;&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the total sum of a column&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;VAR(column)&lt;/td&gt;       &lt;td align="left" valign="top"&gt; &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;VARP(column)&lt;/td&gt;       &lt;td align="left" valign="top"&gt; &lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Scalar functions&lt;/h2&gt; &lt;p&gt;Scalar functions operate against a single value, and return a single value  based on the input value.&lt;/p&gt; &lt;h3&gt;&lt;b&gt;Useful Scalar Functions in MS Access&lt;/b&gt;&lt;/h3&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left" valign="top" width="35%"&gt;Function&lt;/th&gt;       &lt;th align="left" valign="top" width="65%"&gt;Description&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;UCASE(c)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Converts a field to upper case&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;LCASE(c)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Converts a field to lower case&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;MID(c,start[,end])&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Extract characters from a text field&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;LEN(c)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the length of a text field&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;INSTR(c,char)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the numeric position of a named        character within a text field&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;LEFT(c,number_of_char)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Return the left part of a text field        requested&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;RIGHT(c,number_of_char)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Return the right part of a text field        requested&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;ROUND(c,decimals)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Rounds a numeric field to the number of        decimals specified&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;MOD(x,y)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the remainder of a division        operation&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;NOW()&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Returns the current system date&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;FORMAT(c,format)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Changes the way a field is displayed&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align="left" valign="top"&gt;DATEDIFF(d,date1,date2)&lt;/td&gt;       &lt;td align="left" valign="top"&gt;Used to perform date calculations&lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-functions.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-1545710748304397621</guid><pubDate>Wed, 21 May 2008 09:12:00 +0000</pubDate><atom:updated>2008-05-21T02:21:39.283-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ALTER</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Table</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL ALTER TABLE</title><description>&lt;h2&gt;ALTER TABLE&lt;/h2&gt; &lt;p&gt;The ALTER TABLE statement is used to add or drop columns in an existing table.&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;ALTER TABLE table_name &lt;i&gt;&lt;br /&gt;&lt;/i&gt;ADD column_name datatype&lt;/pre&gt;     &lt;pre&gt;ALTER TABLE table_name &lt;i&gt;&lt;br /&gt;&lt;/i&gt;DROP COLUMN column_name&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Some database systems don't allow the dropping of a column in a database table (DROP COLUMN column_name).&lt;/p&gt; &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Person:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;     &lt;td&gt;Storgt 20&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Example&lt;/h2&gt;  &lt;p&gt;To add a column named "City" in the "Person" table:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;ALTER TABLE Person ADD City varchar(30)&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;     &lt;td&gt;Storgt 20&lt;/td&gt;     &lt;td&gt; &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt;Example&lt;/h2&gt;  &lt;p&gt;To drop the "Address" column in the "Person" table:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;ALTER TABLE Person DROP COLUMN Address&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt;    &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-alter-table.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-134451948740380344</guid><pubDate>Wed, 21 May 2008 09:11:00 +0000</pubDate><atom:updated>2008-05-21T02:12:12.174-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Database</category><category domain="http://www.blogger.com/atom/ns#">DELETE</category><category domain="http://www.blogger.com/atom/ns#">Drop</category><category domain="http://www.blogger.com/atom/ns#">Index</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Table</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><category domain="http://www.blogger.com/atom/ns#">Truncate</category><title>SQL Drop Index, Table and Database</title><description>&lt;h2&gt;Drop Index&lt;/h2&gt; &lt;p&gt;You can delete an existing index in a table with the DROP INDEX statement.&lt;/p&gt; &lt;p&gt;Syntax for Microsoft SQLJet (and Microsoft Access):&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;DROP INDEX index_name ON table_name&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Syntax for MS SQL Server:&lt;/p&gt;  &lt;table class="ex" id="table1" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;DROP INDEX table_name.index_name&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Syntax for IBM DB2 and Oracle:&lt;/p&gt;  &lt;table class="ex" id="table2" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;DROP INDEX index_name&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Syntax for MySQL:&lt;/p&gt;  &lt;table class="ex" id="table3" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;ALTER TABLE table_name DROP INDEX index_name&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Delete a Table or Database&lt;/h2&gt;  &lt;p&gt;To delete a table (the table  structure, attributes, and indexes will also be deleted):&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;DROP TABLE table_name&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;To delete a database:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;DROP DATABASE database_name&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt; &lt;hr /&gt;  &lt;h2&gt;Truncate a Table&lt;/h2&gt;  &lt;p&gt;What if we only want to get rid of the data inside a table, and not the table  itself? Use the TRUNCATE TABLE command (deletes only the data inside the table):&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;TRUNCATE TABLE table_name&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-drop-index-table-and-database.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-128136729794817811</guid><pubDate>Wed, 21 May 2008 09:09:00 +0000</pubDate><atom:updated>2008-05-21T02:11:05.259-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Create</category><category domain="http://www.blogger.com/atom/ns#">Database</category><category domain="http://www.blogger.com/atom/ns#">Index</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Table</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL Create Database, Table, and Index</title><description>&lt;h2&gt;Create a Database&lt;/h2&gt; &lt;p&gt;To create a database:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;CREATE DATABASE database_name&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Create a Table&lt;/h2&gt; &lt;p&gt;To create a table in a database:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;CREATE TABLE table_name&lt;i&gt;&lt;br /&gt;&lt;/i&gt;(&lt;br /&gt;column_name1 data_type,&lt;i&gt;&lt;br /&gt;&lt;/i&gt;column_name2 data_type,&lt;i&gt;&lt;br /&gt;.......&lt;/i&gt;&lt;br /&gt;)&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Example&lt;/h3&gt; &lt;p&gt;This example demonstrates how you can create a table named "Person", with four columns. The column names will be "LastName", "FirstName", "Address", and "Age":&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;CREATE TABLE Person&lt;br /&gt;(&lt;br /&gt;LastName varchar,&lt;br /&gt;FirstName varchar,&lt;br /&gt;Address varchar,&lt;br /&gt;Age int&lt;br /&gt;)&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;This example demonstrates how you can specify a maximum length for some columns:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;CREATE TABLE Person&lt;br /&gt;(&lt;br /&gt;LastName varchar(30),&lt;br /&gt;FirstName varchar,&lt;br /&gt;Address varchar,&lt;br /&gt;Age int(3)&lt;br /&gt;)&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;The data type specifies what type of data the column can hold. The table below contains the most common data types in SQL:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left" valign="top" width="30%"&gt;Data Type&lt;/th&gt;     &lt;th align="left" valign="top" width="70%"&gt;Description&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;integer(size)&lt;br /&gt;      int(size)&lt;br /&gt;      smallint(size)&lt;br /&gt;      tinyint(size)&lt;/td&gt;     &lt;td valign="top"&gt;Hold integers only. The maximum number of digits are specified in       parenthesis.&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;decimal(size,d)&lt;br /&gt;      numeric(size,d)&lt;/td&gt;     &lt;td valign="top"&gt;Hold numbers with fractions. The maximum number of digits are specified in       "size". The maximum number of digits to the right of the decimal is       specified in "d".&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;char(size)&lt;/td&gt;     &lt;td valign="top"&gt; Holds a fixed length string (can contain letters, numbers, and special       characters). The fixed size is specified in parenthesis.&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;varchar(size)&lt;/td&gt;     &lt;td valign="top"&gt;Holds a variable length string (can contain letters, numbers, and special       characters). The maximum size is specified in parenthesis.&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;date(yyyymmdd)&lt;/td&gt;     &lt;td valign="top"&gt;Holds a date&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Create Index&lt;/h2&gt; &lt;p&gt;Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes, they are just used to speed up queries. &lt;/p&gt; &lt;b&gt;Note:&lt;/b&gt; Updating a table containing indexes takes more time than updating a table without, this is because the indexes also need an update. So, it is a good idea to create indexes only on columns that are often used for a search.&lt;p&gt;&lt;b&gt;A Unique Index&lt;/b&gt;&lt;/p&gt; &lt;p&gt;Creates a unique index on a table. A unique index means that two rows cannot have the same index value.&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;CREATE UNIQUE INDEX index_name&lt;br /&gt;ON table_name (column_name)&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The "column_name" specifies the column you want indexed.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;A Simple Index&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Creates a simple index on a table. When the UNIQUE keyword is omitted, duplicate values                        are allowed.&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;CREATE INDEX index_name&lt;br /&gt;ON table_name (column_name)&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The "column_name" specifies the column you want indexed.&lt;/p&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;p&gt;This example creates a simple index, named "PersonIndex", on the LastName field of the Person table:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;CREATE INDEX PersonIndex&lt;br /&gt;ON Person (LastName)&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;If you want to index the values in a column in &lt;b&gt;descending&lt;/b&gt; order, you can add the reserved word &lt;b&gt;DESC&lt;/b&gt; after the column name:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;CREATE INDEX PersonIndex&lt;br /&gt;ON Person (LastName DESC)&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;If you want to index more than one column you can list the column names  within the parentheses, separated by commas:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;CREATE INDEX PersonIndex&lt;br /&gt;ON Person (LastName, FirstName)&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-create-database-table-and-index.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-7011546868790409494</guid><pubDate>Wed, 21 May 2008 09:09:00 +0000</pubDate><atom:updated>2008-05-21T02:09:54.655-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Select</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><category domain="http://www.blogger.com/atom/ns#">UNION</category><title>SQL UNION and UNION ALL</title><description>&lt;h2&gt;UNION&lt;/h2&gt; &lt;p&gt;The UNION command is used to select related information from two  tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type.&lt;/p&gt; &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; With UNION, only distinct values are selected.&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt; &lt;pre&gt;SQL Statement 1&lt;br /&gt;UNION&lt;br /&gt;SQL Statement 2&lt;/pre&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Employees_Norway&lt;/b&gt;:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="60%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left" width="25%"&gt;E_ID&lt;/th&gt;     &lt;th align="left" width="35%"&gt;E_Name&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;01&lt;/td&gt;     &lt;td&gt;Hansen, Ola&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;02&lt;/td&gt;     &lt;td&gt;Svendson, Tove&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;03&lt;/td&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;04&lt;/td&gt;     &lt;td&gt;Pettersen, Kari&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Employees_USA&lt;/b&gt;:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="60%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left" width="25%"&gt;E_ID&lt;/th&gt;     &lt;th align="left" width="35%"&gt;E_Name&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;01&lt;/td&gt;     &lt;td&gt;Turner, Sally&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;02&lt;/td&gt;     &lt;td&gt;Kent, Clark&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;03&lt;/td&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;04&lt;/td&gt;     &lt;td&gt;Scott, Stephen&lt;/td&gt;   &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Using the UNION Command&lt;/h2&gt; &lt;h3&gt;Example&lt;/h3&gt; &lt;p&gt;List all different employee names in Norway and USA:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;SELECT E_Name FROM Employees_Norway&lt;br /&gt;UNION&lt;br /&gt;SELECT E_Name FROM Employees_USA&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="60%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left" width="35%"&gt;&lt;b&gt;E_Name&lt;/b&gt;&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen, Ola&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Tove&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen, Kari&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Turner, Sally&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Kent, Clark&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Scott, Stephen&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; This command cannot be used to list all employees in Norway and  USA. In the example above we have two employees with equal names, and only one  of them is listed. The UNION command only selects distinct values.&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;UNION ALL&lt;/h2&gt; &lt;p&gt;The UNION ALL command is equal to the UNION command, except that  UNION ALL selects all values.&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt; &lt;pre&gt;SQL Statement 1&lt;br /&gt;UNION ALL&lt;br /&gt;SQL Statement 2&lt;/pre&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Using the UNION ALL Command&lt;/h2&gt; &lt;h3&gt;Example&lt;/h3&gt; &lt;p&gt;List all employees in Norway and USA:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;pre&gt;SELECT E_Name FROM Employees_Norway&lt;br /&gt;UNION ALL&lt;br /&gt;SELECT E_Name FROM Employees_USA&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt;    &lt;table class="ex" border="1" cellspacing="0" width="60%"&gt;&lt;tbody&gt;&lt;tr&gt;     &lt;th align="left" width="35%"&gt;&lt;b&gt;E_Name&lt;/b&gt;&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen, Ola&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Tove&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen, Kari&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Turner, Sally&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Kent, Clark&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Scott, Stephen&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-union-and-union-all.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-6516380535363662164</guid><pubDate>Wed, 21 May 2008 09:02:00 +0000</pubDate><atom:updated>2008-05-21T02:09:04.724-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">JOIN</category><category domain="http://www.blogger.com/atom/ns#">Select</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL JOIN</title><description>&lt;h2&gt;Joins and Keys &lt;/h2&gt;  &lt;p&gt;Sometimes we have to select data from two or more tables to make our result complete. We have to perform a join. &lt;/p&gt;  &lt;p&gt;Tables in a database can be related to each other with keys. A primary key is a column with a unique value for each row. Each primary key value must be unique within  the table. The purpose is to bind data together, across tables, without repeating all of the data in every table. &lt;/p&gt;  &lt;p&gt;In the "Employees" table below, the "Employee_ID" column is the primary key, meaning that &lt;b&gt;no&lt;/b&gt; two rows can have the same Employee_ID. The  Employee_ID distinguishes two persons even if they have the same name. &lt;/p&gt; &lt;p&gt;When you look at the example tables below, notice that:  &lt;/p&gt; &lt;ul&gt;&lt;li&gt;The "Employee_ID" column is the primary key of the "Employees"     table&lt;/li&gt;&lt;li&gt;The "Prod_ID" column is the primary key of the "Orders"     table&lt;/li&gt;&lt;li&gt;The "Employee_ID" column in the "Orders" table is used to refer to the     persons in the "Employees" table without using their names&lt;/li&gt;&lt;/ul&gt; &lt;hr /&gt; &lt;p&gt;&lt;b&gt;Employees&lt;/b&gt;:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="60%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left" width="25%"&gt;Employee_ID&lt;/th&gt;     &lt;th align="left" width="35%"&gt;Name&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;01&lt;/td&gt;     &lt;td&gt;Hansen, Ola&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;02&lt;/td&gt;     &lt;td&gt;Svendson, Tove&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;03&lt;/td&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;04&lt;/td&gt;     &lt;td&gt;Pettersen, Kari&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Orders:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="60%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left" width="15%"&gt;Prod_ID&lt;/th&gt;     &lt;th align="left" width="20%"&gt;Product&lt;/th&gt;     &lt;th align="left" width="25%"&gt;Employee_ID&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;234&lt;/td&gt;     &lt;td&gt;Printer&lt;/td&gt;     &lt;td&gt;01&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;657&lt;/td&gt;     &lt;td&gt;Table&lt;/td&gt;     &lt;td&gt;03&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;865&lt;/td&gt;     &lt;td&gt;Chair&lt;/td&gt;     &lt;td&gt;03&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Referring to Two Tables&lt;/h2&gt;  &lt;p&gt;We can select data from two tables by referring to two tables, like this:&lt;/p&gt;  &lt;h3&gt;Example&lt;/h3&gt; &lt;p&gt;Who has ordered a product, and what did they order?&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT Employees.Name, Orders.Product&lt;br /&gt;FROM Employees, Orders&lt;br /&gt;WHERE Employees.Employee_ID=Orders.Employee_ID&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="60%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left" width="35%"&gt;&lt;b&gt;Name&lt;/b&gt;&lt;/th&gt;     &lt;th align="left" width="25%"&gt;Product&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen, Ola&lt;/td&gt;     &lt;td&gt;Printer&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;     &lt;td&gt;Table&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;     &lt;td&gt;Chair&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Example&lt;/h3&gt; &lt;p&gt;Who ordered a printer?&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT Employees.Name&lt;br /&gt;FROM Employees, Orders&lt;br /&gt;WHERE Employees.Employee_ID=Orders.Employee_ID&lt;br /&gt;AND Orders.Product='Printer'&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="60%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;&lt;b&gt;Name&lt;/b&gt;&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen, Ola&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Using Joins&lt;/h2&gt;  &lt;p&gt;OR we can select data from two tables with the JOIN keyword, like this:&lt;/p&gt;  &lt;h3&gt;Example INNER JOIN&lt;/h3&gt; &lt;p&gt;&lt;b&gt;Syntax&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT field1, field2, field3&lt;br /&gt;FROM first_table&lt;br /&gt;INNER JOIN second_table&lt;br /&gt;ON first_table.keyfield = second_table.foreign_keyfield&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Who has ordered a product, and what did they order?&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT Employees.Name, Orders.Product&lt;br /&gt;FROM Employees&lt;br /&gt;INNER JOIN Orders&lt;br /&gt;ON Employees.Employee_ID=Orders.Employee_ID&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The INNER JOIN returns all rows from both tables where there is a match. If there are rows in Employees that do not have matches in Orders, those rows will &lt;b&gt;not&lt;/b&gt; be listed.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="60%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left" width="35%"&gt;&lt;b&gt;Name&lt;/b&gt;&lt;/th&gt;     &lt;th align="left" width="25%"&gt;Product&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen, Ola&lt;/td&gt;     &lt;td&gt;Printer&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;     &lt;td&gt;Table&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;     &lt;td&gt;Chair&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Example LEFT JOIN&lt;/h3&gt; &lt;p&gt;&lt;b&gt;Syntax&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT field1, field2, field3&lt;br /&gt;FROM first_table&lt;br /&gt;LEFT JOIN second_table&lt;br /&gt;ON first_table.keyfield = second_table.foreign_keyfield&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;List all employees, and their orders - if any.&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT Employees.Name, Orders.Product&lt;br /&gt;FROM Employees&lt;br /&gt;LEFT JOIN Orders&lt;br /&gt;ON Employees.Employee_ID=Orders.Employee_ID&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The LEFT JOIN returns all the rows from the first table (Employees), even if there are no matches in the second table (Orders). If there are rows in Employees that do not have matches in Orders, those rows &lt;b&gt;also&lt;/b&gt; will be listed.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="60%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left" width="35%"&gt;&lt;b&gt;Name&lt;/b&gt;&lt;/th&gt;     &lt;th align="left" width="25%"&gt;Product&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen, Ola&lt;/td&gt;     &lt;td&gt;Printer&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Tove&lt;/td&gt;     &lt;td&gt; &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;     &lt;td&gt;Table&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;     &lt;td&gt;Chair&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen, Kari&lt;/td&gt;     &lt;td&gt; &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Example RIGHT JOIN&lt;/h3&gt; &lt;p&gt;&lt;b&gt;Syntax&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT field1, field2, field3&lt;br /&gt;FROM first_table&lt;br /&gt;RIGHT JOIN second_table&lt;br /&gt;ON first_table.keyfield = second_table.foreign_keyfield&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;List all orders, and who has ordered - if any.&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT Employees.Name, Orders.Product&lt;br /&gt;FROM Employees&lt;br /&gt;RIGHT JOIN Orders&lt;br /&gt;ON Employees.Employee_ID=Orders.Employee_ID&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The RIGHT JOIN returns all the rows from the second table (Orders), even if there are no matches in the first table (Employees). If there had been any rows in Orders that did not have matches in Employees, those rows &lt;b&gt;also&lt;/b&gt; would have been listed.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="60%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left" width="35%"&gt;&lt;b&gt;Name&lt;/b&gt;&lt;/th&gt;     &lt;th align="left" width="25%"&gt;Product&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen, Ola&lt;/td&gt;     &lt;td&gt;Printer&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;     &lt;td&gt;Table&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson, Stephen&lt;/td&gt;     &lt;td&gt;Chair&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Example&lt;/h3&gt; &lt;p&gt;Who ordered a printer?&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT Employees.Name&lt;br /&gt;FROM Employees&lt;br /&gt;INNER JOIN Orders&lt;br /&gt;ON Employees.Employee_ID=Orders.Employee_ID&lt;br /&gt;WHERE Orders.Product = 'Printer'&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt;    &lt;table class="ex" border="1" cellspacing="0" width="60%"&gt;&lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;&lt;b&gt;Name&lt;/b&gt;&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen, Ola&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-join.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-6505196807504676788</guid><pubDate>Wed, 21 May 2008 09:01:00 +0000</pubDate><atom:updated>2008-05-21T02:01:42.870-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Alias</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL Alias</title><description>&lt;hr /&gt;  &lt;p class="intro"&gt;With SQL, aliases can be used for column names and table names.&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;Column Name Alias&lt;/h2&gt;  &lt;p&gt;The syntax is:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;SELECT column AS column_alias FROM table&lt;/pre&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Table Name Alias&lt;/h2&gt;  &lt;p&gt;The syntax is:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;SELECT column FROM table AS table_alias&lt;/pre&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt; &lt;h2&gt;Example: Using a Column Alias&lt;/h2&gt; &lt;p&gt;This table (Persons):&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;     &lt;td&gt;Timoteivn 10&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;     &lt;td&gt;Storgt 20&lt;/td&gt;     &lt;td&gt;Stavanger&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;And this SQL:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT LastName AS Family, FirstName AS Name&lt;br /&gt;FROM Persons&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Returns this result:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="50%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;Family&lt;/th&gt;     &lt;th align="left"&gt;Name&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt; &lt;h2&gt;Example: Using a Table Alias&lt;/h2&gt; &lt;p&gt;This table (Persons):&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;     &lt;td&gt;Timoteivn 10&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;     &lt;td&gt;Storgt 20&lt;/td&gt;     &lt;td&gt;Stavanger&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;And this SQL:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT LastName, FirstName&lt;br /&gt;FROM Persons AS Employees&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Returns this result:&lt;/p&gt; &lt;p&gt;Table Employees:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="50%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-alias.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-603051078929202510</guid><pubDate>Wed, 21 May 2008 07:57:00 +0000</pubDate><atom:updated>2008-05-21T01:09:58.746-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">BETWEEN</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL BETWEEN</title><description>&lt;h2&gt;BETWEEN ... AND&lt;/h2&gt; &lt;p&gt;The BETWEEN ... AND operator selects a range of data between two values. These values can be numbers, text, or dates.&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;td&gt;         &lt;pre&gt;SELECT column_name FROM table_name&lt;i&gt;&lt;br /&gt;&lt;/i&gt;WHERE column_name&lt;i&gt;&lt;br /&gt;&lt;/i&gt;BETWEEN value1&lt;i&gt; &lt;/i&gt;AND value2&lt;/pre&gt;       &lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;&lt;b&gt;Original Table (used in the examples)&lt;/b&gt;&lt;/h2&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;     &lt;td&gt;Timoteivn 10&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Nordmann&lt;/td&gt;     &lt;td&gt;Anna&lt;/td&gt;     &lt;td&gt;Neset 18&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;     &lt;td&gt;Storgt 20&lt;/td&gt;     &lt;td&gt;Stavanger&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Example 1&lt;/h2&gt; &lt;p&gt;To display the persons alphabetically between (and including) "Hansen" and exclusive "Pettersen", use the following SQL:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT * FROM Persons WHERE LastName&lt;br /&gt;BETWEEN 'Hansen' AND 'Pettersen'&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;     &lt;td&gt;Timoteivn 10&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Nordmann&lt;/td&gt;     &lt;td&gt;Anna&lt;/td&gt;     &lt;td&gt;Neset 18&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt; &lt;b&gt;IMPORTANT!&lt;/b&gt; The BETWEEN...AND operator is treated differently in different  databases. With some databases a person with the LastName of  "Hansen" or "Pettersen" will not be listed (BETWEEN..AND only selects fields that are  between and excluding the test values). With some databases a person  with the last name of  "Hansen" or "Pettersen" will be listed (BETWEEN..AND selects  fields that are between and including the test values). With other databases a  person  with the last name of  "Hansen" will be listed, but "Pettersen" will not be listed  (BETWEEN..AND selects  fields between the test values, including the first test value and excluding the  last test value). Therefore: Check how your database treats the BETWEEN....AND  operator!&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;Example 2&lt;/h2&gt;  &lt;p&gt;To display the persons outside the range used in the previous example, use the NOT operator:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT * FROM Persons WHERE LastName&lt;br /&gt;NOT BETWEEN 'Hansen' AND 'Pettersen'&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;     &lt;td&gt;Storgt 20&lt;/td&gt;     &lt;td&gt;Stavanger&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-between.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-1609023159382845186</guid><pubDate>Wed, 21 May 2008 07:56:00 +0000</pubDate><atom:updated>2008-05-21T00:57:33.589-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">IN</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL IN</title><description>&lt;h2&gt;IN&lt;/h2&gt; &lt;p&gt;The IN operator may be used if you know the exact value  you want to return for at least one of the columns.&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;td&gt;         &lt;pre&gt;SELECT column_name FROM table_name&lt;i&gt;&lt;br /&gt;&lt;/i&gt;WHERE column_name IN (value1&lt;i&gt;,&lt;/i&gt;value2,..)&lt;/pre&gt;       &lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;&lt;b&gt;Original Table (used in the examples)&lt;/b&gt;&lt;/h2&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;     &lt;td&gt;Timoteivn 10&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Nordmann&lt;/td&gt;     &lt;td&gt;Anna&lt;/td&gt;     &lt;td&gt;Neset 18&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;     &lt;td&gt;Storgt 20&lt;/td&gt;     &lt;td&gt;Stavanger&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Example 1&lt;/h2&gt; &lt;p&gt;To display the persons with LastName equal to "Hansen" or "Pettersen", use the following SQL:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT * FROM Persons&lt;br /&gt;WHERE LastName IN ('Hansen','Pettersen')&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;     &lt;td&gt;Timoteivn 10&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;     &lt;td&gt;Storgt 20&lt;/td&gt;     &lt;td&gt;Stavanger&lt;/td&gt;   &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-in.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-367343192218301448</guid><pubDate>Wed, 21 May 2008 07:54:00 +0000</pubDate><atom:updated>2008-05-21T00:56:32.125-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">AND</category><category domain="http://www.blogger.com/atom/ns#">OR</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL AND &amp; OR</title><description>&lt;h2&gt;AND &amp;amp; OR&lt;/h2&gt; &lt;p&gt;AND and OR join two or more conditions in a WHERE clause.&lt;/p&gt; &lt;p&gt;The AND operator displays a row if ALL conditions listed are true. The OR operator displays a row if ANY of the conditions listed are true.&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;&lt;b&gt;Original Table (used in the examples)&lt;/b&gt;&lt;/h2&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;     &lt;td&gt;Timoteivn 10&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Stephen&lt;/td&gt;     &lt;td&gt;Kaivn 18&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt; Example&lt;/h2&gt; &lt;p&gt;Use AND to display each person with the first name equal to "Tove", and the last name equal to "Svendson":&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT * FROM Persons&lt;br /&gt;WHERE FirstName='Tove'&lt;br /&gt;AND LastName='Svendson'&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt; Example&lt;/h2&gt; &lt;p&gt;Use OR to display each person with the first name equal to "Tove", or the last name equal to "Svendson":&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT * FROM Persons&lt;br /&gt;WHERE firstname='Tove'&lt;br /&gt;OR lastname='Svendson'&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Stephen&lt;/td&gt;     &lt;td&gt;Kaivn 18&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;h2&gt;Example&lt;/h2&gt; &lt;p&gt;You can also combine AND and OR (use parentheses to form complex expressions):&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT * FROM Persons WHERE&lt;br /&gt;(FirstName='Tove' OR FirstName='Stephen')&lt;br /&gt;AND LastName='Svendson'&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Stephen&lt;/td&gt;     &lt;td&gt;Kaivn 18&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-and-or.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-7708784091558447988</guid><pubDate>Wed, 21 May 2008 07:52:00 +0000</pubDate><atom:updated>2008-05-21T00:54:32.142-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ORDER BY</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL ORDER BY</title><description>&lt;p class="intro"&gt;The ORDER BY keyword is used to sort the result.&lt;/p&gt; &lt;hr /&gt; &lt;h2&gt;Sort the Rows&lt;/h2&gt; &lt;p&gt;The ORDER BY clause is used to sort the rows.&lt;/p&gt; &lt;p&gt;&lt;b&gt;Orders:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="50%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;Company&lt;/th&gt;     &lt;th align="left"&gt;OrderNumber&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Sega&lt;/td&gt;     &lt;td&gt;3412&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ABC Shop&lt;/td&gt;     &lt;td&gt;5678&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;     &lt;td&gt;6798&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;     &lt;td&gt;2312&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;h2&gt;Example&lt;/h2&gt; &lt;p&gt;To display the company names in alphabetical order:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT Company, OrderNumber FROM Orders&lt;br /&gt;ORDER BY Company&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="50%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;Company&lt;/th&gt;     &lt;th align="left"&gt;OrderNumber&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ABC Shop &lt;/td&gt;     &lt;td&gt;5678&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Sega&lt;/td&gt;     &lt;td&gt;3412&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;     &lt;td&gt;6798&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;     &lt;td&gt;2312&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt;Example&lt;/h2&gt; &lt;p&gt;To display the company names in alphabetical order AND the OrderNumber in numerical order:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT Company, OrderNumber FROM Orders&lt;br /&gt;ORDER BY Company, OrderNumber&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="50%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;Company&lt;/th&gt;     &lt;th align="left"&gt;OrderNumber&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ABC Shop&lt;/td&gt;     &lt;td&gt;5678&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Sega&lt;/td&gt;     &lt;td&gt;3412&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;     &lt;td&gt;2312&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;     &lt;td&gt;6798&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt;Example&lt;/h2&gt; &lt;p&gt;To display the company names in reverse alphabetical order:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT Company, OrderNumber FROM Orders&lt;br /&gt;ORDER BY Company DESC&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="50%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;Company&lt;/th&gt;     &lt;th align="left"&gt;OrderNumber&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;     &lt;td&gt;6798&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;     &lt;td&gt;2312&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Sega&lt;/td&gt;     &lt;td&gt;3412&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ABC Shop&lt;/td&gt;     &lt;td&gt;5678&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt;Example&lt;/h2&gt; &lt;p&gt;To display the company names in reverse alphabetical order AND the OrderNumber in  numerical order:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT Company, OrderNumber FROM Orders&lt;br /&gt;ORDER BY Company DESC, OrderNumber ASC&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="50%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;Company&lt;/th&gt;     &lt;th align="left"&gt;OrderNumber&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;     &lt;td&gt;2312&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;     &lt;td&gt;6798&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Sega&lt;/td&gt;     &lt;td&gt;3412&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ABC Shop&lt;/td&gt;     &lt;td&gt;5678&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; Notice that there are two equal company names (W3Schools) in the result  above. The only time you will see the second column in ASC order would be when  there are duplicated values in the first sort column, or a handful of nulls.&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-order-by.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-5494743077456794719</guid><pubDate>Wed, 21 May 2008 07:51:00 +0000</pubDate><atom:updated>2008-05-21T00:52:19.205-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">DELETE</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Statement</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL DELETE Statement</title><description>&lt;h2&gt;The DELETE Statement&lt;/h2&gt;  &lt;p&gt;The DELETE statement is used to delete rows in a table.&lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;DELETE FROM table_name&lt;br /&gt;WHERE column_name = some_value&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt; &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Person:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;LastName&lt;/th&gt;       &lt;th align="left"&gt;FirstName&lt;/th&gt;       &lt;th align="left"&gt;Address&lt;/th&gt;       &lt;th align="left"&gt;City&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Nilsen&lt;/td&gt;       &lt;td&gt;Fred&lt;/td&gt;       &lt;td&gt;Kirkegt 56&lt;/td&gt;       &lt;td&gt;Stavanger&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Rasmussen&lt;/td&gt;       &lt;td&gt;Nina&lt;/td&gt;       &lt;td&gt;Stien 12&lt;/td&gt;       &lt;td&gt;Stavanger&lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Delete a Row&lt;/h2&gt; &lt;p&gt;"Nina Rasmussen" is going to be deleted:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;DELETE FROM Person WHERE LastName = 'Rasmussen'&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;LastName&lt;/th&gt;       &lt;th align="left"&gt;FirstName&lt;/th&gt;       &lt;th align="left"&gt;Address&lt;/th&gt;       &lt;th align="left"&gt;City&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Nilsen&lt;/td&gt;       &lt;td&gt;Fred&lt;/td&gt;       &lt;td&gt;Kirkegt 56&lt;/td&gt;       &lt;td&gt;Stavanger&lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Delete All Rows&lt;/h2&gt; &lt;p&gt;It is possible to delete all rows in a table without deleting the table. This  means that the table structure, attributes, and indexes will be intact:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;DELETE FROM table_name&lt;/pre&gt;   &lt;pre&gt;or&lt;/pre&gt;   &lt;pre&gt;DELETE * FROM table_name&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-delete-statement.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-6878344643658335893</guid><pubDate>Wed, 21 May 2008 07:40:00 +0000</pubDate><atom:updated>2008-05-21T00:41:46.259-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Statement</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><category domain="http://www.blogger.com/atom/ns#">Update</category><title>SQL UPDATE Statement</title><description>&lt;h2&gt;The Update Statement&lt;/h2&gt;  &lt;p&gt;The UPDATE statement is used to modify the data in a table.&lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;UPDATE table_name&lt;br /&gt;SET column_name = new_value&lt;i&gt;&lt;br /&gt;&lt;/i&gt;WHERE column_name = some_value&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt; &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Person:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;LastName&lt;/th&gt;       &lt;th align="left"&gt;FirstName&lt;/th&gt;       &lt;th align="left"&gt;Address&lt;/th&gt;       &lt;th align="left"&gt;City&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Nilsen&lt;/td&gt;       &lt;td&gt;Fred&lt;/td&gt;       &lt;td&gt;Kirkegt 56&lt;/td&gt;       &lt;td&gt;Stavanger&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Rasmussen&lt;/td&gt;       &lt;td&gt; &lt;/td&gt;       &lt;td&gt;Storgt 67&lt;/td&gt;       &lt;td&gt; &lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Update one Column in a Row&lt;/h2&gt; &lt;p&gt;We want to add a first name to the person with a last name of "Rasmussen":&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;UPDATE Person SET FirstName = 'Nina'&lt;br /&gt;WHERE LastName = 'Rasmussen'&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;LastName&lt;/th&gt;       &lt;th align="left"&gt;FirstName&lt;/th&gt;       &lt;th align="left"&gt;Address&lt;/th&gt;       &lt;th align="left"&gt;City&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Nilsen&lt;/td&gt;       &lt;td&gt;Fred&lt;/td&gt;       &lt;td&gt;Kirkegt 56&lt;/td&gt;       &lt;td&gt;Stavanger&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Rasmussen&lt;/td&gt;       &lt;td&gt;Nina&lt;/td&gt;       &lt;td&gt;Storgt 67&lt;/td&gt;       &lt;td&gt; &lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Update several Columns in a Row&lt;/h2&gt; &lt;p&gt;We want to change the address and add the name of the city:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;UPDATE Person&lt;br /&gt;SET Address = 'Stien 12', City = 'Stavanger'&lt;br /&gt;WHERE LastName = 'Rasmussen'&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;LastName&lt;/th&gt;       &lt;th align="left"&gt;FirstName&lt;/th&gt;       &lt;th align="left"&gt;Address&lt;/th&gt;       &lt;th align="left"&gt;City&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Nilsen&lt;/td&gt;       &lt;td&gt;Fred&lt;/td&gt;       &lt;td&gt;Kirkegt 56&lt;/td&gt;       &lt;td&gt;Stavanger&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Rasmussen&lt;/td&gt;       &lt;td&gt;Nina&lt;/td&gt;       &lt;td&gt;Stien 12&lt;/td&gt;       &lt;td&gt;Stavanger&lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-update-statement.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-9124477923875337653</guid><pubDate>Wed, 21 May 2008 07:33:00 +0000</pubDate><atom:updated>2008-05-21T00:37:25.130-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">INSERT</category><category domain="http://www.blogger.com/atom/ns#">INSERT INTO</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Statement</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>SQL INSERT INTO Statement</title><description>&lt;h2&gt;The INSERT INTO Statement&lt;/h2&gt;  &lt;p&gt;The INSERT INTO statement is used to insert new rows into a table.&lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;INSERT INTO table_name&lt;i&gt;&lt;br /&gt;&lt;/i&gt;VALUES (value1, value2,....)&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;You can also specify the columns for which you want to insert data:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;INSERT INTO table_name (column1, column2,...)&lt;br /&gt;VALUES (value1, value2,....)&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt; &lt;hr /&gt;  &lt;h2&gt;Insert a New Row&lt;/h2&gt; &lt;p&gt;This "Persons" table:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;LastName&lt;/th&gt;       &lt;th align="left"&gt;FirstName&lt;/th&gt;       &lt;th align="left"&gt;Address&lt;/th&gt;       &lt;th align="left"&gt;City&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Pettersen&lt;/td&gt;       &lt;td&gt;Kari&lt;/td&gt;       &lt;td&gt;Storgt 20&lt;/td&gt;       &lt;td&gt;Stavanger&lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;And this SQL statement:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;INSERT INTO Persons&lt;br /&gt;VALUES ('Hetland', 'Camilla', 'Hagabakka 24', 'Sandnes')&lt;/pre&gt;   &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Will give this result:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;LastName&lt;/th&gt;       &lt;th align="left"&gt;FirstName&lt;/th&gt;       &lt;th align="left"&gt;Address&lt;/th&gt;       &lt;th align="left"&gt;City&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Pettersen&lt;/td&gt;       &lt;td&gt;Kari&lt;/td&gt;       &lt;td&gt;Storgt 20&lt;/td&gt;       &lt;td&gt;Stavanger&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Hetland&lt;/td&gt;       &lt;td&gt;Camilla&lt;/td&gt;       &lt;td&gt;Hagabakka 24&lt;/td&gt;       &lt;td&gt;Sandnes&lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Insert Data in Specified Columns&lt;/h2&gt; &lt;p&gt;This "Persons" table:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;     &lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;LastName&lt;/th&gt;       &lt;th align="left"&gt;FirstName&lt;/th&gt;       &lt;th align="left"&gt;Address&lt;/th&gt;       &lt;th align="left"&gt;City&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Pettersen&lt;/td&gt;       &lt;td&gt;Kari&lt;/td&gt;       &lt;td&gt;Storgt 20&lt;/td&gt;       &lt;td&gt;Stavanger&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Hetland&lt;/td&gt;       &lt;td&gt;Camilla&lt;/td&gt;       &lt;td&gt;Hagabakka 24&lt;/td&gt;       &lt;td&gt;Sandnes&lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;And This SQL statement:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;pre&gt;INSERT INTO Persons (LastName, Address)&lt;br /&gt;VALUES ('Rasmussen', 'Storgt 67')&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Will give this result:&lt;/p&gt;      &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;       &lt;th align="left"&gt;LastName&lt;/th&gt;       &lt;th align="left"&gt;FirstName&lt;/th&gt;       &lt;th align="left"&gt;Address&lt;/th&gt;       &lt;th align="left"&gt;City&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Pettersen&lt;/td&gt;       &lt;td&gt;Kari&lt;/td&gt;       &lt;td&gt;Storgt 20&lt;/td&gt;       &lt;td&gt;Stavanger&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Hetland&lt;/td&gt;       &lt;td&gt;Camilla&lt;/td&gt;       &lt;td&gt;Hagabakka 24&lt;/td&gt;       &lt;td&gt;Sandnes&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;Rasmussen&lt;/td&gt;       &lt;td&gt; &lt;/td&gt;       &lt;td&gt;Storgt 67&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-insert-into-statement.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-8513351182067008542</guid><pubDate>Wed, 21 May 2008 07:31:00 +0000</pubDate><atom:updated>2008-05-21T00:33:05.794-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Clause</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><category domain="http://www.blogger.com/atom/ns#">Where</category><title>SQL WHERE Clause</title><description>&lt;p class="intro"&gt;The WHERE clause is used to specify a selection criterion.&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;The WHERE Clause &lt;/h2&gt; &lt;p&gt;To conditionally select data from a table, a WHERE clause can be added to the SELECT statement.&lt;/p&gt; &lt;h3&gt;Syntax&lt;/h3&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT column FROM table&lt;br /&gt;WHERE column operator value&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;With the WHERE clause, the following operators can be used:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="60%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td valign="top"&gt;&lt;b&gt;Operator&lt;/b&gt;&lt;/td&gt;     &lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;=&lt;/td&gt;     &lt;td&gt;Equal&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&lt;&gt;&lt;/td&gt;     &lt;td&gt;Not equal&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&gt;&lt;/td&gt;     &lt;td&gt;Greater than&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&lt;&lt;/td&gt;     &lt;td&gt;Less than&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&gt;=&lt;/td&gt;     &lt;td&gt;Greater than or equal&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&lt;=&lt;/td&gt;     &lt;td&gt;Less than or equal&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;BETWEEN&lt;/td&gt;     &lt;td&gt;Between an inclusive range&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;LIKE&lt;/td&gt;     &lt;td&gt;  &lt;p&gt;Search for a pattern&lt;/p&gt;      &lt;/td&gt;   &lt;/tr&gt;  &lt;tr&gt;     &lt;td valign="top"&gt;IN&lt;/td&gt;     &lt;td&gt;If you know the exact value you want to return for at least one of the   columns&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt; &lt;b&gt;Note:&lt;/b&gt; In some versions of SQL the &lt;&gt; operator may be written as !=&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;Using the WHERE Clause&lt;/h2&gt; &lt;p&gt;To select only the persons living in the city "Sandnes", we add a WHERE clause to the SELECT statement: &lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT * FROM Persons&lt;br /&gt;WHERE City='Sandnes'&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;"Persons" table&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;     &lt;th align="left"&gt;Year&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;     &lt;td&gt;Timoteivn 10&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;     &lt;td&gt;1951&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;     &lt;td&gt;1978&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Stale&lt;/td&gt;     &lt;td&gt;Kaivn 18&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;     &lt;td&gt;1980&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;     &lt;td&gt;Storgt 20&lt;/td&gt;     &lt;td&gt;Stavanger&lt;/td&gt;     &lt;td&gt;1960&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;     &lt;th align="left"&gt;Year&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;     &lt;td&gt;Timoteivn 10&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;     &lt;td&gt;1951&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;     &lt;td&gt;1978&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Stale&lt;/td&gt;     &lt;td&gt;Kaivn 18&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;     &lt;td&gt;1980&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Using Quotes&lt;/h2&gt; &lt;p&gt;Note that we have used single quotes around the conditional values in the examples.&lt;/p&gt;  &lt;p&gt;SQL uses single quotes around text values (most database systems will also accept double quotes). Numeric values should not be enclosed in quotes.&lt;/p&gt;  &lt;p&gt;For text values:&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;This is correct:&lt;br /&gt;SELECT * FROM Persons WHERE FirstName='Tove'&lt;/pre&gt;&lt;pre&gt;This is wrong:&lt;br /&gt;SELECT * FROM Persons WHERE FirstName=Tove&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;For numeric values:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;This is correct:&lt;br /&gt;SELECT * FROM Persons WHERE Year&gt;1965&lt;/pre&gt;&lt;pre&gt;This is wrong:&lt;br /&gt;SELECT * FROM Persons WHERE Year&gt;'1965'&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;The LIKE Condition &lt;/h2&gt;  &lt;p&gt;The LIKE condition is used to specify a search for a pattern in a column. &lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT column FROM table&lt;br /&gt;WHERE column LIKE pattern&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;A "%" sign can be used to define wildcards (missing letters in the pattern) both before and after the pattern.&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;Using LIKE&lt;/h2&gt;  &lt;p&gt;The following SQL statement will return persons with first names that start with an  'O':&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT * FROM Persons&lt;br /&gt;WHERE FirstName LIKE 'O%'&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;The following SQL statement will return persons with first names that end with an 'a':&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT * FROM Persons&lt;br /&gt;WHERE FirstName LIKE '%a'&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt; The following SQL statement will return persons with first names that contain the  pattern 'la':&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;&lt;pre&gt;SELECT * FROM Persons&lt;br /&gt;WHERE FirstName LIKE '%la%'&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-where-clause.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-1251917525043132444</guid><pubDate>Wed, 21 May 2008 07:28:00 +0000</pubDate><atom:updated>2008-05-21T00:31:13.110-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Select</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">Statement</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>The SQL SELECT Statement</title><description>&lt;p&gt;The SELECT statement is used to select data from a table. The tabular result is stored in a result table (called the result-set).&lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT column_name(s)&lt;br /&gt;FROM table_name&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;img src="http://www.w3schools.com/sql/lamp.gif" alt="Note" /&gt; &lt;b&gt;Note:&lt;/b&gt; SQL statements are not case  sensitive. SELECT is the same as select.&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;SQL SELECT Example&lt;/h2&gt; &lt;p&gt;To select the content of columns named "LastName" and "FirstName",  from the database table called "Persons", use a SELECT statement like this:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT LastName,FirstName FROM Persons&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;The database table "Persons":&lt;/b&gt;&lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;     &lt;td&gt;Timoteivn 10&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;     &lt;td&gt;Storgt 20&lt;/td&gt;     &lt;td&gt;Stavanger&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;The result&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="50%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Select All Columns&lt;/h2&gt; &lt;p&gt;To select all columns from the "Persons" table, use a * symbol instead of column names, like this: &lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT * FROM Persons&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;     &lt;td&gt;Timoteivn 10&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;     &lt;td&gt;Storgt 20&lt;/td&gt;     &lt;td&gt;Stavanger&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;The Result Set&lt;/h2&gt; &lt;p&gt;The result from a SQL query is stored in a result-set. Most database software systems allow navigation of the result set with programming functions, like: Move-To-First-Record, Get-Record-Content, Move-To-Next-Record, etc.&lt;/p&gt; &lt;p&gt;Programming functions like these are not a part of this tutorial. To learn about accessing data with function calls,  please visit our &lt;a href="http://www.w3schools.com/ado/default.asp"&gt;ADO tutorial&lt;/a&gt;. &lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;Semicolon after SQL Statements?&lt;/h2&gt; &lt;p&gt;Semicolon is the standard way to separate each SQL statement in database systems that allow more than one SQL statement to be executed in the same call to the server.&lt;/p&gt; &lt;p&gt;Some SQL tutorials end each SQL statement with a semicolon. Is this necessary? We are using MS Access and SQL Server 2000 and we  do not have to put a semicolon after each SQL statement, but some database  programs force you to use it.&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;The SELECT DISTINCT Statement&lt;/h2&gt;  &lt;p&gt;The DISTINCT keyword is used to return only distinct (different) values.&lt;/p&gt; &lt;p&gt;The SELECT statement returns information from table columns. But what if we only want to select distinct elements?&lt;/p&gt; &lt;p&gt;With SQL, all we need to do is to add a DISTINCT keyword to the SELECT statement:&lt;/p&gt; &lt;h3&gt;Syntax&lt;/h3&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT DISTINCT column_name(s)&lt;br /&gt;FROM table_name&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Using the DISTINCT keyword&lt;/h2&gt; &lt;p&gt;To select ALL values from the column named "Company" we use a SELECT statement like this:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT Company FROM Orders&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;"Orders" table&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="50%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;Company&lt;/th&gt;     &lt;th align="left"&gt;OrderNumber&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Sega&lt;/td&gt;     &lt;td&gt;3412&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;     &lt;td&gt;2312&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Trio&lt;/td&gt;     &lt;td&gt;4678&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;     &lt;td&gt;6798&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="50%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;Company&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Sega&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Trio&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt; Note that "W3Schools" is listed twice in the result-set.&lt;/p&gt; &lt;p&gt;To select only DIFFERENT values from the column named "Company" we use a SELECT DISTINCT statement like this:&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;td&gt;       &lt;pre&gt;SELECT DISTINCT Company FROM Orders&lt;/pre&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="50%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;Company&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Sega&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;W3Schools&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Trio&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Now "W3Schools" is listed only once in the result-set.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/sql-select-statement.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4778812847288789714.post-7121249264281759213</guid><pubDate>Wed, 21 May 2008 05:27:00 +0000</pubDate><atom:updated>2008-05-20T22:41:02.758-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Introduction</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">start</category><category domain="http://www.blogger.com/atom/ns#">Totorial</category><title>Introduction to SQL</title><description>&lt;p class="intro"&gt;SQL is a standard computer language for accessing and  manipulating databases.&lt;/p&gt; &lt;hr /&gt;  &lt;h2&gt;What is SQL?&lt;/h2&gt; &lt;ul&gt;&lt;li&gt;SQL stands for &lt;b&gt;S&lt;/b&gt;tructured &lt;b&gt;Q&lt;/b&gt;uery &lt;b&gt;L&lt;/b&gt;anguage&lt;/li&gt;&lt;li&gt;SQL allows you to access a database&lt;/li&gt;&lt;li&gt;SQL is an ANSI standard computer language&lt;/li&gt;&lt;li&gt; SQL can execute queries against a database&lt;/li&gt;&lt;li&gt;SQL can retrieve data from a database&lt;/li&gt;&lt;li&gt;SQL can insert new records in a database&lt;/li&gt;&lt;li&gt;SQL can delete records from a database&lt;/li&gt;&lt;li&gt;SQL can update records in a database&lt;/li&gt;&lt;li&gt;SQL is easy to learn&lt;/li&gt;&lt;/ul&gt;  &lt;hr /&gt; &lt;h2&gt;SQL is a Standard - BUT....&lt;/h2&gt;  &lt;p&gt;SQL is an ANSI (American National Standards Institute) standard computer language for accessing and manipulating database systems. SQL statements are used to retrieve and update data in a database. SQL works with database programs like MS Access, DB2, Informix, MS SQL Server, Oracle, Sybase, etc.&lt;/p&gt;  &lt;p&gt;Unfortunately, there are many different versions of the SQL language, but to be in  compliance with the ANSI standard, they must support the same  major keywords in a similar manner (such as SELECT, UPDATE, DELETE, INSERT,  WHERE, and others).&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Most of the SQL database programs also have their own  proprietary extensions in addition to the SQL standard!&lt;/p&gt;  &lt;hr /&gt; &lt;h2&gt;SQL Database Tables&lt;/h2&gt; &lt;p&gt;A database most often contains one or more tables. Each table is identified  by a name (e.g. "Customers" or "Orders"). Tables contain records (rows) with  data.&lt;/p&gt; &lt;p&gt;Below is an example of a table called "Persons":&lt;/p&gt; &lt;table class="ex" border="1" cellspacing="0" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;     &lt;th align="left"&gt;FirstName&lt;/th&gt;     &lt;th align="left"&gt;Address&lt;/th&gt;     &lt;th align="left"&gt;City&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;     &lt;td&gt;Ola&lt;/td&gt;     &lt;td&gt;Timoteivn 10&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;     &lt;td&gt;Tove&lt;/td&gt;     &lt;td&gt;Borgvn 23&lt;/td&gt;     &lt;td&gt;Sandnes&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;     &lt;td&gt;Kari&lt;/td&gt;     &lt;td&gt;Storgt 20&lt;/td&gt;     &lt;td&gt;Stavanger&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt; The table above contains three records (one for each person) and four columns (LastName, FirstName, Address, and City).&lt;/p&gt; &lt;hr /&gt; &lt;h2&gt; SQL Queries &lt;/h2&gt;  &lt;p&gt;With SQL, we can query a database and have a result set returned. &lt;/p&gt;  &lt;p&gt;A query like this: &lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="50%"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;pre&gt;SELECT LastName FROM Persons&lt;/pre&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Gives a result set like this: &lt;/p&gt;  &lt;table class="ex" border="1" cellspacing="0" width="50%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;LastName&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Hansen&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Svendson&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;Pettersen&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt; &lt;b&gt;Note&lt;/b&gt;: Some database systems require a semicolon at the end of the SQL statement. We don't use the semicolon in our tutorials.&lt;/p&gt; &lt;hr /&gt; &lt;h2&gt;SQL Data Manipulation Language (DML)&lt;/h2&gt;  &lt;p&gt;SQL (Structured Query Language) is a syntax for executing queries. But the SQL language also includes a syntax to update, insert, and delete records.&lt;/p&gt;  &lt;p&gt;These query and update commands together form the Data Manipulation Language (DML)  part of SQL:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;&lt;b&gt;SELECT&lt;/b&gt; - extracts data from a database table&lt;/li&gt;&lt;li&gt;&lt;b&gt;UPDATE&lt;/b&gt; - updates data in a database table&lt;/li&gt;&lt;li&gt;&lt;b&gt;DELETE&lt;/b&gt; - deletes data from a database table&lt;/li&gt;&lt;li&gt;&lt;b&gt;INSERT INTO&lt;/b&gt; - inserts new data into a database table&lt;/li&gt;&lt;/ul&gt;  &lt;hr /&gt; &lt;h2&gt;SQL Data Definition Language (DDL)&lt;/h2&gt;  &lt;p&gt;The Data Definition Language (DDL) part of SQL permits database tables to be created or deleted. We can also define indexes (keys), specify links between tables, and impose constraints between database tables.&lt;/p&gt; &lt;p&gt; The most important DDL statements in SQL are: &lt;/p&gt;  &lt;ul&gt;&lt;li&gt;&lt;b&gt;CREATE TABLE&lt;/b&gt; - creates a new database table&lt;/li&gt;&lt;li&gt;&lt;b&gt;ALTER TABLE &lt;/b&gt;- alters (changes) a database table&lt;/li&gt;&lt;li&gt;&lt;b&gt;DROP TABLE&lt;/b&gt; - deletes a database table&lt;/li&gt;&lt;li&gt;&lt;b&gt;CREATE INDEX&lt;/b&gt; - creates an index (search key)&lt;/li&gt;&lt;li&gt;&lt;b&gt;DROP INDEX&lt;/b&gt; - deletes an index&lt;/li&gt;&lt;/ul&gt;&lt;a style="color: rgb(153, 0, 0);" href="http://thesqltutorial.blogspot.com/2008/05/sql-home.html"&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;&lt;home&gt;&lt;/home&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;SQL is a standard computer language for accessing and manipulating databases.

In this tutorial you will learn how to use SQL to access and manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and other database systems.&lt;/div&gt;</description><link>http://thesqltutorial.blogspot.com/2008/05/introduction-to-sql.html</link><author>noreply@blogger.com (karnoi)</author><thr:total>0</thr:total></item></channel></rss>