If you have already seen the page Sofware_tips_sql_part1
then this will prove more useful to you. This part gives tips
about the further operations which can be performed with the help of the sql statements.
The next basic operation which is required for getting data from the table is with the help of SELECT Statement, which is written as below :

SELECT * FROM Tablename

Example : SELECT * FROM AddressBook

The above statement shows all records with all fields from the table Addressbook.

To get the selective fields satisfying a particular criteria use the following statement. :

SELECT FIELD1, FIELD2, ..... FROM Tablename WHERE FIELD1 = Value1

Example : SELECT NAME, ADDRESS1, TELNO FROM ADDRESSBOOK WHERE NAME = "A.Symonds"

The above statement shows all records with fields Name, Address, Telno from the table Addressbook where the condition NAME = "A.Symonds" is satisfied.

For getting the data from two or more tables Use the following statements. Suppose there are two tables having differrent type of data but one field is comman, then a relation on such field can be created with the help of the following statements.

LEFT OUTER JOIN STATEMENT FOR SQL
SELECT Table1.field1, Table1.field2..., Table2.field1, Table2.field2, Table2.field4,.... FROM Table1 LEFT OUTER JOIN Table2 ON Table1.field1 = Table2.field1

In the above statment, field1 in table1 and field1 in table2 should have the same datatypes and lengths. All the records from the table 1 i.e. from the left hand side table of the clause "LEFT OUTER JOIN" will get diplayed with the only 'conditional criteria' satisfying records from the right hand side table of the clause "LEFT OUTER JOIN" i.e. Table2

Example : if two table table1 and table 2 are having following data then :

Data of table 1

fields - Name Address1 Address2 TelNo
Record 1 data "A.Symonds" "Gr.Floor, ABC Apartments" "XYZ Road, Area XMS" "5879879870"
Record 2 data "M. Jones" "3rd Floor, HTX Apartments" "GHJ Road, Area ZXC" "6548736843"
Record 3 data "G. Haynes" "2nd Floor, JUI Apartments" "RTY Road, Area OPU" "4564654879"

Data of table 2
fields - Name Address1 Address2 TelNo
Record 1 data "A.Symonds" "3rd Floor, UTV Apartments" "BHY Road, Area ADF" "4564897987"
Record 2 data "M. Jones" "Gr. Floor, AJH Apartments" "ATY Road, Area HTY" "4894465465"
Record 3 data "M. Koni" "4th Floor, RED Apartments" "MXS Road, Area NOT" "7897246814"

Continued on Next Page....