DBMS: Executing Queries over Tables in M.S. Access


Here we'll run queries on the table I have created in earlier post.



1. Prepare a query to display only records including BName, WName and PName. Save the Query as "q-book".

i) Go to 'Create tab', under 'Other Group', select 'Query Design'. A dialog box will appear.
ii) In this dialog box, we have to select the tables and queries that we want to include in our resultant query. Here, we have to select only 'Book' table.
iii) Click on 'Add' button and then on 'Close'.





iv) Save the query by right clicking the 'Query tab' and selecting 'Save'. Type the new name 'q_book'.
v) Now switch to 'SQL View' by right clicking the 'q_book tab' and selecting 'SQL View'.
vi) In the SQL View the following line-
Select BName, WName, PName, from Book;
vii) Save the query. To see the resultant table of query, switch to 'Datasheet View'.








2. Prepare a query to display all the records on the basis of price which is more than Rs 500.

i) Go to 'Create Tab', under 'Others Group', select 'Query Design'.
A dialog box will appear.
ii) In this dialog box, we have to select the tables and queries that we want to include in our resultant query. Here, we have to select only 'Book' table.
iii) Click on 'Add' button and then on 'Close'.




iv) Save the query by right clicking the 'Query tab' and selecting 'Save'. Type the new name 'q_price'.
v) Now switch to 'SQL View' by right clicking the 'q_price tab' and selecting 'SQL View'.

vi) In the SQL View the following line-
Select * from Book where Price>500;
vii) Save the query. To see the resultant table of query, switch to 'Datasheet View'.








3. Perpare a form on the basis of table 'Book'.

i) Select the table 'Book'. 
ii) Go to 'Create Tab', under 'Forms Group', select 'Form'.
iii) A form will automatically be generated containing the details of your table 'Book'.








4. Prepare a report on the basis of query named 'q_book'.

i) Select the query 'q_book'. 
ii) Go to 'Create Tab', under 'Reports Group', select 'Report'.
iii) A report will automatically be generated containing the details of your query 'q_book'.





Comments

Popular Posts