Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

C h a p te r 2 I n t ro d u c i n g t h e Fi l e M a k e r A rc h i te c t u re 25 The heart of SQL is the syntax for a query. A query has the following basic form: SELECT <column> FROM <table> WHERE <some condition applies>; Thus, a SQL statement could be as follows: SELECT name FROM employees WHERE department = "Sales"; SQL statements end with semicolons in many implementations, and capitalization does not matter. However, for ease of reading and by convention, the reserved words in SQL are often capitalized as they are in these examples. Additional clauses can be added as in the following example: SELECT name FROM employees WHERE department = "Sales" ORDER BY employment_date; In addition, you can retrieve data from several tables at a time, as in the following query: SELECT name, salary FROM employees, employee_terms WHERE department = "Sales" AND name = employee_terms_name ORDER BY employment_date; There is much more to SQL, but this gives you a flavor of the main features. There is comparable syntax to insert data into tables, and there is a great deal of syntax enabling a database administrator to control access to the database.