Home | Articles|Namespace|Interview Questions|Tools|Jobs|Projects|Community
Asp.net Tutorials

»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books

»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects

»Competition
Community
Winners
Prizes
Write For Us
Members

»Other Resources
Links
Dotnet Resources

frequently used sql commands

commonly used sql commands




lets know initially what is sql and how to use it




SQL is a standard computer language for accessing and manipulating databases

if we see carefully while using sql we use joins orderbys etc very commonly

The ORDER BY clause is used to sort the rows

some sample quer
SELECT Company, OrderNumber FROM Orders
ORDER BY Company


AND and OR join two or more conditions in a WHERE clause.

SELECT * FROM Persons
WHERE FirstName='Latha'
AND LastName='Chandu'


Use OR to display each person with the first name equal to "Latha", or the last name equal to "Chandu":

SELECT * FROM Persons
WHERE firstname='Latha'
OR lastname='Chandu'

The IN operator may be used if you know the exact value you want to return for at least one of the columns.

SELECT * FROM Persons
WHERE LastName IN ('chandu','latha')


The BETWEEN ... AND operator selects a range of data between two values.


To display the persons alphabetically between (and including) "chandu" and exclusive "latha", use the following SQL:

SELECT * FROM Persons WHERE LastName
BETWEEN 'chandu' AND 'latha'


With SQL, aliases can be used for column names and table names.


Sometimes we have to select data from two or more tables to make our result complete. We have to perform a join.


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.

SELECT E_Name FROM Employees_visualsoft
UNION
SELECT E_Name FROM Employees_Megasoft










so friends try to use some queries like above while dealing with typical database queries.


Have a Question and dont know the answer post it below and get answers in minutes

Due to spam this feature is disabled
To get answers fast , make sure you enter a detailed subject for example: "DataGrid issues need answer" not "DataGrid"

Subject:

Catjegory Name:

Message:



© 2008 dotnetwatch.com -- Privacy policy

Website Design & Internet Marketing by Shivam