EmployeeID FirstName LastName Position
1 John Doe Analyst
2 Jane Doe Engineer
3 Mary Johnson Manager
2.BasicSQLSyntax
Let'slookatthefundamentalSQLcommands:SELECT,FROM,WHERE,GROUP
BY,HAVING,andORDERBY.
2.1SELECTandFROM
TheSELECTstatementisusedtoselectdatafromadatabase,andthe
FROMstatementspecifieswhichtabletogetthedatafrom.
SELECTFirstName,LastName
FROMEmployees;
ThisqueryretrievesallfirstandlastnamesfromtheEmployeestable.
Ifyouwanttoselectallcolumns,usethe*symbol:
SELECT*FROMEmployees;
2.2WHERE
TheWHEREclauseisusedtofilterrecords:
SELECT*
FROMEmployees
WHEREPosition='Analyst';
Thisqueryretrievesalldataforemployeeswhoareanalysts.
By:WaleedMousa