Getting Data from a Database

If you have data in a database, you can use functions in Excel to retrieve data from a table in a database. To retrieve the data, you can select or create a data source, build a query to create a link to the data, and optionally , create a filter to limit the information. When you select or create a data source, you need to identify the database type and then connect to it. To build a query, you can use the Query wizard to step you through the process, or you can manually create a query the same way you do in Microsoft Access. If you use the same table in a database for data, you can define and save the data source for use later.

Define a New Data Source

graphics/one_icon.jpg

Click the Data menu, point to Import External Data, and then click New Database Query.

graphics/tow_icon.jpg

Click the Databases tab.

graphics/three_icon.jpg

Click <New Data Source>.

graphics/foure_icon.jpg

Click OK.

graphics/five_icon.jpg

Type the name of the source.

graphics/six_icon.jpg

Click the second box list arrow, and then click Microsoft Access Driver (*.mdb).

graphics/seven_icon.jpg

Click Connect.

graphics/eight_icon.jpg

Click Select.

graphics/nine_icon.jpg

Navigate to the folder with the database you want to use, and then click OK.

graphics/ten_icon.jpg

Click OK again.

graphics/leven_icon.jpg

Click the fourth box list arrow, and then click the default table for the data source.

graphics/towel_icon.jpg Click OK.

Follow the steps to create a query on the next page, starting with step 4.

graphics/12inf38.jpg

graphics/12inf39.jpg

Create a Database Query

graphics/one_icon.jpg

Click the Data menu, point to Import External Data, and then click New Database Query.

graphics/tow_icon.jpg

Click the Databases tab.

graphics/three_icon.jpg

Click the name of the data sources you want to use, and then click OK.

graphics/foure_icon.jpg

Click a table column name, and then click Add to add it to your query. Add the columns you want.

graphics/five_icon.jpg

Click Next to continue.

graphics/six_icon.jpg

Click the name of the column by which you want to filter the results.

graphics/seven_icon.jpg

Click the first comparison operator list arrow, and then click the operator you want to use.

graphics/eight_icon.jpg

Type the first value to use in the comparison

graphics/nine_icon.jpg

If necessary, type a second value in the second value box.

graphics/ten_icon.jpg

Click Next to continue.

graphics/leven_icon.jpg

Click the Sort By list arrow, and then click the name of the column by which to sort the query results.

graphics/towel_icon.jpg

Click Next to continue.

graphics/thatin_icon.jpg

Click Save Query, type a name for the query, and then click Save.

graphics/fourteen_icon.jpg

Click Finish.

graphics/fifteen_icon.jpg

Select an import option.

graphics/sixteen_icon.jpg

Click OK.

graphics/12inf40.jpg

graphics/12inf41.jpg

graphics/12inf42.jpg

graphics/12inf43.jpg



Show Me Microsoft Office Excel 2003
Show Me Microsoft Office Excel 2003
ISBN: 0789730057
EAN: 2147483647
Year: 2002
Pages: 291

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net