RSS

Category Archives: SQL for Beginners

SQL for Begginers P1 : Basic structure of a select statement

Alright so I thought I would start with something simple such as sql. SQL is a powerful tool that is used to select data from a database. the basic structure of a sql statement is as follows.

SELECT this part of the statement tells the server what feilds you wish to get from the table

FROM this tells sql what tables you wish to pull from now there are many things that can constitute a table but for right now lets leave it simple

WHERE this tells the server what you do or don’t want shown by doing comparisons for any values you specify

alright so lets say i had a table called employees and in that table i had the employeeID, firstName, and lastName. Now lets say i wanted to select the first name and last name of the employee that had a id of 100 the query would look like this:

SELECT firstName, lastName

FROM dbo.employees

WHERE employeeID = 100

so to break it down I want to SELECT the first name and( , ) the last name of employeess and the information is stored in ( FROM ) the employees table but (where) i only want the information for the employee with a id number of 100

there ya go basic statement writing in sql.

 
Leave a comment

Posted by on October 31, 2011 in SQL for Beginners