Linker IT Software
Google
Web www.oraxcel.com
menubar-top-links menubar-top-rechts
Home Help Search Login
Welcome, Guest. Please Login.
SQL*XL: Database to Excel bridge litLIB: Excel power functions pack ExcelLock: Locking and securing your valuable Excel spreadsheets encOffice: Protect your Excel file easy and safe encOffice: Protect your Excel file easy and safe
Pages: 1
How to retrieve data from the database. SQL primer (Read 4017 times)
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
How to retrieve data from the database. SQL primer
24.04.06 at 14:48:31
 
Andy from the UK asks the following question:
 
Question:
I have managed to connect to the database and I now need to understand how to extract the data from our database. Currently we use Crystal as the reporting engine which I have a strong dislike for. I need an independent way of providing my clients with bespoke views of the data. Clearly Excel is universally acceptable as a format.  
 
So, how do I retrieve my database data into Excel?
 
Answer:
To retrieve data from the database you use SQL (Simpel Query Language). I don't want to type a SQL primer here and there are many texts that will serve as a good basis. To start I suggest you use the SQL editor provided with SQL*XL. In the SQL dialog you can start the editor. Note that your database tables will be listed in the left pane of the editor. Select one of your tables and right click to create a select statement. The statement will look like this: select * from mytable.  
This translates to: give me everything in the mytable table.  
 
A table contains columns. For the column names open the table node and look at the columns section. To only retrieve a few columns and now all columns use the column names in the SQL: select column1, column3, column 5 from mytable.
 
This is as easy as it is. Now, if you want some columns but not all the rows you can use a so called where clause to limit the number of rows that are put in Excel. Suppose you have an employee table with the column salary. To select all employees with a salary higher than 100 run: select * from employee where sal > 100
 
You can enter as many criteria as you like. Example:
select * from employee where sal beteen 200 and 300 and city = 'NEW YORK'
This statement retrieves all employees in New York with a salary between 200 and 300.
Back to top
 
 

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Re: How to retrieve data from the database. SQL pr
Reply #1 - 23.08.08 at 16:12:14
 
Pages that may of interest are:
 
SQL: Standard Query Language:
http://www.oraxcel.com/lp/sql.html
 
SQL Query / SQL Select
http://www.oraxcel.com/lp/sqlquery.html
Back to top
 
 

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Pages: 1