Syntax of SQL: SELECT & UPDATE statement
The screenshot below is an excel file that is accessed using WOW:
SQL SELECT statement syntax
Inside "testWOWExcel.xls" file, there are 3 excel worksheets by default which are sheet1, sheet2 and sheet3.
In this example, the data is on sheet1.
NOTE: The use of [ ] around the worksheet name and the trailing $ is a MUST while the use of [ ] around fields such as UserID, Firstname, etc is optional. This may be required on many systems.
Basic SQL Queries Using the SELECT Statement
SELECT * FROM [Sheet1$]
Other Queries Using the SELECT Statement
SQL allows you to select specific columns from a table.
SELECT Firstname, Lastname, workdept, salary FROM [Sheet1$]
Using a WHERE clause with the SELECT statement
SELECT Firstname, Lastname, workdept , salary FROM [Sheet1$] WHERE FirstName LIKE ?
...or...
SELECT * FROM [Sheet1$] WHERE workdept LIKE ?
NOTE: In a WOW application, the select statement written with "?" allows the end user to be prompted to generate results. The SQL statement including a "like" statement allows the end user to gather their information with a fuzzy search – or only needing to enter a portion of the query – i.e. last name/first name.
SQL UPDATE statement syntax
Basic SQL Queries Using the UPDATE Command
UPDATE [Sheet1$] SET [Bonus] = [Bonus] + '200'
Using a WHERE clause with the UPDATE statement
UPDATE [Sheet1$] SET [Bonus] = [Bonus] + '200' WHERE WORKDEPT =?
...or...
UPDATE [Sheet1$] SET [SALARY]= [SALARY] + 1000 WHERE WORKDEPT=?
Note: For more SQL syntax, click here.