Question:- Complete the following tasks in MS Access database.
a) Create a table with Product ID, Product Name, Product Detail, and Product Amount.
b) Create a form and enter at least 3 products.
c) Create a query that gives the maximum amount for the products entered (i.e. highest price of the given products.)
Solution:-
a) To create a database and table.
Step 1:- Launch Access 2007, you will see the Getting Started window.
Step 2:- Rename the database as “Productdatabase”. Click Create to finish naming the database.
Step 3:- You will want to name your tables based on your database design plan.
Step 4:- To give the table a unique name, you must first click on the Microsoft Office button in the upper-left corner of the application. Next, select Save from the menu. The Save As dialog box will appear to let you save the table name “Product”.
Step 5:- By default, Access 2007 creates one field in each new table: the ID field. This field auto-numbers to give each record in the table a unique number identifier.
Step 6:- To add more fields to a table in Datasheet view, double-click the Add New Field header.
Next, we've added the fields Product_ID, Product Name, Product Detail and Product Amount and save the Product table.
b) To create a form and enter 3 records.
Step 1:- Begin by highlighting the table you want to use as a source table.
Step 2:- With the source table highlighted, select the Form command from the Forms command group in the Create tab on the Ribbon.
Step 3:- The new form is created and opens in the object pane.
Step 4:- Switch in Form View to enter records.
Step 5:- Navigate to a new record, either by using the New Record navigation button or by using the New command in the Records group on the Ribbon of Home Tab.
Step 6:- Add the new data and Save the record.
c) Create a query that gives the maximum amount for the products.
Step 1:- Select the Create tab. Then click on the Query Design button under the Other group.
Step 2:- Next, highlight the Product table and clicked on the Add button. When you are done selecting the tables, click on the Close button.
Step 3:- Add the fields to the query. You can do this by double-clicking on the field name. In this example, we've added the Product Name and Product Amount.
Step 4:- Then click on the Save button at the top left of the window.
Step 5:- The Save As window should appear. Enter the name that you'd like to assign to the query and click on the OK button. In this example, we've saved the query as “MaxpriceQuery”.
Step 6:- Click on Total button under Show/Hide Group in Design Tab.
Step 7:- In Product Amount field, Select Sum function from Total and Select Descending from Sort.
Step 8:- Select 1 value in Return Field under Query Setup of Design Tab and Run Query. Select 1 value is used return (display) only one record from table.
Step 9:- That’s all for displaying maximum price value for products.
No comments:
Post a Comment