Tuesday, 13 December 2011

SELECT INTO

The SQL SELECT INTO statement is used to select data from a SQL database table and to insert it to a different table.         Syntax :  we can select only the columns we want into the new table: SELECT Column1, Column2, Column3, INTO Table2 FROM Table1 We can select all columns into the new table: SELECT * INTO Table2 FROM Table1 The "Pur" Table OrderNo custname ...

SQL FULL JOIN

The FULL JOIN keyword return rows when there is a match in one of the tables. Syntax  SELECT column_name(s) FROM table_name1 FULL JOIN table_name2 ON table_name1.column_name=table_name2.column_name Pur OrderNo custname city 1 Siva Srivilliputtur 2 Bala Sivakasi 3 Kanna Madurai PurDet sno OrderNo qty rate 1 2 50 70 2 ...

Monday, 5 December 2011

SQL LEFT JOIN & RIGHT JOIN

The SQL JOIN clause is used whenever we have to select data from 2 or more tables. To be able to use SQL JOIN clause to extract data from 2 (or more) tables, we need a relationship between certain columns in these tables                                                      ...

SQL INNER JOIN

The INNER JOIN keyword return rows when there is at least one match in both tables. SELECT column_name FROM table_name1 INNER JOIN table_name2 ON table_name1.column_name=table_name2.column_name The "Pur" table OrderNo Custname City 1 Siva Srivilliputtur 2 Bala Sivakasi 3 Kanna Madurai The "Purdet" table Sno OrderNo ...

SQL JOINS

JOIN: Return rows when there is at least one match in both tables LEFT JOIN: Return all rows from the left table, even if there are no matches in the right table RIGHT JOIN: Return all rows from the right table, even if there are no matches in the left table FULL JOIN: Return rows when there is a match in one of the tables...

SQL Alias

You can give a table or a column another name by using an alias Syntax  SELECT column_name AS alias_name FROM table_name AS alias_name The "custmast" table custcode custname city qty rate 1 Siva Srivilliputtur 50 70 2 Bala Sivakasi 30 56 3 Kanna Madurai 100 200 4 Vijay Chennai 30 30 5 Kodee Sandnes ...

Followers

Powered by Blogger.