SQL or Structured Query Language is the most common language used to retreive data from a DBMS. SQL is written in a certain form so that it can be properly understood by the DBMS in order to return the desired information. It is a skill which requires much practice, when dealing with any database. The more entities and data in a given database, the more complex the SQL needed to retreive data. SQL is not only used to retreive data, but also to manage data in a DBMS.
Examples
1-
SELECT DISTINCT FirstName FROM tblPeople;
Result: a list of people's first names with no names duplicated.
2-
SELECT TOP 2 FirstName, LastName, Sex, Salary
FROM tblPeople
ORDER BY Salary;
Result: four fields for the two lowest paid employees.
3-Result: one field (and one record) holding average Salary.
SELECT Avg([Salary]) AS AvgSalary FROM tblPeople;
References
Jessup, Valacich & Wade. (Prentice Hall, Toronto). Information Systems Today: Why IS matters? 2006

No comments:
Post a Comment