Thursday, March 19, 2009

Using MS Access Queries to retrieve and display data

Using SQL VIEW or DESIGN VIEW to display, delete, update or insert data.

a.1 SELECT statement

Selecting All Columns

SQL script: Type the sql script in the SQL view of a query as in the
lines below.

Select * from tablename

--- or ---

Go to query design view as shown below.

Microsoft Access Design View:

1. Drag the asterisk of the selected table in the table or query area to
the design grid. Click Run button or View button.

See picture below.






Selecting Columns and Changing Column sequence


SQL script: Type the sql script in the SQL view of a query.


Select columname, columname, columname from tablename


Microsoft Access Design View:



1. Drag the column names of the selected table in the table or query area to the design grid according to your preferred sequence. Click Run button or View button.


Manipulating Column Names



Select columname as name, columname as name from tablename


In design view:

Change the name of the column by typing the preffered name before the column name as in the example: Accountnumber: acct_no

Accountnumber is the preffered name

acct_no is the fieldname or column name in the database



a.

No comments:

Post a Comment