Relational Database in Access Student System As always please use speaker notes!

Slides:



Advertisements
Similar presentations
Database Relationships in Access As you recall, the data in a database is stored in tables. In a relational database like Access, you can have multiple.
Advertisements

Relational Database Example in Access - Order System Please use speaker notes for additional information!
Relational database - student system As always please use speaker notes!
© Abdou Illia MIS Spring 2014
Sometimes you need to use data from more than one table. In example1, the report displays data from two separate tables. Employee IDs exist in the EMPLOYEES.
Chapter 7 © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey A. Hoffer, V. Ramesh, Heikki Topi.
ISP 121 Access Normalization and Relationships. Normalization Say we’re operating a pet day-care and we need to keep information on our pets/customers.
Microsoft Access Removing Redundancy in a Database.
1 DDL – subquery Sen Zhang. 2 Objectives What is a subquery? Learn how to create nested SQL queries Read sample scripts and book for different kinds of.
Week 2 Normalization and Queries
Accounting Databases Chapter 2 The Crossroads of Accounting & IT
WELL-DESIGNED DATABASES Process faster Easy to develop and maintain Easy to read and write code.
Relational Databases What is a relational database? What would we use one for? What do they look like? How can we describe them? How can you create one?
Relational example using donor, contrib and drive tables Please use speaker notes for additional information!
MS Access 2007 IT User Services - University of Delaware.
Database Relationships Objective 5.01 Understand database tables used in business.
Database Design.  Define a table for each entity  Give the table the same name as the entity  Make the primary key the same as the identifier of the.
Database Relationships Objective 5.01 Understand database tables used in business.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
Module Title? DBMS E-R Model to Relational Model.
Relational Database Concepts. Let’s start with a simple example of a database application Assume that you want to keep track of your clients’ names, addresses,
MICROSOFT ACCESS 2007 BTA – Spring What is Access?  Microsoft Access is a database management system…this means that it contains database information.
Relational databases and third normal form As always click on speaker notes under view when executing to get more information!
CHAPTER 8: MANAGING DATA RESOURCES. File Organization Terms Field: group of characters that represent something Record: group of related fields File:
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
Chapter 9 Joining Data from Multiple Tables
More on relational databases, including 1 to 1, 1 to many and many to many relationships Please use speaker notes for additional information!
Database Normalization Lynne Weldon July 17, 2000.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 9 – Building Links,
Applicants Please use speaker notes for additional information!
Relationships and Advanced Query Concepts Using Multiple Tables Please use speaker notes for additional information!
DAY 12: DATABASE CONCEPT Tazin Afrin September 26,
Organizing Data Revision: pages 8-10, 31 Chapter 3.
Session 8: Databases Teaching Computing to GCSE Level with Python.
Database Design. Referential Integrity : data in a table that links to data in another table must always work in such a way that following the link will.
The Relational Model1 ER-to-Relational Mapping and Views.
Ch Determine the output displayed from procedures Lab sheet 10.4.
Constraints - primary and foreign keys in Oracle Please use speaker notes for additional information!
Fanny Widadie, S.P, M.Agr 1 Database Management Systems.
MS Access. Access is a DBMS/RDMS DBMS = Database Management System RDMS = Relational Database Management System.
HSC IT Center Training University of Florida Microsoft Access Understanding Relationships Health Science Center IT Center – Training
1 Introduction to Oracle Chapter 1. 2 Before Databases Information was kept in files: Each field describes one piece of information about student Fields.
Databases & Access Today’s Topic: Databases Define: Database Software Examine the different uses of database software Define the four components.
Access Review. Access Access is a database application A database is a collection of records and files organized for a particular purpose Access supports.
Quiz questions. 1 A data structure that is made up of fields and records? Table.
Database Management Supplement 1. 2 I. The Hierarchy of Data Database File (Entity, Table) Record (info for a specific entity, Row) Field (Attribute,
Introduction to Access Chapter 13 pages 1-4. What is a database??? Related information is stored in databases  All SC student information is stored in.
Database Basics BCIS 3680 Enterprise Programming.
A table is a set of data elements (values) that is organized using a model of vertical columns (which are identified by their name) and horizontal rows.
More on Primary and Foreign Keys Please see speaker notes for additional information!
Howard Paul. Sequential Access Index Files and Data File Random Access.
Unbound data fields, find, filter etc. using Data Environment Please use speaker notes for additional information!
Quiz Which of the following is not a mandatory characteristic of a relation? Rows are not ordered (Not required) Each row is a unique There is a.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Information System Design “Student Registration System Example”
MySQL Tutorial. Databases A database is a container that groups together a series of tables within a single structure Each database can contain 1 or more.
Systems Analysis & Design Methods III Classic normalization rules for relational databases III Classic normalization rules for relational databases.
Decision Analysis Fall Term 2015 Marymount University School of Business Administration Professor Suydam Week 10 Access Basics – Tutorial B; Introduction.
DAY 20: ACCESS CHAPTERS 5, 6, 7 Larry Reaves October 28,
Database Relationships
Find, filter etc with connection to Access code internally
Database Management  .
Please use speaker notes for additional information!
Please use speaker notes for additional information!
Introduction to Views and Reports
Microsoft Applications
Database Relationships
Please use speaker notes for additional information!
Presentation transcript:

Relational Database in Access Student System As always please use speaker notes!

Student relational database system We are going to design tables for a system to contain student information. Think of this as the type of information that would be needed for a transcript. We need: Information about the student: idno, name and address, major etc. Information about the courses the students have taken including grade Tables that will allow us to get the name of the major and the name of the course

Student relational database system STUDENT TABLE: Student Idno - this is the primary key since all information relates to it Name Address Phone Social Security # - this is a candidate key since it could be used as a primary key Major code Date enrolled Other information related directly to the student This table has information about the student. All of it must be dependent on the primary key. Clearly we need major information about the major as well, but that cannot be stored on the student table because the name of the major and the chair of the department directly relate to the major code, not to the student idno. Therefore we need a major table. MAJOR TABLE: Major code - this is the primary key Major name Chair department

Student relational database system STUDENT COURSE TABLE: Student Idno Course code Primary key Semester course taken Grade Information about the courses the student has taken can not be kept on the STUDENT TABLE because they are a reoccurring group and thus break the rules of normalization. Essentially if we were to attempt to carry course information on the STUDENT TABLE we would have to determine how many slots we need (the maximum number of courses a student would be allowed to take). This is not practical and it definitely breaks the first normal form rule. The primary key has to be made up of more than one column/field because each student is allowed to take more than one course. The combination of student idno and course code and semester course was taken means that we will have a separate record for each time a course was taken by a student. COURSE TABLE: Course code - Primary key Course name Number credits We cannot keep the course name in the STUDENT COURSE TABLE because the course name directly relates to the course code. This breaks normalization rules. Practically speaking, we would not want to carry the course name in the STUDENT COURSE TABLE because if the course name changes we have to change it on any record. By carrying it on a separate COURSE TABLE, if the name changes we only have one place to enter that change.

Create tables

SELECT student00.studentidno, student00.name, student00.majorcode, major00.majorname FROM student00 INNER JOIN major00 ON student00.majorcode = major00.majorcode; SQL This is the SQL code that Access generated. Notice that each field name has the table name in front of it. The FROM clause does an INNER JOIN which links the student00 table and the major00 table based on the majorcode on student00 being equal to the majorcode on major00. SELECT studentidno, name, student00.majorcode, majorname FROM student00, major00 WHERE student00.majorcode = major00.majorcode; This is alternate SQL code that I wrote. I only used the table name with majorcode because majorcode is the only column in the SELECT that appears in both tables. The FROM clause lists the tables involved in the query. The WHERE clause establishes the link or relationship between the two tables based on the majorcode in student00 and the majorcode in major00.

Relate 3 tables

SELECT stucourse00.studentidno, student00.name, stucourse00.coursecd, course00.coursename, stucourse00.grade FROM (student00 INNER JOIN stucourse00 ON student00.studentidno = stucourse00.studentidno) INNER JOIN course00 ON stucourse00.coursecd = course00.coursecd; SQL

SELECT stucourse00.studentidno, student00.name, stucourse00.coursecd, course00.coursename, stucourse00.grade FROM (student00 INNER JOIN stucourse00 ON student00.studentidno = stucourse00.studentidno) INNER JOIN course00 ON stucourse00.coursecd = course00.coursecd; This is the SQL generated by Access: The SELECT is selecting the columns with the table name in front of each column. In the FROM the relationships are set using the INNER JOIN. This says that student00 and stucourse00 are joined based on the studentidno in each of the tables and then the join is to course00 based on the coursecd in stucourse00 and course00. SQL SELECT stucourse00.studentidno,name, stucourse00.coursecd, coursename, grade FROM stucourse00, student00, course00 WHERE stucourse00.studentidno = student00.studentidno AND stucourse00.coursecd = course00.coursecd; This is alternate SQL code that I wrote: The SELECT is only using table names when column names are not unique. The FROM lists all tables being used in the query. The WHERE shows the relationship between the tables by saying that the studentidno on stucourse00 and student00 must be equal AND the coursecd on stucourse00 and course00 must be equal.

SELECT stucourse00.studentidno, student00.name, student00.majorcode, major00.majorname,stucourse00.coursecd,course00.coursename, stucourse00.grade FROM ((stucourse00 INNER JOIN student00 ON stucourse00.studentidno = student00.studentidno) INNER JOIN course00 ON stucourse00.coursecd = course00.coursecd) INNER JOIN major00 ON student00.majorcode = major00.majorcode; SQL SELECT stucourse00.studentidno, name, student00.majorcode, majorname, stucourse00.coursecd,coursename, grade FROM stucourse00, student00, major00, course00 WHERE stucourse00.studentidno = student00.studentidno AND stucourse00.coursecd = course00.coursecd AND student00.majorcode = major00.majorcode; The SQL that Access generates uses the INNER JOIN to establish the links between the four tables. Note the structure of the INNER JOIN in the example above. The alternate SQL that I coded lists all of the tables in the FROM and then establishes the links through the WHERE.