C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » Databases »

frequently used sql commands


Posted Date: 08 Jul 2007    Resource Type: Articles    Category: Databases
Author: ChandraShekar ThotaMember Level: Diamond    
Rating: 1 out of 5Points: 10



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.






Responses

Author: vyj    10 Jul 2007Member Level: Bronze   Points : 0
Thank u.



Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Important Sql Interview Questions
Previous Resource: Difference between IDENT_CURRENT,SCOPE_IDENTITY and @@IDENTITY
Return to Discussion Resource Index
Post New Resource
Category: Databases


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use