* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Sorting a Database
Survey
Document related concepts
Commitment ordering wikipedia , lookup
Microsoft Access wikipedia , lookup
Microsoft SQL Server wikipedia , lookup
Serializability wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Oracle Database wikipedia , lookup
Ingres (database) wikipedia , lookup
Functional Database Model wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Relational model wikipedia , lookup
Concurrency control wikipedia , lookup
Database model wikipedia , lookup
Transcript
COURSE: Digital Communication Systems UNIT: E Database COMPETENCY: 007 Use database software using traditional and alternative input methods. OBJECTIVE: 007.01 Explain database fundamentals. ACTIVITIES Teacher Tip Activity Activity Activity Quiz Activity RESOURCES Use the classic example of the filing cabinet to introduce the need for electronic databases. Explain to students that data entry in databases can be performed in several ways. (i.e. dictation, keyboard, mouse, scanners, PDAs.) Use the PowerPoint presentation to provide the information needed for this competency. This can be done electronically with a data projector, or you may choose to print each slide on a transparency. It is recommended that you give the students a copy of the PowerPoint handouts for their notes. Slide Show E701 Handout E701-01 Databases Give the students the handout entitled Database Vocabulary. This is an excellent resource for students learning basic terminology. Handout E701-02 Database Vocabulary Give the students the activity entitled Database Uses. Activity and Key E701-03 Database Uses Give the students the activity entitled Check Your Understanding. This activity can be used as an in-class activity or quiz. Quiz and Key E701-04 Check Your Understanding Allow students to search the web for forms to input data. Explain to them that the information entered is being submitted to a database on a server. Allow students to input data via keyboard into these forms. Internet Database Use database software using traditional and alternative input methods. E7-1 Handout E701-01 Databases – PPT Presentation D701 Slide 1 ___________________________________ Databases ___________________________________ ___________________________________ ___________________________________ ___________________________________ ___________________________________ Slide 2 ___________________________________ What is a Database? •A database is an organized collection of related information. •An electronic database is an efficient means of storing and retrieving data and printing reports from the stored data. ___________________________________ ___________________________________ ___________________________________ ___________________________________ ___________________________________ Slide 3 ___________________________________ Commonly used databases Address books Dictionaries Encyclopedias Library card catalogs Patient data Student data Telephone directories ___________________________________ ___________________________________ ___________________________________ ___________________________________ ___________________________________ Slide 4 ___________________________________ Advantages of an electronic database Accurate, quick and efficient arrangement of data in alphabetical or numerical order Ability to find and retrieve data Ability to generate reports on the database Ease of editing existing data ___________________________________ ___________________________________ ___________________________________ ___________________________________ ___________________________________ Database Use database software using traditional and alternative input methods. E7-2 Slide 5 ___________________________________ ___________________________________ Steps to design a database Plan and design the database according to needs and requirements Determine the fields or categories that will be used in the database Determine field properties to include size and type 1. 2. 3. ___________________________________ ___________________________________ ___________________________________ ___________________________________ Slide 6 ___________________________________ Techniques/Devices to input data ___________________________________ ___________________________________ Keyboard Mouse PDA’s Scanners Speech Recognition Software Web forms ___________________________________ ___________________________________ ___________________________________ Slide 7 ___________________________________ Terminology ___________________________________ An entry is data that is in a field ___________________________________ A field is one category of information A field name is the title that is assigned to a field ___________________________________ A record is a group of related fields of one item of information in the database ___________________________________ A file is the collection of related records. ___________________________________ Slide 8 ___________________________________ ___________________________________ Example of an entry State Zip ___________________________________ 33 East Street Silas NC 22558 ___________________________________ Juan 76 Liberty Rd NC 55987 Sarah 26 Main Street Oakwood NC 44897 Last Name First Name Address Adams Tom Goins Sawyer City Bogard ___________________________________ ___________________________________ Database Use database software using traditional and alternative input methods. E7-3 Slide 9 ___________________________________ ___________________________________ Examples of fields State Zip ___________________________________ 33 East Street Silas NC 22558 ___________________________________ Juan 76 Liberty Rd NC 55987 Sarah 26 Main Street Oakwood NC 44897 Last Name First Name Address Adams Tom Goins Sawyer City Bogard ___________________________________ ___________________________________ Slide 10 ___________________________________ ___________________________________ Examples of records State Zip ___________________________________ 33 East Street Silas NC 22558 ___________________________________ Juan 76 Liberty Rd NC 55987 Sarah 26 Main Street Oakwood NC 44897 Last Name First Name Address Adams Tom Goins Sawyer City Bogard ___________________________________ ___________________________________ Slide 11 ___________________________________ ___________________________________ Example of database file State Zip ___________________________________ 33 East Street Silas NC 22558 ___________________________________ Juan 76 Liberty Rd NC 55987 Sarah 26 Main Street Oakwood NC 44897 Last Name First Name Address Adams Tom Goins Sawyer City Bogard ___________________________________ ___________________________________ Slide 12 ___________________________________ Typical views of a database List view Form view – – – Displays several records on the screen at a time Displays one record on the screen at a time. Commonly used in data entry. ___________________________________ ___________________________________ ___________________________________ ___________________________________ ___________________________________ Database Use database software using traditional and alternative input methods. E7-4 Slide 13 ___________________________________ ___________________________________ General data types – These numbers can be used in calculations ___________________________________ Currency ($) Date (03/03/03) Numeric (450) Text/General (Smith) – Numbers may used, but would not be computed ___________________________________ I.E. Gross pay, basketball statistics, etc. I.E. Social security numbers, telephone numbers, etc. Slide 14 ___________________________________ ___________________________________ ___________________________________ Sorting to arrange data in alphabetical or numerical order – ___________________________________ Ascending order (1-10 or A-Z) – 1,2,3,4,5 Adams, Petteway, Rodriquez ___________________________________ Descending order (10-1 or Z-A) – – ___________________________________ 5,4,3,2,1 Rodriquez, Petteway, Adams ___________________________________ ___________________________________ Slide 15 ___________________________________ ___________________________________ Primary/Secondary Sorts Primary key: The field selected as the unique identifier for the database.(i.e. Student number) Primary sort: The first field that a database is sorted on. Secondary sort: The second field that a database is sorted on. Primary Key: Student No. Primary Sort: Last name (in Descending order) Student Last No. Name Age Grade 001 Pate 12 6 005 Brown 14 8 010 Brown 16 10 ___________________________________ ___________________________________ ___________________________________ Secondary Sort: Age (in ascending order) Slide 16 ___________________________________ ___________________________________ Searching/Querying/Filtering to find specific data based upon a given criteria or condition ___________________________________ Queries/Filters use connectors and comparison operators to define the search criteria ___________________________________ – – Connectors (AND, OR, NOT) Comparison operators (<, >, <=, >=, =, <>) ___________________________________ ___________________________________ ___________________________________ Database Use database software using traditional and alternative input methods. E7-5 Handout E701-02 Database Vocabulary Ascending — Sorting data in alphabetical order from A-Z or numerical order from 0-9. Comparison Operators — Symbols used in search criteria. (>, <, =, >=, <=, <>) Connectors — Words such as AND, OR and NOT that join certain conditions together when performing a search. Currency — A numeric type which add a $ sign to number. Database - An organized collection of information. Database Management System — Software that allows the computer to create a database; add, change, and delete data in the database; sort the data; retrieve the data; and create forms and reports using the data in the database. Date data — Entries in a database that are formatted for data in a particular style. (i.e. 04/15/03 or April 16, 2003) Descending — Sorting data the opposite of ascending order. (Z-A & 9-0) Entry — Data that is keyed into a field. Field — A category of information in a database. File — A group of related records. Filter/Query/Search — A method to find specific data within a database that meets certain criteria. Form view — A method of viewing or inputting data that displays only one record at a time. List view — A method of viewing or inputting data that displays several records at a time. Numeric data — Entries in a database that are formatted for numbers and can be used in a calculation. Primary key — The field selected as a unique identifier for the database. Primary sort — The first field that a database is sorted on. Record — A group of fields related to one topic. Sort - To arrange data in alphabetical or numerical order. Text data — Entries in a database that represent text; such as, phone numbers, names, colors. Database Use database software using traditional and alternative input methods. E7-6 Handout E701-03 Database Uses Directions: Read the following statements place a check mark on the items that would require the use of database software. _____1. To complete the payroll for a business. _____2. To type a memorandum to the employees in the office. _____3. To keep a list of friends and family addresses to mail Christmas cards. _____4. To update patient information at a hospital. _____5. To maintain a grade book for students. _____6. To delete a customer from the telephone book. _____7. To arrange an inventory list in alphabetical order. _____8. To generate a report from student data. _____9. To type a report for a history class. _____10. To create a slide for a presentation in math class. Database Use database software using traditional and alternative input methods. E7-7 Quiz E701-04 Check Your Understanding True/False 1. _____Databases can contain both text and numeric data. 2. _____The most widely used database view to input data is the List View. 3. _____A collection of database records is known as an entry. 4. _____A record is a collection of related fields. 5. _____A query is used to arrange data in ascending order. Fill-In-The-Blank 6. __________Another name for a category of information used in a database. 7. __________A database view that displays only one record on the screen. 8. __________A database view that displays several records on the screen. 9. __________To arrange data. 10. __________A type of sort that arranges data from A-Z. 11. __________A type of sort that arranges data from 10-1. 12. __________The field that is used as an unique identifier. 13. __________A type of sort that is performed after the primary sort is defined. 14. __________A name given to a field in the database. 15. __________Operators, such as (<, >, =), that are used to define the search criteria. Listing List four advantages of using an electronic database. 1. 2. 3. 4. Database Use database software using traditional and alternative input methods. E7-8 COURSE: Digital Communication Systems UNIT: E Database COMPETENCY: 007 Use database software using traditional and alternative input methods OBJECTIVE: 007.02 Create, sort, edit, and query a database ACTIVITIES RESOURCES Teacher Tip Use a variety of input devices to enter data. (i.e. speech recognition software, keyboard, mouse, web forms) Internet for web forms Teacher Tip Demonstrate the software techniques to edit a database (i.e. adding fields and records). Data projector Teacher Tip Demonstrate the software techniques to sort and query/filter a database. Data projector Give the students the Identify Database Components activity. The activity will help reinforce their understanding of database parts and sorting. Activity and Key E702-01 Identify Database Components Give the students the Top Ten Greatest Albums Database activity. Students should input the data using various methods. Emphasis should be placed upon entering the data with accuracy—future queries depend upon data accuracy. Activity E702-02 Top Ten Greatest Albums Database Give the students the Editing/Sorting a Database-Top Ten Greatest Albums activity. The students should write their answers to the sorts on the handout provided. Activity and Key E702-03 Editing/Sorting a Database Give the students the Searching a Database-Top Ten Greatest Albums activity. The students should write their answers to the searches on the handout provided. Activity and Key E702-04 Searching a Database Give the students the Award Winning Books Database activity. Students should input the data using various methods. Emphasis should be placed upon entering the data with accuracy—future queries depend upon data accuracy. Activity E702-05 Award Winning Books Database Activity Activity Activity Activity Activity www.rockonthenet.com Database Use database software using traditional and alternative input methods. E7-9 ACTIVITIES Activity Activity Activity RESOURCES Give the students the Sorting a Database - Award Winning Books activity. The students should write their answers to the sorts on the handout provided. Activity and Key E702-06 Sorting a Database Give the students the Searching a Database -Award Winning Books activity. The students should write their answers to the queries on the handout provided Activity and Key E702-07 Searching a Database Give the students the Database Form Activity. The students should load the file name E702, located on the DCS curriculum CD. You many wish to copy this file to their PCs prior to the activity. Microsoft Access should be used to open the file. The students should use voice recognition software to dictate the data given. Activity and Key E702-08 Database Form Microsoft Access Voice Recognition Software Database Use database software using traditional and alternative input methods. E7-10 Activity E702-01 Identify Database Components Directions: Using the database below, fill in the blanks with the correct answer or database term. Last Name First Name Smith Carter Allen Stacy Sherrell Donald Employee Number 001 002 003 Hours Worked Rate of Pay 40 30 25 Gross Pay 5.00 7.00 10.00 200.00 210.00 250.00 __________1. How many fields are in the database? __________2. How many records are in the database? __________3. How should the data in the “First Name” field be formatted? __________4. How should the data in the “Hours Worked” field be formatted? __________5. How should the data in the “Employee Number” field be formatted? __________6. How should the data in the “Rate of Pay” field be formatted? __________7. How is the data in the “Last Name” field sorted? __________8. How is the data in the “Rate of Pay field sorted? __________9. How should the data in the “Gross Pay” field be formatted? __________10. What fields will be used to compute the value of “Gross Pay.” __________11. Which field could be used as the primary key in this database. Database Use database software using traditional and alternative input methods. E7-11 Activity E702-02 Top Ten Greatest Albums Database Directions: In this exercise, you will create a database of the Top 10 Greatest Albums. Note that many of the fields contain text, while others may contain a number. You will need to designate what kind of fields are in this database as you create the fields. Enter the data accurately and check your work. It is very important that all words and numbers are keyed correctly. Save this file as “Albums,” as you will be using it at a later date. Print the database upon completion. Album Artist Their Greatest Hits: 19711975 Thriller The Wall Led Zeppelin IV Greatest Hits, Volumes 1 and 2 (1973-1985) The Beatles (The White Album) Back in Black Come On Over Rumors The Bodyguard (Soundtrack) Eagles, The No. Albums Sold 28,000,000 Jackson, Michael Pink Floyd Led Zeppelin Joel, Billy 26,000,000 23,000,000 22,000,000 21,000,000 Beatles, The 19,000,000 AC/DC Twain, Shania Fleetwood Mac Houston, Whitney 19,000,000 19,000,000 19,000,000 17,000,000 Database Use database software using traditional and alternative input methods. E7-12 Activity E702-03 Editing/Sorting a Database Top Ten Greatest Albums Directions: Retrieve the database called “Albums.” Demonstrate your understanding of editing and sorting a computerized database by answering the questions below. Editing a Database 1. Add the following records to the database. Boston No Fences Jagged Little Pill Cracked Rear View The Beatles 1967-1970 Hotel California Appetite for Destruction Greatest Hits Dark Side Of The Moon Born In The U.S.A. Boston Brooks, Garth Morissette, Alanis Hootie & The Blowfish Beatles, The Eagles, The Guns N’ Roses John, Elton Pink Floyd Springsteen, Bruce 16,000,000 16,000,000 16,000,000 16,000,000 16,000,000 16,000,000 15,000,000 15,000,000 15,000,000 15,000,000 2. Add a “Rank” field to the database before the “Album” field. Input the data in the “Rank” field based upon the number of albums sold. (i.e. 1,2,3, etc.) 3. Print the database. Sorting a Database 1. Sort the database in alphabetical order by “Artist.” List the first 3 artists: _______________________________________________ 2. Sort the database to determine the artist(s) with the lowest number of albums sold. List the artist(s): ___________________________________________________ 3. Sort the database to determine the artist(s) with the highest number of albums sold. List the artist(s): ___________________________________________________ Database Use database software using traditional and alternative input methods. E7-13 Activity E702-04 Searching a Database Top Ten Greatest Albums Directions: Retrieve the database called “Albums.” searching a database by answering the questions below. Demonstrate your understanding of Simple searches—Search the database and find the record(s) that match the criteria in each question. List the field and the criterion that you used to find your answer. Use the example below as a guide. Same Question: How many albums sold 19 million? Field: No. Album Sold Criterion: =19,000,000 Answer: 4 1. Query/Filter the database to find the artist that performed the “Thriller” album. Field: Criterion: Answer: 2. Query/Filter the database to find the artist that sold 21 million albums. Field: Criterion: Answer: 3. Query/Filter the database to find the artist(s) that sold more than 20 million albums. Field: Criterion: Answer: 4. Query/Filter the database to find the album(s) that sold at least 25 million. Field: Criterion: Answer: 5. Query/Filter the database on the artist “Eagles, The” to determine how many times they appear on the Top Twenty chart. Field: Criterion: Answer: Database Use database software using traditional and alternative input methods. E7-14 Activity E702-04 Page 2 6. Query/Filter the database to find the album that sold 17 million copies. Field: Criterion: Answer: 7. Query/Filter the database to find how many total albums were sold for Garth Brooks. Field: Criterion: Answer: 8. What was the name of the Album found above?____________________________ 9. Query/Filter the database to find the artist(s) who sold at least 17 million but no more than 20 million. Field: Criterion: Answer: 10. How many albums sold 16 million? Field: Criterion: Answer: Database Use database software using traditional and alternative input methods. E7-15 Activity E702-05 Award Winning Books Database Directions: In this exercise, you will create a database of the following award winning books. Note that many of the fields contain text, while others may contain a number or a date. You will need to designate what kind of fields are in this database as you create the fields. Enter the data accurately and check you work. It is very important that all words and numbers are keyed correctly. Save this file as “Booklist,” as you will be using it at a later date. Title The Stone Diaries Walk Two Moons Breathing Lessons Number The Stars The Making of The Atomic Bomb Rabbit At Rest Author Shields, Carol Creech, Sharon Tyler, Anne Lowry, Lois Rhodes, Richard Updike, John The Shipping Proulx, News Annie Lincoln: A Freedman, Photobiography Russ The Mambo Hijuelos, King Plays Oscar Songs of Love Lonesome Dove McMurty, Larry A Bright, Sheehan, Shining Lie Neil Maniac McGee Spinelli, Jerry A Thousand Smiley, Acres Jane The Prize: The Yeargin, Epic Quest for Daniel Oil Publisher Viking Pages 361 Type Fiction Award Pulitzer Year 1995 Harper Collins Knopf 280 Fiction Newbery 1995 327 Fiction Pulitzer 1989 Dell 137 Fiction Newbery 1990 Simon & Schuster 886 Nonfiction Pulitzer 1988 Random House Scribner 512 Fiction Pulitzer 1991 337 Fiction Pulitzer 1994 Clarion 150 Nonfiction Newbery 1988 Farrar 407 Fiction Pulitzer 1990 Simon & Schuster Random House Harper Collins Throndike 843 Fiction Pulitzer 1986 861 Nonfiction Pulitzer 1989 184 Fiction Newbery 1991 621 Fiction Pulitzer 1992 Simon & Schuster 876 Fiction Pulitzer 1992 Database Use database software using traditional and alternative input methods. E7-16 Activity E702-06 Sorting a Database Award Winning Books Directions: Retrieve the database called “Booklist.” Demonstrate your understanding of sorting a computerized database by answering the questions below. 1. How many records are in this database? ______________________________________ 2. Which fields are text fields? _______________________________________________ 3. Which fields are number fields? _____________________________________________ Sort the records by Title in ascending order and answer the following questions: 4. What is the name of the book in the last record in this database? _________________________ 5. Who is the publisher of the book that is the second record? _________________________ 6. Who is the author of the book in the first record? _______________________________ Sort the records by Author in ascending order and answer the following questions: 7. Who is the author of the book in the first record? _______________________________ 8. Who is the author listed in the next to the last record? ___________________________ 9. What year was the book published in the second record? _________________________ Sort the database by Pages in descending order and answer the following questions: 10. What is the title of the book with the greatest number of pages? _________________________ 11. What award did the book with the least number of pages win? _________________________ 12. What year was the book with the second most number of pages published? _________________________ Sort the database by Publisher in ascending order and answer the following questions: 13. Who is the author of the third book listed? ____________________________________ Database Use database software using traditional and alternative input methods. E7-17 Activity E702-06 Page 2 14. What award did the last book listed win? _____________________________________ Sort the database by Year in descending order and answer the following questions: 15. What year was the most recent book published? ________________________________ 16. Who published the oldest book on the list? ____________________________________ Read the following questions carefully to determine how to sort the database to find the correct answers. 17. Who is the publisher of the most recent Pulitzer Prize winner? _______________________________________________________________________ What field(s) did you sort? _________________________________________________ What order did you sort? __________________________________________________ 18. Who wrote the first Newbery Award winning book? ____________________________ What field(s) did you sort? _________________________________________________ What order did you sort? __________________________________________________ 19. Which publisher appears the most in this database? _____________________________ What field(s) did you sort? _________________________________________________ What order did you sort? __________________________________________________ 20. How many non-fiction books won Newbery Awards? ___________________________ What field(s) did you sort? _________________________________________________ What order did you sort? __________________________________________________ Database Use database software using traditional and alternative input methods. E7-18 Activity E702-07 Searching a Database Award Winning Books Directions: Retrieve the database called “Booklist.” searching a database by answering the questions below. Demonstrate your understanding of Simple searches—Search the database and find the record(s) that match the criteria in each question. List the field and the criterion that you used to find your answer. Use the example below as a guide. Same Question: How many books were written in 1993? Field: Year Criterion: =1993 Answer: 3 1 Who is the Publisher of the book with 327 pages? Field: Criterion: Answer: 2 How many book have Simon & Schuster publised on this list? Field: Criterion: Answer: 3 What is the title of the book that won the Newbery Award in 1991? Field: Criterion: Answer: 4 Who wrote the book Breathing Lesson? Field: Criterion: Answer: 5 How many Pulitzer Prize winning books have more than 500 pages? Field: Criterion: Answer: 6 How many Pulitzer Prizes have been awarded to Nonfiction books on this list? Field: Criterion: Answer: 7 List all of the Pulitzer Prize winning books under 500 pages below. Field: Criterion: Answer: Field: Criterion: Answer: 8 How many books were written after 1993? Field: Criterion: Answer: 9 How many books were written before 1993? Field: Criterion: Answer: Database Use database software using traditional and alternative input methods. E7-19 Activity E702-07 Page 2 10 Who is the publisher of Richard Rhodes' book? Field: Criterion: Answer: 11 How many books have the word "The" in the title? Field: Criterion: Answer: 12 In what year did Lois Lowry write her Newbery Award winning book? Field: Criterion: Answer: 13 What award has been won by books published by Harper Collins? Field: Criterion: Answer: 14 Of all the books published in 1990, which has the most pages? Field: Criterion: Answer: Database Use database software using traditional and alternative input methods. E7-20 Activity E702-08 Database Activity Directions: Using the form entitled “E702,” located on the DCS curriculum CD, input the following data using speech recognition software. Last Smith First John Address 435 East Street City Washington State NC Zip 28546 Position OF Parents Jim Smith Grade 5 Age 11 Tuner Chris 125 Ridge Road WinstonSalem NC 28592 IF Lisa and Michael Weston 4 10 Petteway William 1256 Hwy. 41 Trenton NC 28573 P Lavonne Petteway 6 13 Mobley James 753 Williams Lane Raleigh NC 28518 P Chris and Sally Mobley 5 12 Stroud Carrie 698 Macy Ave. Jacksonville NC 28540 C Debbie Stroud 7 13 Database Use database software using traditional and alternative input methods. E7-21