cst221: database systems (ii) dr. zhen jiang computer science department west chester university...

116
CST221: Database Systems (II) Dr. Zhen Jiang Computer Science Department West Chester University West Chester, PA 19383

Upload: zaria-lemmons

Post on 30-Mar-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

  • Slide 1

CST221: Database Systems (II) Dr. Zhen Jiang Computer Science Department West Chester University West Chester, PA 19383 Slide 2 Querying Creation (Query wizzard) Save Use Slide 3 Wildcard (*, ?), page AC87 Use criteria for a field not included in the result list, page AC88 Parameter Query, page AC89 Join table, page AC103 Comparison Operator, page AC94 Compound criterion (AND, OR), page AC 95 Sorting, page AC97 Omitting duplicates, page AC 100 Multiple keys (high priority from left to right), page AC101 Top-value query, page AC 102 Calculated field, page AC 113 Calculating Statistics (built-in statistics, group), page AC 117 Slide 4 Exercise 2 Slide 5 Slide 6 Slide 7 Slide 8 Slide 9 Show the name and age and salary of all employees who are younger than 25. Slide 10 Double click the items to include in the list Slide 11 Slide 12 Slide 13 Slide 14 Add criteria to meet the certain requirement Slide 15 Slide 16 Datasheet view Design view Slide 17 Slide 18 Hidden column for criteria (not displayed in the list) Slide 19 Wildcard (*, ?), such as Ber* in City field Use criteria for a field not included in the result list, disabled show property One table, decide it early and add all fields at the beginning Comparison Operator, such as >10000 in amount paid field Compound criterion (AND => 1 row, OR => another row) Sorting Omitting duplicates, unique record in property sheet Multiple keys (high priority from left to right) Top-value query, return in top design view (very early stage) Calculated field, zoom in shortcut menu (e.g., type Total Amount:[Amount Paid]+[Current Due]) Calculating Statistics (built-in statistics, group by) Slide 20 Show the Enum, name, salary of all employees whose names have 5 letters. Slide 21 Slide 22 Slide 23 Slide 24 Slide 25 Slide 26 Show the name, Enum,salary, and age of all employees with a salary > $40,000 AND younger than 25 Slide 27 Slide 28 Slide 29 Slide 30 Slide 31 Slide 32 Show the Enum of all employees sorted by salary in the ascending order Slide 33 Hidden column for criteria (not displayed in the list) Slide 34 Slide 35 List all different Dnum, without duplicates. Slide 36 Slide 37 Slide 38 Slide 39 List top 5 high paid employees. Slide 40 Slide 41 Slide 42 List the LName of all employees in the department (Dnum) entered by the user. Slide 43 Slide 44 Slide 45 Slide 46 Slide 47 Slide 48 Slide 49 Slide 50 List the LName of all employees with a new column labeled hiring age, which has a value by subtracting the years of working (wYears) from the current age (age). Slide 51 Slide 52 Slide 53 Slide 54 Slide 55 Slide 56 List the max, min, and average of salary for all employees. Slide 57 Slide 58 Slide 59 Slide 60 Slide 61 Slide 62 Slide 63 Joint table (AC 105-109) Dept DnumDnameCity D22Web WC D25Databases NY D28Software LA Emp EnumLNameagesalaryDnumwYears E101Jones45$56,000.00D2512 E202Anders66$46,000.00D2225 E303Smith34$25,000.00D229 E404Rivera22$30,000.00D251 E505Brown45$80,000.00D2517 E606Caldwell52$70,000.00D2820 E707Stiles44$65,000.00D2811 E808Walker48$90,000.00D2221 E909Hartman20$25,000.00D281 E222Carter29$35,000.00D253 Slide 64 For each employee, print out the department name. Slide 65 Slide 66 Slide 67 Slide 68 Slide 69 Slide 70 Slide 71 Assignment 2 Slide 72 Statistics of an group Exercise 3 Slide 73 Show the average age (label as average age) and average salary (label as average salary) for all employees Slide 74 Slide 75 Slide 76 Slide 77 Slide 78 Slide 79 Show the max, min and average age for all employees in Dept Software Slide 80 Slide 81 Slide 82 Slide 83 Still incorrect! Slide 84 Slide 85 Slide 86 Join Table (AC 105) Slide 87 For all employees under 30, show a count of these employees and their average salary. Slide 88 Slide 89 For all employees in department D22 or D28, show a count of these employees, their average age, and maximum salary Slide 90 Slide 91 Slide 92 Slide 93 Slide 94 Slide 95 Slide 96 For each department list avg, max and min age, along with a count of employees in each department. Slide 97 Slide 98 Slide 99 Slide 100 Slide 101 For each department find a count and average salary for all employees younger than 40. Slide 102 Slide 103 Slide 104 Slide 105 Slide 106 For each department with an average salary of >40000 list the dnums, employee count for these departments. Slide 107 Slide 108 Slide 109 For each department with less than 4 employees, show the average age and number of employees. Slide 110 Slide 111 Slide 112 For each department with more than 2 people over 40 list deptNum, and a count of these people. Slide 113 Slide 114 Slide 115 Assignment 3 Slide 116 Maintenance Record addition, page AC 144 Search, page AC 145 Record update, page AC 147 Record deletion, page AC 148 Filter, page AC 149