<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Oracle Database Tips blog &#187; sql background</title>
	<atom:link href="http://oracle-database-tips.com/wp/tag/sql-background/feed" rel="self" type="application/rss+xml" />
	<link>http://oracle-database-tips.com/wp</link>
	<description>News for Oracle professionals</description>
	<lastBuildDate>Fri, 03 Feb 2012 10:37:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>SQL Background</title>
		<link>http://oracle-database-tips.com/wp/sql/sql-background</link>
		<comments>http://oracle-database-tips.com/wp/sql/sql-background#comments</comments>
		<pubDate>Fri, 23 Oct 2009 10:53:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[compliant databases]]></category>
		<category><![CDATA[data structure]]></category>
		<category><![CDATA[database engine]]></category>
		<category><![CDATA[horizontal rows]]></category>
		<category><![CDATA[oracle database]]></category>
		<category><![CDATA[rowid]]></category>
		<category><![CDATA[select statement]]></category>
		<category><![CDATA[sql background]]></category>
		<category><![CDATA[sql commands]]></category>
		<category><![CDATA[sql info]]></category>
		<category><![CDATA[surname data]]></category>
		<category><![CDATA[table cells]]></category>
		<category><![CDATA[vertical columns]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=62</guid>
		<description><![CDATA[SQL is short for Structured Query Language.

It is the language you will use to access any data structure or its data in the Oracle database.
]]></description>
			<content:encoded><![CDATA[<p><strong>SQL </strong>is short for <strong>S</strong>tructured<strong> Q</strong>uery <strong>L</strong>anguage.</p>
<p>It is the language you will use to access any data structure or its data in the Oracle database.</p>
<p>You will use this to issue commands to send instructions to the database.</p>
<p>It is a standard across all compliant databases.</p>
<p>SQL commands work on sets of data and allow you to :</p>
<ul>
<li>Query the data (select)</li>
<li>Change the data (insert, update, delete)</li>
<li>Work with data structures (create or replace, alter, drop)</li>
<li>Determine access rules to data and structures (grant)</li>
<li>Lock rows or tables to enforce consistency. (lock)</li>
</ul>
<h3>Tables and indexes</h3>
<p>A<strong> table </strong> is a structure which contains horizontal rows and vertical columns.</p>
<p>The intersection of a row and a column is a cell.</p>
<p>When we search for data in a table, we use the SQL &#8216;select&#8217; statement          to extract the data in the table cells by specifying which &#8216;intersection&#8217;          of column  and row we want to extract results for. (More details later..)</p>
<table border="1" cellspacing="0" cellpadding="0" width="405">
<tbody>
<tr>
<td width="81"></td>
<td width="161">Column A</td>
<td width="155">Column B</td>
</tr>
<tr>
<td>Row 1</td>
<td>Cell: column A, row 1</td>
<td>Cell: column B, row 1</td>
</tr>
<tr>
<td>Row 2</td>
<td>Cell: column A, row 2</td>
<td>Cell: column B, row 2</td>
</tr>
</tbody>
</table>
<p>Here&#8217;s a real-world example of a table:</p>
<p>Table: Employees, contains 3 columns : EmployeeID, Surname and Firstname          and 4 rows of data.<br />
Each table has a hidden column called rowid which uniquely identifies          each row in the table.</p>
<table border="1" cellspacing="0" cellpadding="0" width="524">
<tbody>
<tr>
<td width="224">Rowid</td>
<td width="113"><strong>EmployeeID</strong></td>
<td width="61"><strong>Surname</strong></td>
<td width="116"><strong>Firstname</strong></td>
</tr>
<tr>
<td>AAAUM2AAMAACepMAAA</td>
<td>J001</td>
<td>Jones</td>
<td>Abe</td>
</tr>
<tr>
<td>AAAUM2AAMAACepMAAB</td>
<td>S001</td>
<td>Smith</td>
<td>Brian</td>
</tr>
<tr>
<td>AAAUM2AAMAACepMAAB</td>
<td>B001</td>
<td>Beckett</td>
<td>Chris</td>
</tr>
<tr>
<td>AAAUM2AAMAACepMAAD</td>
<td>B002</td>
<td>Brown</td>
<td>David</td>
</tr>
</tbody>
</table>
<p><strong>Index:</strong> a technique implemented by the database engine          to conduct data access as fast as possible.</p>
<p>An index on the &#8216;Surname&#8217; column of the Employees table would create          another &#8216;table&#8217; (but now called an index) containing only the sorted Surname data and the rowid of that row.</p>
<p>When you query data in the Surname column of the Employees table,<br />
the database engine&#8217;s optimizer determines whether or not to use the index,<br />
based on the expected number of rows it has to return.<br />
If it detects and uses the relevant index, it does a search on the index rather than the table.</p>
<p>Once if finds the correct row, it uses the stored rowid to access the          Employees table directly (no searching) to retrieve the whole row.</p>
<p>Once an index is created, you do not need to maintain it, nor do you need to use its name to access<br />
the data in the table. The Oracle engine does that for you in the background.</p>
<h3>Normalization:</h3>
<p>A methodology to design a database system in such a way so that there is no or limited data duplication.<br />
No table should contain data already stored in another table unless it is a link to a row<br />
in the other table (foreign key relationships).<br />
There are many other rules and degrees of normalization , if you would<br />
like to read more about it , see the link below in &#8216;Additional resources&#8217;.</p>
<h3>Recommended reading:</h3>
<p>For more info on relational database theory, here&#8217;s an excellent well-priced resource:</p>
<div id="content">
<li><a title="opens new window" href="http://www.oracle-database-tips.com/alflink" target="_blank">Database Normalization ebook by Alf Pedersen</a></li>
<p>If you have time to scan through Oracle&#8217;s manual about SQL, follow the link to the online documentation :</p>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Ftoc.htm&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_sql_background.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/toc.htm" target="_blank">Oracle SQL Background reference (Oracle online documentation)</a></li>
</div>
]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sql/sql-background/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

