<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5354618818514689173</id><updated>2011-11-28T06:00:49.373+05:30</updated><title type='text'>The Complete</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://assathish.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://assathish.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>A.S.Sathish</name><uri>http://www.blogger.com/profile/06540227764338815092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/--EgozwnvpX0/TrBvBIspl7I/AAAAAAAAABo/8s5YbI3yslk/s220/DSC00044.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5354618818514689173.post-3501356399792727299</id><published>2009-10-08T15:12:00.003+05:30</published><updated>2009-10-08T15:26:21.863+05:30</updated><title type='text'>SQL CREATE TABLE</title><content type='html'>&lt;span style="font-size:180%;"&gt;                         CREATE TABLE&lt;/span&gt;&lt;br /&gt;Tables are the basic structure where data is stored in the database. Given that in most cases, there is no way for the database vendor to know ahead of time what your data storage needs are, chances are that you will need to create tables in the database yourself. Many database tools allow you to create tables without writing SQL, but given that tables are the container of all the data, it is important to include the CREATE TABLE syntax in this tutorial.&lt;br /&gt;&lt;br /&gt;                               Before we dive into the SQL syntax for CREATE TABLE, it is a good idea to understand what goes into a table. Tables are divided into rows and columns. Each row represents one piece of data, and each column can be thought of as representing a component of that piece of data. So, for example, if we have a table for recording customer information, then the columns may include information such as First Name, Last Name, Address, City, Country, Birth Date, and so on. As a result, when we specify a table, we include the column headers and the data types for that particular column.&lt;br /&gt;&lt;br /&gt;So what are data types? Typically, data comes in a variety of forms. It could be an integer (such as 1), a real number (such as 0.55), a string (such as 'sql'), a date/time expression (such as '2000-JAN-25 03:22:22'), or even in binary format. When we specify a table, we need to specify the data type associated with each column (i.e., we will specify that 'First Name' is of type char(50) - meaning it is a string with 50 characters). One thing to note is that different relational databases allow for different data types, so it is wise to consult with a database-specific reference first.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The SQL syntax for CREATE TABLE is&lt;br /&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;CREATE TABLE "table_name"("column 1" "data_type_for_column_1","column 2" "data_type_for_column_2",... )&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;So, if we are to create the customer table specified as above, we would type in&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;CREATE TABLE customer&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;(First_Name char(50),&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;Last_Name char(50),&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;Address char(50),&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;City char(50),&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;Country char(25),&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;Birth_Date date) ;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Sometimes, we want to provide a default value for each column. A default value is used when you do not specify a column's value when inserting data into the table. To specify a default value, add "Default [value]" after the data type declaration. In the above example, if we want to default column "Address" to "Unknown" and City to "Mumbai", we would type in&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;CREATE TABLE customer&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;(First_Name char(50),&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;Last_Name char(50),&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;Address char(50) default 'Unknown',&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;City char(50) default 'Mumbai',&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;Country char(25),&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;Birth_Date date) ;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;You can also limit the type of information a table / a column can hold. This is done through the &lt;a href="http://www.1keydata.com/sql/sql-constraint.html"&gt;CONSTRAINT&lt;/a&gt; keyword. The constraint concept is posted seperately in the blog&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5354618818514689173-3501356399792727299?l=assathish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://assathish.blogspot.com/feeds/3501356399792727299/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://assathish.blogspot.com/2009/10/sql-create-table.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/3501356399792727299'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/3501356399792727299'/><link rel='alternate' type='text/html' href='http://assathish.blogspot.com/2009/10/sql-create-table.html' title='SQL CREATE TABLE'/><author><name>A.S.Sathish</name><uri>http://www.blogger.com/profile/06540227764338815092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/--EgozwnvpX0/TrBvBIspl7I/AAAAAAAAABo/8s5YbI3yslk/s220/DSC00044.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5354618818514689173.post-6379768133284474245</id><published>2009-10-08T14:44:00.004+05:30</published><updated>2009-10-08T15:08:36.720+05:30</updated><title type='text'>SQL PRIMARY KEY</title><content type='html'>&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;PRIMARY KEY&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;A primary key is used to uniquely identify each row in a table. It can either be part of the actual record itself , or it can be an artificial field (one that has nothing to do with the actual record). A primary key can consist of one or more fields on a table. When multiple fields are used as a primary key, they are called a composite key.&lt;br /&gt;Primary keys can be specified either when the table is created (using &lt;a href="http://www.1keydata.com/sql/sqlcreate.html"&gt;CREATE TABLE&lt;/a&gt;) or by changing the existing table structure (using &lt;a href="http://www.1keydata.com/sql/sql-alter-table.html"&gt;ALTER TABLE&lt;/a&gt;). &lt;/p&gt;&lt;p&gt;The following is the syntax to implement a primary key constraint on a column while creating tables:&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;CREATE TABLE Customer (SID integer PRIMARY KEY, Last_Name varchar(30), First_Name varchar(30)); &lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;The syntax to add a primary key by a altering table is given below&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;ALTER TABLE Customer ADD PRIMARY KEY (SID);&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Before using the &lt;em&gt;ALTER TABLE&lt;/em&gt; command to add a primary key, you'll need to make sure that the field is defined as &lt;em&gt;'NOT NULL'&lt;/em&gt; -- in other words, NULL cannot be an accepted value for that field. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5354618818514689173-6379768133284474245?l=assathish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://assathish.blogspot.com/feeds/6379768133284474245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://assathish.blogspot.com/2009/10/sql-primary-key.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/6379768133284474245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/6379768133284474245'/><link rel='alternate' type='text/html' href='http://assathish.blogspot.com/2009/10/sql-primary-key.html' title='SQL PRIMARY KEY'/><author><name>A.S.Sathish</name><uri>http://www.blogger.com/profile/06540227764338815092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/--EgozwnvpX0/TrBvBIspl7I/AAAAAAAAABo/8s5YbI3yslk/s220/DSC00044.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5354618818514689173.post-5831616350408975224</id><published>2009-10-08T14:16:00.003+05:30</published><updated>2009-10-08T14:35:24.698+05:30</updated><title type='text'>SQL CONSTRAINTS(NOT NULL,CHECK,UNIQUE)</title><content type='html'>&lt;strong&gt;   &lt;span style="color:#006600;"&gt;CONSTRAINTS&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;When you bind a business rule to a column in the table then those rules are called the Constraints. Constraints are defined while creating the table. Say for example, you cannot have an employee who does not have a name, then employee name column in employee table should be a NOT NULL column. The NOT NULL is a constraint.&lt;br /&gt;The constraint types and short descriptions are given below:&lt;br /&gt;&lt;strong&gt;Constraint Types And Description&lt;br /&gt;NOT NULL:-&lt;/strong&gt;          &lt;br /&gt;you must provide the value in that column. you cannot leave that  column blank&lt;br /&gt;&lt;strong&gt;PRIMARY KEY:-&lt;br /&gt;&lt;/strong&gt;No duplicate values allowed, for example Empno in Employee table should be unique&lt;br /&gt;&lt;strong&gt;CHECK:-&lt;/strong&gt;&lt;br /&gt;checks the value and controls the inserting and updating values.&lt;br /&gt;&lt;strong&gt;DEFAULT:-&lt;/strong&gt;&lt;br /&gt;Assigns a default value if no value is given.&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;strong&gt;NOT NULL:-&lt;/strong&gt;&lt;br /&gt;If we have a business rule saying that all customers should have a name, we cannot have any customer with out a name. So to implement that business rule we can create customer table and specify customer name column as NOT NULL (constraint)&lt;br /&gt;Example&lt;br /&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;&lt;strong&gt;CREATE TABLE EMPLOYEE (EMPNO NUMBER(4) PRIMARY KEY, ENAME VARCHAR(4) NOT NULL);&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;-----------------------------------------------------------------------------------------------&lt;br /&gt;&lt;strong&gt;CHECK&lt;/strong&gt;&lt;br /&gt;Check constraint is used where we define a condition on a column. Check constraint consists of the keyword&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;"&gt;col_name datatype CHECK (col_name in(value1, value2))&lt;br /&gt;&lt;/span&gt;&lt;em&gt;Example&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;If you have a business rule saying that all employees in the organization should get atleast $500 then we can use CHECK constraint while creating table.&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;CREATE TABLE EMPLOYEE ( EMPNO NUMBER(4) PRIMARY KEY, ENAME VARCHAR(4) NOT NULL, SALARY NUMBER(7,2) CHECK (SALARY &gt; 500) );&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;&lt;span style="color:#000000;"&gt;-----------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;DEFAULT&lt;/strong&gt;&lt;br /&gt;While inserting a row into a table without giving values for every column, SQL must insert a default value to fill in the excluded columns, or the command will be rejected. The most common default value is NULL. This can be used with columns not defined with a NOT NULL.&lt;br /&gt;Default value assigned to a column while creating the table using&lt;br /&gt;CREATE TABLE operation.&lt;br /&gt;&lt;strong&gt;&lt;em&gt;Example&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;CREATE TABLE ITEM (ITEM_ID NUMBER(4) PRIMARY KEY, ITEM_NAME VARCHAR(15),ITEM_DESC VARCHAR(100), QOH NUMBER(4) DEFAULT 100);&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;Assigning a default value 0 for numeric columns makes the computation.&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;strong&gt;UNIQUE:-&lt;/strong&gt;&lt;br /&gt;The values entered into a column are unique ie no duplicate values exists.This constraint ensures business that there is no duplicates allowed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5354618818514689173-5831616350408975224?l=assathish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://assathish.blogspot.com/feeds/5831616350408975224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://assathish.blogspot.com/2009/10/sql-constraintsnot-nullcheckunique.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/5831616350408975224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/5831616350408975224'/><link rel='alternate' type='text/html' href='http://assathish.blogspot.com/2009/10/sql-constraintsnot-nullcheckunique.html' title='SQL CONSTRAINTS(NOT NULL,CHECK,UNIQUE)'/><author><name>A.S.Sathish</name><uri>http://www.blogger.com/profile/06540227764338815092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/--EgozwnvpX0/TrBvBIspl7I/AAAAAAAAABo/8s5YbI3yslk/s220/DSC00044.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5354618818514689173.post-2763817720751816155</id><published>2009-10-08T12:54:00.003+05:30</published><updated>2009-10-08T14:00:00.667+05:30</updated><title type='text'>SQL WHERE</title><content type='html'>Next, we might want to conditionally select the data from a table. For example, we may want to only retrieve stores with sales above $1,000. To do this, we use the &lt;strong&gt;WHERE&lt;/strong&gt; keyword. The syntax is as follows:&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;SELECT "column_name"FROM "table_name"WHERE "condition"&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;For example, to select all stores with sales above $1,000 in Table Store_Information,&lt;br /&gt;&lt;strong&gt;Table Store_Information:&lt;/strong&gt;&lt;br /&gt;-----------------------------------------------------------&lt;br /&gt;store_name                         Sales                 Date&lt;br /&gt;------------------------------------------------------------&lt;br /&gt;Los Angeles                        $1500               Jan-05-1999&lt;br /&gt;San Diego                            $250                 Jan-07-1999&lt;br /&gt;Los Angeles                        $300                 Jan-08-1999&lt;br /&gt;Boston                                 $700                 Jan-08-1999&lt;br /&gt;------------------------------------------------------------&lt;br /&gt;we key in,&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;SELECT store_nameFROM Store_InformationWHERE Sales &gt; 1000;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;Result:&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;store_name&lt;br /&gt;Los Angeles&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5354618818514689173-2763817720751816155?l=assathish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://assathish.blogspot.com/feeds/2763817720751816155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://assathish.blogspot.com/2009/10/sql-where.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/2763817720751816155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/2763817720751816155'/><link rel='alternate' type='text/html' href='http://assathish.blogspot.com/2009/10/sql-where.html' title='SQL WHERE'/><author><name>A.S.Sathish</name><uri>http://www.blogger.com/profile/06540227764338815092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/--EgozwnvpX0/TrBvBIspl7I/AAAAAAAAABo/8s5YbI3yslk/s220/DSC00044.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5354618818514689173.post-1907590577273884553</id><published>2009-10-08T12:47:00.003+05:30</published><updated>2009-10-08T14:08:23.917+05:30</updated><title type='text'>SQL DISTINCT</title><content type='html'>The SELECT keyword allows us to grab all information from a column (or columns) on a table. This, of course, necessarily mean that there will be redundancies. What if we only want to select each DISTINCT element? This is easy to accomplish in SQL. All we need to do is to add &lt;strong&gt;DISTINCT&lt;/strong&gt; after &lt;strong&gt;SELECT&lt;/strong&gt;. The syntax is as follows:&lt;br /&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:trebuchet ms;color:#990000;"&gt;SELECT DISTINCT "column_name"FROM "table_name"&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;For example, to select all distinct stores in Table Store_Information,&lt;br /&gt;&lt;strong&gt;Table Store_Information&lt;/strong&gt;&lt;br /&gt;----------------------------------------------------------------&lt;br /&gt;store_name Sales Date&lt;br /&gt;----------------------------------------------------------------&lt;br /&gt;Los Angeles $1500 Jan-05-1999&lt;br /&gt;San Diego $250 Jan-07-1999&lt;br /&gt;Los Angeles $300 Jan-08-1999&lt;br /&gt;Boston $700 Jan-08-1999&lt;br /&gt;-----------------------------------------------------------------&lt;br /&gt;we key in,&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#990000;"&gt;&lt;em&gt;&lt;span style="font-family:trebuchet ms;"&gt;SELECT DISTINCT store_name FROM Store_Information;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;/span&gt;Result:&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;store_name(column name)&lt;/em&gt;&lt;br /&gt;Los Angeles&lt;br /&gt;San Diego&lt;br /&gt;Boston&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5354618818514689173-1907590577273884553?l=assathish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://assathish.blogspot.com/feeds/1907590577273884553/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://assathish.blogspot.com/2009/10/sql-distinct.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/1907590577273884553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/1907590577273884553'/><link rel='alternate' type='text/html' href='http://assathish.blogspot.com/2009/10/sql-distinct.html' title='SQL DISTINCT'/><author><name>A.S.Sathish</name><uri>http://www.blogger.com/profile/06540227764338815092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/--EgozwnvpX0/TrBvBIspl7I/AAAAAAAAABo/8s5YbI3yslk/s220/DSC00044.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5354618818514689173.post-2391504293892249054</id><published>2009-10-08T12:37:00.003+05:30</published><updated>2009-10-08T14:06:35.152+05:30</updated><title type='text'>SQL SELECT</title><content type='html'>What do we use SQL commands for? A common use is to select data from the tables located in a database. Immediately, we see two keywords: we need to SELECT information FROM a table. (Note that a table is a container that resides in the database where the data is stored). Hence we have the most basic SQL structure:&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;strong&gt;&lt;em&gt;SELECT "column_name" FROM "table_name"&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;To illustrate the above example, assume that we have the following table:&lt;br /&gt;&lt;strong&gt;Table Store_Information(TABLE NAME)&lt;/strong&gt;&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;store_name Sales Date&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Los Angeles $1500 Jan-05-1999&lt;br /&gt;San Diego $250 Jan-07-1999&lt;br /&gt;Los Angeles $300 Jan-08-1999&lt;br /&gt;Boston $700 Jan-08-1999&lt;br /&gt;------------------------------------------------------------&lt;br /&gt;We shall use this table as an example throughout the tutorial (this table will appear in all sections). To select all the stores in this table, we key in,&lt;br /&gt;SELECT store_name FROM Store_Information&lt;br /&gt;&lt;strong&gt;Result:&lt;br /&gt;store_name&lt;/strong&gt;(column Name)&lt;br /&gt;Los Angeles&lt;br /&gt;San Diego&lt;br /&gt;Los Angeles&lt;br /&gt;Boston&lt;br /&gt;Multiple column names can be selected, as well as multiple table names.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5354618818514689173-2391504293892249054?l=assathish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://assathish.blogspot.com/feeds/2391504293892249054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://assathish.blogspot.com/2009/10/sql-select.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/2391504293892249054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/2391504293892249054'/><link rel='alternate' type='text/html' href='http://assathish.blogspot.com/2009/10/sql-select.html' title='SQL SELECT'/><author><name>A.S.Sathish</name><uri>http://www.blogger.com/profile/06540227764338815092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/--EgozwnvpX0/TrBvBIspl7I/AAAAAAAAABo/8s5YbI3yslk/s220/DSC00044.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5354618818514689173.post-6261014601987589886</id><published>2009-07-23T12:51:00.003+05:30</published><updated>2009-10-08T12:25:44.839+05:30</updated><title type='text'>INTRODUCTION TO SQL</title><content type='html'>&lt;p&gt;&lt;strong&gt;Structured Query Language&lt;/strong&gt;&lt;br /&gt;SQL is a database language used to create, manipulate and control the access to the Database objects. SQL is a non procedural language used to access relational databases. It is a flexible, efficient language with features designed to manipulate and examine relational data.&lt;br /&gt;SQL is only used for definition and manipulation of database objects. It cannot be used for application development like form definitions, creation of procedures etc...For that you need to necessarily have some 3gl languages such as cobol or 4gl languages such as Dbase to provide front-end support to the database.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Key features of SQL are:&lt;br /&gt;&lt;/strong&gt;Non procedural language&lt;br /&gt;Unified Language&lt;br /&gt;Common language for all Relational databases. ( Syntax may change between different RDBMS )&lt;br /&gt;&lt;strong&gt;SQL is made of Three sub-languages such as:&lt;/strong&gt;&lt;br /&gt;Data Definition language (DDL)&lt;br /&gt;Data Manipulation language (DML)&lt;br /&gt;Data control language (DCL)&lt;br /&gt;Data Definition Language (DDL): allows you to define database objects at the conceptual level. It consists of commands to create objects and alter the structure of objects, such as tables, views, indexes etc.. Commonly used DDL statements are CREATE, DROP etc..&lt;br /&gt;If you want to create a table Student,then use the following syntax&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:lucida grande;"&gt;&lt;span style="font-family:verdana;"&gt;CREATE TABLE STUDENT ( STUDENT_ID INTEGER PRIMARY KEY,STUDENT_NM VARCHAR(30),COURSE_ID VARCHAR(15) , PHONE VARCHAR(10) , ADDRESS VARCHAR(50) );&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;To drop a table from the database&lt;br /&gt;&lt;strong&gt;DROP TABLE STUDENT&lt;/strong&gt;;&lt;br /&gt;&lt;strong&gt;Data Manipulation language(DML):&lt;/strong&gt; Allows you to retrieve or update data within a database. It is used for query, insertion, deletion and updating of information stored in databases. Eg: Select, Insert, Update, Delete.&lt;br /&gt;STUDENT_ID STUDENT_NM COURSE_ id PHONE ADDRESS&lt;br /&gt;1001 james Oracle 972-888-9018 888,NorthCentralExp,Dallas,TX- 75089&lt;br /&gt;1002 JIM MSSql Server 972-678-8909 567, Preston Road, Dallas, TX - 75240&lt;br /&gt;1003&lt;br /&gt;BRUCE&lt;br /&gt;Java&lt;br /&gt;214-571-1567&lt;br /&gt;1234, Elm Street, Dallas, TX - 75039&lt;br /&gt;&lt;strong&gt;Select statement&lt;/strong&gt;:Select statement in SQL language is used to display certain data from the table.For example:- if you want to know what course Jim is taking; Select statement fetches you the information you want,when you use the information you have. So,in the above scenario the information you have is student_nm as Jim and and the information you want is course_id, the intersection of those two columns in that table is what you are looking for.&lt;br /&gt;SELECT (what you want)FROM (which tables)WHERE (what you have )&lt;br /&gt;Now the select statement to know the course_id Jim looks like this:&lt;br /&gt;SELECT COURSE_IDFROM STUDENTWHERE STUDENT_NM = 'JIM'&lt;br /&gt;You will get the result as:&lt;br /&gt;COURSE_ID&lt;br /&gt;MSSql Server&lt;br /&gt;If you want to see all the rows in the table then your select will be:&lt;br /&gt;SELECT * FROM STUDENT;&lt;br /&gt;If you would like to show student_nm and address who is attending Oracle course in the form of a report then your select will look like:&lt;br /&gt;SELECT STUDENT_NM, ADDRESSFROM STUENTWHERE COURSE_ID = 'Oracle'&lt;br /&gt;The result will be&lt;br /&gt;STUDENT_NM&lt;br /&gt;ADDRESS&lt;br /&gt;JAMES&lt;br /&gt;888, North Central Exp, Dallas, TX- 75089&lt;br /&gt;Insert Statement&lt;br /&gt;Insert statement is used to insert a new row into the table. For example:- If a new student DAVE is joining Java course then,use the INSERT SQL statement.&lt;br /&gt;INSERT INTO STUDENT (STUDENT_ID, STUDENT_NM, COURSE_ID,PHONE, ADDRESS ) VALUES(1004, 'DAVE', 'Java','972-912-4008', '567, Washington Ave, Dallas - 75543' )&lt;br /&gt;after executing the insert statement,your table should look like below when you issue a select from student table:&lt;br /&gt;STUDENT_ID&lt;br /&gt;STUDENT_NM&lt;br /&gt;COURSE_ID&lt;br /&gt;PHONE&lt;br /&gt;ADDRESS&lt;br /&gt;1001&lt;br /&gt;JAMES&lt;br /&gt;Oracle&lt;br /&gt;972-888-9018&lt;br /&gt;888, North Central Exp, Dallas, TX- 75089&lt;br /&gt;1002&lt;br /&gt;JIM&lt;br /&gt;MSSql Server&lt;br /&gt;972-678-8909&lt;br /&gt;567, Preston Road, Dallas, TX - 75240&lt;br /&gt;1003&lt;br /&gt;BRUCE&lt;br /&gt;Java&lt;br /&gt;214-571-1567&lt;br /&gt;1234, Elm Street, Dallas, TX - 75039&lt;br /&gt;1004&lt;br /&gt;DAVE&lt;br /&gt;Java&lt;br /&gt;972-912-4008&lt;br /&gt;567, Washington Ave, Dallas - 75543&lt;br /&gt;Update Statement&lt;br /&gt;is used to change the existing information in the table.For example:-If DAVE moved to another address then we need to change the ADDRESS column for DAVE's record.If the new address is 146, Dallas Parkway, Dallas - 75240 then your update should be:&lt;br /&gt;UPDATE STUDENT SET ADDRESS = '146, Dallas Parkway, Dallas - 75240'&lt;br /&gt;WHERE STUDENT_NM = 'DAVE'&lt;br /&gt;In order to make sure you updated the Address column for DAVE issue following SQL&lt;br /&gt;SELECT * FROM STUDENT WHERE STUDENT_NM = 'DAVE'&lt;br /&gt;then you should see the following result&lt;br /&gt;STUDENT_ID&lt;br /&gt;STUDENT_NM&lt;br /&gt;COURSE_ID&lt;br /&gt;PHONE&lt;br /&gt;ADDRESS&lt;br /&gt;1004&lt;br /&gt;DAVE&lt;br /&gt;Java&lt;br /&gt;972-912-4008&lt;br /&gt;146, Dallas Parkway, Dallas - 75240&lt;br /&gt;Delete Statement&lt;br /&gt;is used to delete a row from the table ie remove records from the table.For example:JAMES moved to different city, and he does not want to take the course.In order to remove JAMES's record from the table we use the DELETE statement&lt;br /&gt;DELETE STUDENTWHERE STUDENT_NM = 'JAMES'&lt;br /&gt;once you delete the record and you select all the information from the student table you should see the following information:&lt;br /&gt;STUDENT_ID&lt;br /&gt;STUDENT_NM&lt;br /&gt;COURSE_ID&lt;br /&gt;PHONE&lt;br /&gt;ADDRESS&lt;br /&gt;1002&lt;br /&gt;JIM&lt;br /&gt;MSSql Server&lt;br /&gt;972-678-8909&lt;br /&gt;567, Preston Road, Dallas, TX - 75240&lt;br /&gt;1003&lt;br /&gt;BRUCE&lt;br /&gt;Java&lt;br /&gt;214-571-1567&lt;br /&gt;1234, Elm Street, Dallas, TX - 75039&lt;br /&gt;1004&lt;br /&gt;DAVE&lt;br /&gt;Java&lt;br /&gt;972-912-4008&lt;br /&gt;567, Washington Ave, Dallas - 75543&lt;br /&gt;If you dont include where clause in delete statment then it will remove all the rows from the table.&lt;br /&gt;Data control language(DCL)In RDBMS one of the main advantages is the security for the data in the database. You can allow some user to do a specific operation or all operations on certain objects. Examples for DCL statements are GRANT, REVOKE statements.GRANT is used to Grant a permission to an user so that the user can do that operation.REVOKE is used to take back that permission from that user on that object.For example we have two users JAMES and DAVIDIf JAMES created a table called ITEMS then JAMES becomes the owner of that table.DAVID cannot access ITEMS table because he is not the owner of that table.DAVID can access ITEMS if JAMES gives the permission on his table.JAMES can give different types of access like Select, Update, Delete and Insert on ITEMS table to DAVID. For example:- If JAMES wants to provide only Select on ITEMS to DAVID then he can issue: GRANT SELECT ON ITEMS TO JAMESIf JAMES wants to provide only Select and Insert on ITEMS to DAVID then he can issue: GRANT SELECT, INSERT ON ITEMS TO JAMESIf JAMES wants to provide all the operations on ITEMS to DAVID then he can issue: GRANT ALL ON ITEMS TO JAMESOnce you provide all permissions on an object to an user then indirectly he becomes the owner and can do any manipulation to the table. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5354618818514689173-6261014601987589886?l=assathish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://assathish.blogspot.com/feeds/6261014601987589886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://assathish.blogspot.com/2009/07/introduction-to-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/6261014601987589886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/6261014601987589886'/><link rel='alternate' type='text/html' href='http://assathish.blogspot.com/2009/07/introduction-to-sql.html' title='INTRODUCTION TO SQL'/><author><name>A.S.Sathish</name><uri>http://www.blogger.com/profile/06540227764338815092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/--EgozwnvpX0/TrBvBIspl7I/AAAAAAAAABo/8s5YbI3yslk/s220/DSC00044.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5354618818514689173.post-7557724045497237484</id><published>2009-07-09T15:19:00.006+05:30</published><updated>2009-07-09T15:49:58.331+05:30</updated><title type='text'>DISTRIBUTED VERSUS CENTRALIZED DATABASE</title><content type='html'>&lt;strong&gt;&lt;em&gt;&lt;span style="font-size:130%;color:#ff6600;"&gt;            DISTRIBUTED DATABASE VS CENTRALIZED DATABASE&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#3333ff;"&gt;I have extracted some key phrases on Why we use a distributed databaseover a centralized one&lt;/span&gt;:&lt;/em&gt;&lt;br /&gt;"A big advantage of distributed DBMSs over centralized ones is that ofscalability. Growth can be sustained more gracefully in a distributed system."&lt;br /&gt;&lt;br /&gt;"Local autonomy is another reason for a business to implement a DDBMS.Since the nature of today's applications usually require data ingeographic areas that are often decentralized, it often makes sense to implement a distributed system. In this way, data can physically reside nearest to where it is most often accessed, thus providing users with local control of data that they interact with."&lt;br /&gt;&lt;br /&gt;"Another reason why one might want to consider a parallel architectureis to improve reliability and availability of the data in a scalablesystem. In a distributed system, with some careful tact, it is possible to access some, or possibly all of the data in a failure mode if there is sufficient data replication."&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;&lt;strong&gt;&lt;em&gt;Major features of a DDB are:&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;* Data stored at a number of sites, each site logically singleprocessor&lt;br /&gt;* Sites are interconnected by a network rather than a multiprocessor configuration&lt;br /&gt;* DDB is logically a single database (although each site is adatabase site)&lt;br /&gt;* DDBMS has full functionality of a DBMS&lt;br /&gt;* To the user, the distributed database system should appearexactly like a non- Distributed database system.&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;strong&gt;&lt;em&gt;Advantages of distributed database systems are:&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;*&lt;/strong&gt; local autonomy (in enterprises that are distributed already)&lt;br /&gt;* improved performance (since data is stored close to where neededand a query may be split over several sites and executed in parallel)&lt;br /&gt;* improved reliability/availability (should one site go down)&lt;br /&gt;* economics&lt;br /&gt;* expandability&lt;br /&gt;* shareability&lt;br /&gt;&lt;span style="color:#33ff33;"&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33ff33;"&gt;&lt;strong&gt;&lt;em&gt;Disadvantages of distributed database systems are:&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;* complexity (greater potential for bugs in software)&lt;br /&gt;* cost (software development can be much more complex and therefore costlAlso,exchangeof        messages and additional computations involve increased overheads)&lt;br /&gt;* distribution of control (no single database administratorcontrols the DDB)&lt;br /&gt;* security (since the system is distributed the chances ofsecurity lapses are greater)&lt;br /&gt;* difficult to change (since all sites have control of their ownsites)&lt;br /&gt;* lack of experience (enough experience is not available indeveloping distributed systems)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5354618818514689173-7557724045497237484?l=assathish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://assathish.blogspot.com/feeds/7557724045497237484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://assathish.blogspot.com/2009/07/distributed-versus-centralized-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/7557724045497237484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/7557724045497237484'/><link rel='alternate' type='text/html' href='http://assathish.blogspot.com/2009/07/distributed-versus-centralized-database.html' title='DISTRIBUTED VERSUS CENTRALIZED DATABASE'/><author><name>A.S.Sathish</name><uri>http://www.blogger.com/profile/06540227764338815092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/--EgozwnvpX0/TrBvBIspl7I/AAAAAAAAABo/8s5YbI3yslk/s220/DSC00044.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5354618818514689173.post-6180645984750642010</id><published>2009-06-04T15:14:00.002+05:30</published><updated>2009-06-04T15:38:53.131+05:30</updated><title type='text'></title><content type='html'>&lt;strong&gt;&lt;span style="color:#663333;"&gt;Concepts of Relational database system&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;To understand the basic concepts of RDBMS,the following information is &lt;span style="color:#000099;"&gt;provided&lt;/span&gt; to you.&lt;br /&gt;Table is the place where you can save all your data in the relational model(RDBMS). Data is organized in terms of Rows and columns in a table. For Example, see the information we have here in employee table.&lt;br /&gt;&lt;strong&gt;EMPLOYEE TABLE : (With out Relational Model)&lt;/strong&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;em&gt;EMPNO  ENAME  DEPTNO   DNAME                  LOC              SAL              COMM&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;-------- ---------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;7000&lt;/span&gt;      &lt;span style="color:#993399;"&gt; KING&lt;/span&gt;&lt;span style="color:#663366;"&gt; &lt;/span&gt;         10                &lt;span style="color:#006600;"&gt; MARKETING&lt;/span&gt;        &lt;span style="color:#996633;"&gt;DALLAS&lt;/span&gt;      &lt;span style="color:#ff9900;"&gt;5000.00&lt;/span&gt;   &lt;span style="color:#9999ff;"&gt;   300.00&lt;/span&gt;&lt;span style="color:#33ff33;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000099;"&gt;7001&lt;/span&gt;     &lt;span style="color:#993399;"&gt;  ALEX&lt;/span&gt;           20            &lt;span style="color:#006600;"&gt;    DEVELOPMENT&lt;/span&gt;&lt;span style="color:#996633;"&gt;   NY&lt;/span&gt;             &lt;span style="color:#ff9900;"&gt;   3500&lt;/span&gt;       &lt;span style="color:#9999ff;"&gt;     100&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;7002&lt;/span&gt;       &lt;span style="color:#993399;"&gt;CHRIS &lt;/span&gt;       10           &lt;span style="color:#006600;"&gt;      MARKETING&lt;/span&gt;         &lt;span style="color:#996633;"&gt;DALLAS &lt;/span&gt;  &lt;span style="color:#ff9900;"&gt;   4000&lt;/span&gt;           &lt;span style="color:#9999ff;"&gt; 100&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;7003&lt;/span&gt;       &lt;span style="color:#993399;"&gt;STEVE &lt;/span&gt;       20                &lt;span style="color:#006600;"&gt;DEVELOPMENT&lt;/span&gt;   &lt;span style="color:#996633;"&gt; NY&lt;/span&gt;             &lt;span style="color:#ff9900;"&gt;  4000&lt;/span&gt;          &lt;span style="color:#9999ff;"&gt;   200&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;7004&lt;/span&gt;     &lt;span style="color:#993399;"&gt;  KELLY&lt;/span&gt;        30            &lt;span style="color:#006600;"&gt;    HR&lt;/span&gt;                            &lt;span style="color:#996633;"&gt;LA      &lt;/span&gt;       &lt;span style="color:#ff9900;"&gt;   2000&lt;/span&gt;           &lt;span style="color:#9999ff;"&gt;  50&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;7005&lt;/span&gt;      &lt;span style="color:#993399;"&gt; JONES&lt;/span&gt;        30                &lt;span style="color:#006600;"&gt;HR    &lt;/span&gt;                       &lt;span style="color:#996633;"&gt; LA&lt;/span&gt;              &lt;span style="color:#ff9900;"&gt;  1700&lt;/span&gt;         &lt;span style="color:#9999ff;"&gt;     40&lt;br /&gt;&lt;/span&gt;In the above example,we have 6 employee records. 2 employees for each department.Take a look at it and see how many times we have the same information ie duplicate information.The departments are occuring twice and so more memory space is occupied. To calculate this,&lt;br /&gt;MARKETING                        9 BYTES&lt;br /&gt;DEVELOPMENT                  10 BYTES&lt;br /&gt;HUMAN RESOURCES        9 BYTES&lt;br /&gt;DALLAS                                 6 BYTES&lt;br /&gt;NY                                           2 BYTES&lt;br /&gt;LA                                           2 BYTES&lt;br /&gt;TOTAL                                  28 BYTES&lt;br /&gt;For 6 records we wasted 26 bytes, Imagine having 5000 employees working in thecompany! Then we are wasting 28 * 5000 bytes = 140000bytes,which is around 13 MB of memory.&lt;br /&gt;Advantages of the new system(Relational model):&lt;br /&gt;If you split the above shown data into two different tables then it becomes easy to maintain the data, For example:- If a particular department moved from Dallas to Atlanta,we need to change the city table for deptno 10 in the new system where as in the previous system we have to update all the employee records whose department is deptno 10.&lt;br /&gt;removes the duplicate information (Data Redundancy) instead of duplicating the Department name and Location for every employee record as seen in the previous system,You can see Department name and Location only once in the Department table based on the common column in the new system .&lt;br /&gt;Reduces the Memory space in the database&lt;br /&gt;&lt;strong&gt;Employee Table&lt;br /&gt;&lt;em&gt;EMPNO     ENAME    DEPTNO   SAL        COMM&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;7000          KING         10              5000      300&lt;br /&gt;7001          ALEX          20              3500     100&lt;br /&gt;7002          CHRIS        10              4000     100&lt;br /&gt;7003          STEVE        20             4000      200&lt;br /&gt;7004          KELLY        30             2000      50&lt;br /&gt;7005          JONES        30             1700      40&lt;br /&gt;&lt;strong&gt;Department Table&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;DEPTNO          DNAME                                     LOC&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;10                      MARKETING                           DALLAS&lt;br /&gt;20                     DEVELOPMENT                      NY&lt;br /&gt;30                     HUMAN RESOURCES             LA&lt;br /&gt;We have the same information now as before but the difference is we have two tables instead of one table.To relate the two tables, we need a common column between the tables. In the above example, there is a common column (DEPTNO).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5354618818514689173-6180645984750642010?l=assathish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://assathish.blogspot.com/feeds/6180645984750642010/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://assathish.blogspot.com/2009/06/concepts-of-relational-database-system.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/6180645984750642010'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/6180645984750642010'/><link rel='alternate' type='text/html' href='http://assathish.blogspot.com/2009/06/concepts-of-relational-database-system.html' title=''/><author><name>A.S.Sathish</name><uri>http://www.blogger.com/profile/06540227764338815092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/--EgozwnvpX0/TrBvBIspl7I/AAAAAAAAABo/8s5YbI3yslk/s220/DSC00044.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5354618818514689173.post-7051212076770065844</id><published>2009-06-04T15:07:00.002+05:30</published><updated>2009-06-04T15:11:56.887+05:30</updated><title type='text'></title><content type='html'>&lt;strong&gt;&lt;span style="color:#ff6600;"&gt;Introduction to RDBMS&lt;/span&gt;&lt;br /&gt;&lt;/strong&gt;DBMS&lt;a href="http://www.aroha.co.in/rdbmsconcepts.jsp" target="oramain"&gt;Concepts of RDBMS&lt;/a&gt;:This part gives you details about the basic concepts like how the data is viewed in Relational Database management system and advantages of RDBMS over other systems.&lt;br /&gt;&lt;a href="http://www.aroha.co.in/coddsrule.jsp" target="oramain"&gt;Codd's rules:&lt;/a&gt; defines the relational completeness of a DBMS.&lt;br /&gt;&lt;a href="http://www.aroha.co.in/orconst.jsp" target="oramain"&gt;Primary keys:&lt;/a&gt; Any column or a set of columns that uniquely identify rows of a Table.&lt;br /&gt;Entity integrity: The primary key of a table should not be partially or wholly NULL.&lt;br /&gt;&lt;a href="http://www.aroha.co.in/orconst.jsp" target="oramain"&gt;Referential integrity:&lt;/a&gt; No foreign key value may reference primary key that does not exist.&lt;br /&gt;&lt;a href="http://www.aroha.co.in/normalization.jsp" target="oramain"&gt;Normalization&lt;/a&gt;: It is a technique that logically groups the data over a number of tables, which are independent and contain no unnecessary data.&lt;br /&gt;&lt;a href="http://www.aroha.co.in/introsql.jsp" target="oramain"&gt;Structured Query language&lt;/a&gt;(SQL): It is a high level, set oriented, interactive database language for RDBMS. Used for definition and manipulation of database objects.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5354618818514689173-7051212076770065844?l=assathish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://assathish.blogspot.com/feeds/7051212076770065844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://assathish.blogspot.com/2009/06/introduction-to-rdbms-dbms-concepts-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/7051212076770065844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/7051212076770065844'/><link rel='alternate' type='text/html' href='http://assathish.blogspot.com/2009/06/introduction-to-rdbms-dbms-concepts-of.html' title=''/><author><name>A.S.Sathish</name><uri>http://www.blogger.com/profile/06540227764338815092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/--EgozwnvpX0/TrBvBIspl7I/AAAAAAAAABo/8s5YbI3yslk/s220/DSC00044.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5354618818514689173.post-8418914407208787235</id><published>2009-06-02T15:47:00.001+05:30</published><updated>2009-06-02T15:53:17.562+05:30</updated><title type='text'>Introduction to DBMS</title><content type='html'>&lt;span style="font-family:times new roman;"&gt;         &lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt; &lt;strong&gt;&lt;span style="color:#006600;"&gt;Database Management System&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;is a software package where you maintain and control the information to run the business and to do the day to day operations in an organized and user friendly method. In the DBMS we can back up the data, implement the security so that certain information can be modified or viewed by certain people working in the organization. In this section we learn the main concepts which we must follow while working in DBMS.&lt;br /&gt;In simple words, a Database Management System is a Software program which makes the task easier, the task being adding, deleting, modifying and maintain theinformation.&lt;br /&gt;Here are some database terms and concepts.&lt;br /&gt;Database Concepts&lt;br /&gt;Data&lt;br /&gt;Databases&lt;br /&gt;Entity, Attribute and Data&lt;br /&gt;Entity Relationships&lt;br /&gt;Data Models&lt;br /&gt;DataData is information about some thing. Data gets differed from business to business,&lt;strong&gt;FOR EXAMPLE:-&lt;/strong&gt; For a bus transportation company BUS, DRIVERS, CITY, SEATS OCCUPIED are data, for a computer hardware company MONITOR, CPU, HARD DISK are data.&lt;br /&gt;DatabasesDatabase is an area where you save the data needed to run the business. Database provides the following features like Sharing Data,enforcing Business rules,Data security which can be applied centrally&lt;br /&gt;Entity, Attribute and DataAn Entity is an object which has some attributes, &lt;strong&gt;FOR EXAMPLE&lt;/strong&gt;:- A employee in an organization has a name and a particular Job.Here EMPLOYEE is an ENTITY, NAME and JOB are ATTRIBUTES. Entity - EMPLOYEEAttribute - EMP_NAME and JOBData - Name of Employee like (Mike Modano) , his Job is like (Marketing).&lt;br /&gt;Entity RelationshipsDatabase contains many Entities (Tables), we can relate an entity to another,&lt;strong&gt;FOR EXAMPLE:-&lt;/strong&gt; In an organization we have many departments and many employees working , here we have two entities one is EMPLOYEE and the other is DEPARTMENT. So how do we relate these two entities?We can RELATE these two entities as:-In one department there can be many employees.&lt;br /&gt;The relationship between two different entities can be classified as:&lt;br /&gt;1.&lt;strong&gt;ONE to ONE&lt;/strong&gt; example PERSON - PASSPORT ( one individual can have only one passport)&lt;br /&gt;2.&lt;strong&gt;ONE to MANY&lt;/strong&gt; example DEPARTMENT - EMPLOYEE ( In one department there can be many employees working)&lt;br /&gt;3.&lt;strong&gt;MANY to MANY&lt;/strong&gt; example DOCTOR - PATIENT ( A doctor can have many patients and a patient can have many doctors )&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5354618818514689173-8418914407208787235?l=assathish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://assathish.blogspot.com/feeds/8418914407208787235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://assathish.blogspot.com/2009/06/introduction-to-dbms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/8418914407208787235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5354618818514689173/posts/default/8418914407208787235'/><link rel='alternate' type='text/html' href='http://assathish.blogspot.com/2009/06/introduction-to-dbms.html' title='Introduction to DBMS'/><author><name>A.S.Sathish</name><uri>http://www.blogger.com/profile/06540227764338815092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/--EgozwnvpX0/TrBvBIspl7I/AAAAAAAAABo/8s5YbI3yslk/s220/DSC00044.JPG'/></author><thr:total>0</thr:total></entry></feed>
