Presentation is loading. Please wait.

Presentation is loading. Please wait.

3 / 12 CHAPTER Databases MIS105 Week-10/ Lec02 Irfan Ahmed Ilyas.

Similar presentations


Presentation on theme: "3 / 12 CHAPTER Databases MIS105 Week-10/ Lec02 Irfan Ahmed Ilyas."— Presentation transcript:

1 3 / 12 CHAPTER Databases MIS105 Week-10/ Lec02 Irfan Ahmed Ilyas

2 11 CE 2 © The McGraw-Hill Companies, Inc. 2000 Ch 11 … Competencies 1.Working with SELECT Queries 1.Field Computation Queries 2.Summary Queries 3.Use of Groups in Summary Queries 2. Update Queries 3. Delete Queries 4. Append Queries 5. Make Table Queries 6. Cross Tab Queries

3 11 CE 3 © The McGraw-Hill Companies, Inc. 2000 Ch 11 4. SELECT Queries: Computed Fields When ? –a required field is not available in the query source How ? –Another field could be used to calculate the required field –A calculated field is created –Calculation is done on every record basis

4 11 CE 4 © The McGraw-Hill Companies, Inc. 2000 Ch 11 …Computed Fields Example –FACULTY table having details about faculty members –A query needs to show WorkingYears for each faculty member –Not available in the table –Can be calculated for each record as WorkingYears: 2001 –[ YR_JOINED] Query Result

5 11 CE 5 © The McGraw-Hill Companies, Inc. 2000 Ch 11 5. SELECT Query: Summary Queries When? –Some calculation is needed on All table records Group of table records How to make? –Such queries do not show all fields –Only show some calculated results for all records\ each record group

6 11 CE 6 © The McGraw-Hill Companies, Inc. 2000 Ch 11 …Summary Queries Example 1 –STUDENT table having information about student scores Query Result Summary Query to show the Average Scores Automatically Assigned Label (AvgOfQuiz)

7 11 CE 7 © The McGraw-Hill Companies, Inc. 2000 Ch 11 …Summary Queries Example 2 –Average of Quiz scores for student groups in different majors Summary Query to show the Quiz Average for each Major Query Result Label used (AvgOfQuiz)

8 11 CE 8 © The McGraw-Hill Companies, Inc. 2000 Ch 11 Update Queries Allow you to quickly update all\ selected records Creation Process –Write a SELECT Query for proper record selection –Change the Query to UPDATE type –Specify the field name(s) to be updated –Provide New value(s) for the mentioned fields

9 11 CE 9 © The McGraw-Hill Companies, Inc. 2000 Ch 11 …..Update Queries Example –Employee table –Salary for all employees having ID#>2 will be updated to 2000 Query Result

10 11 CE 10 © The McGraw-Hill Companies, Inc. 2000 Ch 11 DELETE Queries Allow you to quickly delete all\ selected records Creation Process –Write a SELECT Query for proper record selection –Change the Query to DELTE type

11 11 CE 11 © The McGraw-Hill Companies, Inc. 2000 Ch 11 …..DELETE Queries Example –Employee table –All employees having ID#>2 will be deleted Delete Criteria Query Result

12 11 CE 12 © The McGraw-Hill Companies, Inc. 2000 Ch 11 Append Queries Used for entering new records to an existing table. The data can be entered either: –as literals (constant number or string values) OR –As rows from another source table (Source table having the similar record structure to the destination table)

13 11 CE 13 © The McGraw-Hill Companies, Inc. 2000 Ch 11 …Append Queries Example: –Entering new record in ‘Locations’ table.

14 11 CE 14 © The McGraw-Hill Companies, Inc. 2000 Ch 11 Make Table Queries Used to create new tables in the database Table name needs to be entered The data can be entered either: –as literals (data type will automatically be set) OR –As rows from another source table (data type will exactly match with the field types of the source table)

15 11 CE 15 © The McGraw-Hill Companies, Inc. 2000 Ch 11 …Make Table Queries Example: –Creating a new table ‘DUMMY’ with two fields: ID & Name

16 11 CE 16 © The McGraw-Hill Companies, Inc. 2000 Ch 11 Cross Tab Queries Used to generate summary information in a more readable way Generate displays close to Pivot tables. –Rows contain all possible values of some filed –Columns contain all possible values of some other filed –At cross-section of each some summary information is presented.

17 11 CE 17 © The McGraw-Hill Companies, Inc. 2000 Ch 11 …Cross Tab Queries Example: –Counting Employees on the basis of Titles & Locations


Download ppt "3 / 12 CHAPTER Databases MIS105 Week-10/ Lec02 Irfan Ahmed Ilyas."

Similar presentations


Ads by Google