LSP 121 Week 6 Intro to Databases. Read the handout on databases Found under ‘week #6’ Go home and read this document closely. You can skip the sections.

Slides:



Advertisements
Similar presentations
Microsoft® Access® 2010 Training
Advertisements

Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
Database Design Week 10.
Name: Tatiana “Tania” Harrison
Start First step Create a new blank database Create a database using the option that will enable you to build your database using pre-set options. Save.
Normalization Queries (contd)
Microsoft Access Manual 1 By Dhawala Kovuri Elham S.Khorasani Ismail Guneydas.
ISP 121 Week 1 Introduction to Databases. ISP 121, Winter Why a database and not a spreadsheet? You have too many separate files or too much data.
Creating a Blank Database 1. Open up Microsoft Access 2. Click on Blank document button 3. On the right panel, Specify the location for saving your database.
LSP 121 Week 2 Normalization and Queries. Normalization The Old Car Club database presented a problem – what if one person owns multiple cars? (One owner.
Access Lecture 1 Database Overview and Creating Tables Create an Employee Table.
Database Software Application
Advanced Tables Lesson 9. Objectives Creating a Custom Table When a table template doesn’t suit your needs, you can create a custom table in Design view.
FIRST COURSE Access Tutorial 1 Creating a Database.
CPSC 203 Introduction to Computers T59 & T64 By Jie (Jeff) Gao.
Access 2007 Database Application Managing Business Information Effectively BCIS 1 and 2.
XP New Perspectives on Microsoft Access 2002 Tutorial 51 Microsoft Access 2002 Tutorial 5 – Enhancing a Table’s Design, and Creating Advanced Queries and.
LSP 121 Week 1 Intro to Databases. Welcome to LSP 121 Quantitative Reasoning and Technological Literacy II Continuation of quantitative data concepts.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
Access Tutorial 2 Building a Database and Defining Table Relationships
Introduction to database systems
24 GOLDEN COINS, 1 IS FAKE ( WEIGHS LESS). DATABASE CONCEPTS Ahmad, Mohammad J. CS 101.
Microsoft Access Get a green book. Page AC 2 Define Access Define database.
Mail merge I: Use mail merge for mass mailings Perform a complete mail merge Now you’ll walk through the process of performing a mail merge by using the.
PHP meets MySQL.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 4 BACKNEXTEND 4-1 LINKS TO OBJECTIVES Query Design Query Criteria Modify a Query Using OR.
Microsoft Access Lesson 1 Lexington Technology Center February 11, 2003 Bob Herring On the Web at
Microsoft ® Access ® 2010 Training Create Queries for a New Database If a yellow security bar appears at the top of the screen in PowerPoint, click Enable.
XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003.
WEEK 11 Database Design. TABLE INSTANCE CHARTS Create Tables.
Examining data using Microsoft Access Queries Using Criteria and Calculations SESSION 3.2 This section covers specifying an exact match condition in a.
1.NET Web Forms Business Forms © 2002 by Jerry Post.
DAY 22: MICROSOFT ACCESS – REVIEW Akhila Kondai November 04, 2013.
® Microsoft Access 2010 Tutorial 2 Building a Database and Defining Table Relationships.
Chapter 17 Creating a Database.
Office Management Tools II Ms Saima Gul. Office Management Tools II Ms Saima Gul.
SESSION 3.1 This section covers using the query window in design view to create a query and sorting & filtering data while in a datasheet view. Microsoft.
Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
COMPREHENSIVE Access Tutorial 12 Managing and Securing a Database.
IE 423 – Design of Decision Support Systems Database development – Building Tables
Access Forms and Queries. Entering Data in Your Table  You can add data to your table in Datasheet view, by typing in the columns and rows.  This.
Lesson 2: Designing a Database and Creating Tables.
Planning & Creating a Database By Ms. Naira Microsoft Access.
CSC 240 (Blum)1 Introduction to Access CSC 240 (Blum)2 Click on the Access desktop icon or go to Start/All Programs/Microsoft Office/Microsoft Office.
Work with Tables and Database Records Lesson 3. NAVIGATING AMONG RECORDS Access users who prefer using the keyboard to navigate records can press keys.
Classwork: Common Errors Primary keys: don’t forget them! Primary keys: choose the best one! – “Name” and “birthday” are not the best choices. – “Phone.
CPSC 203 Introduction to Computers T97 By Jie (Jeff) Gao.
INTRODUCTION TO DATABASES USING MICROSOFT ACCESS Basic Database Terms Create A Database Creating Table Fields Populating a Table Modifying Data Create.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
Access Queries and Forms. Adding a New Field  To insert a field after you have saved your table, open Access, and open the table  It is easier to add.
Course Contents Overview: Database basics Lesson 1: Benefits of using a database Lesson 2: Table that data Lesson 3: Analyzing, viewing, and reporting.
Access Test Questions Test Date: 05/05/16. Chapter 1 (Lynda.com) Question 1 An access database uses five main components (database objects). Which is.
COMPUTER SKILLS MS-ACCESS. Introduction Access is a piece of software known as a database management system. At its most basic level, it can be used to.
Database (Microsoft Access). Database A database is an organized collection of related data about a specific topic or purpose. Examples of databases include:
Week 1 Intro to the Course Intro to Databases.  Formerly ISP 121  “Continuation” of LSP 120 concepts  Topics include: ◦ Databases ◦ Basic statistics.
Perform a complete mail merge Lesson 14 By the end of this lesson you will be able to complete the following: Use the Mail Merge Wizard to perform a basic.
GO! with Microsoft Office 2016
Practical Office 2007 Chapter 10
GO! with Microsoft Access 2016
Exploring Microsoft® Access® 2016 Series Editor Mary Anne Poatsy
MODULE 7 Microsoft Access 2010
Creating and Modifying Queries
Microsoft Official Academic Course, Access 2016
Introduction to Database Programs
Introduction to Access
Nagendra Vemulapalli Exam2 Overview Nagendra Vemulapalli
Introduction to Database Programs
Guidelines for Microsoft® Office 2013
Access Test Questions Test Date: 05/05/16.
Presentation transcript:

LSP 121 Week 6 Intro to Databases

Read the handout on databases Found under ‘week #6’ Go home and read this document closely. You can skip the sections on “Relationships” and “Forms” for now. But get comfortable with the other sections.

Why a Database (and not a spreadsheet)? You have too many separate files or too much data in a single file You need to look at the data in many different ways You need to share the data – E.g. Airline ticketing agents need access to the flights/seats/prices database for an airline from all over the world You want to secure access to the data and control data values Spreadsheets are much better for crunching numbers – E.g. Statistical analysis, graphs, etc Databases are better at dealing with very large amounts of data – especially if it goes much beyond numeric data As you become familiar with them, you’ll learn how to decide which (DB vs Spreadsheet) is the best tool for your needs.

Example of a table This “table” of customers has: – Four “fields” (last name, first name, address, telephone) – Three “records”

Basic Terms – Know these! Table – an object you create and then use to store data. – Each table contains information about a particular subject, such as customers, patients, or orders – e.g. Students, Customers, Cubs_Roster, Sox_Roster, Nobel_Prize_Winners Fields – tables are made up of a series of fields (columns). – e.g. Students table: first_name, last_name, gpa, SSN, etc – e.g. Sox_Roster table: f_name, l_name, position, year_hired, salary, etc – e.g. Nobel_Prize_Winners table: f_name, l_name, year_won, country, etc Record – a collection of fields – e.g. a collection of students from a table of student info Query – an object that provides a custom view of data from one or more tables – A “question” you ask of the database – e.g. Show records in the Students where gpa > 3.5 – e.g. Show records in the Nobel_Prize_Winners table where country = “USA”

Field Attributes (Data Types)  Recall how in SPSS you can have different field types such as String, Numeric, Dollar, etc. The same thing applies to creating a field.  You need to specify which type of data you will enter for each field.  In access, you can change these settings under the ‘View’ icon (upper left of screen)  Design View  You want to create fields for Name, Address, Telephone, Amount Paid,…  Text – the most common!  Dollar: for salaries, sales, tuition, etc, etc  Number: (same as Excel) gpa, ssn, zip_code, etc, etc  or should we ???? (see next)  Number – do NOT use unless you plan to do arithmetic with this field  Should we rethink ssn in the previous example? What about zip code?  gpa is probably good as numeric. SSN and Zip probably should be text.  Date/Time  Currency – use with money fields  AutoNumber – similar to Number but Access automatically inserts the numbers for you  Yes/No  And a few others…

** Primary Key  A way to identify every record uniquely  Imagine if you had multiple students in the same table with the same first and last name. How could you uniquely identify each one? (John Smith, Rashmi Patel, etc)  Almost every table should have a primary key  For example, your student ID is a primary key in a lot of databases here at DePaul (every student ID is unique – no duplicates)  We could also use SSN (many government DBs use SSNs as their primary key)  address is becoming a popular choice for primary key. Can you think of why this might be a good idea? Why it might be a flawed idea?  What about phone number?  If you are searching for a particular record, you can quickly find it using the primary key  Whenever you are asked for your DePaul ID, or SSN, or address, etc it is often so that a database can be queried toquickly bring up your information.  In Access, a Primary Key is shown by a little golden key icon.

What is an Index? Similar – but not identical – to a primary key – Index can have NO value inside. Primary key must have a value. – Multiple records can share the same index. Primary key has to be unique to every record. Sometimes used for sorting a table You can make any field an index An index also let’s you search for one or more records You can search a database on any field, but the search will be faster if you make the field an index – This becomes very important with very large databases We won’t worry much about index for now. Focus on understanding primary key.

Table Example Suppose we were creating a table for a personal phone book. What should we use as the primary key? – Last name? No! – Phone number? Maybe… probably not. – Let’s assign every person

Let’s Practice Let’s run the Microsoft’s databased program Access – Create a database called: My Phone Book – We will create a single table called ‘People’ and then enter some data – For now, just create fields for last name, first name, city, state, phone number. Don’t forget! – Create a primary key field for your table Allow Access to ‘autonumber’ this primary key – Assign a correct type for each field

Enter some data into the table Click on View  Datasheet View Enter the following records – Note how the autonumber is generated as you enter a new record Bobby Barnacle, Moline, IA, Susan Smith, Chicago, IL, Carlos Headcase, Chicago, IL, Rita Skeeter, Hogsmeade, FL, Neuro Surgeon, Richville, IL,

Queries Let’s “query “ our database to list the first name and phone number of all users from “Chicago” From the tabs, choose: Create  Query Design – Don’t use the Query Wizard – we’ll design our own queries Choose the table you are interested in. – You could pull in info from multiple tables, but we’ll leave that for later. Double-click the fields you want to retrieve, in this case, first name and phone number Double-click ‘City’ – Where it shows “Criteria” down below, type “Chicago” (include the quotes) Click the ‘Run’ icon at the upper left

Queries contd To modify a query, click on View  Design View – Modify your previous query to find all users from Illinois Also try: – List first name and last name and city for all users from Florida – Do the same for users from CA (California) Obviously you should not find any – Experiment with others…

Learn Queries! Learning to properly query a database is probably the most important skill for the database part of the course. Queries can be very elaborate and complex. We will be spending some more time with them. – The handout has some good examples. STOP. Let’s do the first activity.

Importing Data into a “Flat” Access Database Many times you want to take an existing data set and “import” it into an Access database The existing data set can be plain text (.txt), a spreadsheet (.xls), or other forms of existing databases Let’s consider the example of importing a spreadsheet into an Access database

Importing Spreadsheet Data Create a new (blank) database – You can also import additional new data into an existing database, but this can be tricky Select External Data from the top tabs Select the appropriate type of file that you want to import

Importing Spreadsheet Data You probably want to import the data into a new table If the spreadsheet you are importing has more than one worksheet, select the appropriate worksheet Be sure to note if the first row contains column headings

Importing Spreadsheet Data Now you can tell the wizard which fields should be indexed in the new table Choose your own primary key or let Access add a primary key? – Remember that it is important to make a good choice for your primary key. Put some thought into it. Give the table a name and click on Finish You may have import errors – check the file xx$_ImportErrors

Importing Spreadsheet Data Let’s try an example – we will import the data in spreadsheet Presidents.xls Open the QRC website and copy the file Presidents.xls to either My Documents or the Desktop (may not be able to copy to Desktop) Run Access and perform the import operation on the worksheet named “Master” When you click on ‘Next’ note that you are asked whether the first row contains headings. For the “Master” worksheet, it does. Don’t just keep clicking ‘Next’. That is, note the kinds of options that Access is prompting you with. For example, allow Access to create a primary key Allow Access to create the errors table Question: Why is the datatype for “# Electoral Votes” Text instead of Number???

Now experiment with your table First take a quick look at the errors table just to see what is in there. (We won’t worry about it for now). Then go back to the regular “Master” table and practice… Try some of the following queries: Recall: Create  Query Design  choose the table(s) you want to query. (“Master” in this case) 1.List the presidents from Illinois 2.List the presidents from Illinois OR Ohio 3.List the presidents from Illinois AND Ohio 4.List the presidents younger than 50 at inauguration 5.Experiment

Filtering Records Sort of a simple way to quickly query Best idea though, is to learn to create quality queries. If you want to see all the rows in a table that match any part of a value, you can use the Filter command A couple different forms of Filter. Let’s look at Filter by Selection Open the table you want to filter. Highlight the field you want to filter on. Then on the Home tab click on Selection To undo filtering, click on Toggle Filter