sql-queries

How to parse a SQL Query statement for the names of the tables

I have a string representing a SQL query, and I need to extract the names of the tables from that string. For example: SELECT * FROM Customers Would return "Customers". Or SELECT * FROM Customers c, Addresses a WHERE c.CustomerName='foo' SELECT a.AddressZip FROM Customers c INNER JOIN Addresses a ON c.AddressId=a.AddressId Would r...