Relational database - student system As always please use speaker notes!

Slides:



Advertisements
Similar presentations
Information Systems Today: Managing in the Digital World
Advertisements

Oracle Object-Relational Model. - Structures : tables, views, indexes, etc. - Operations : actions that manipulate data stored in structures - Integrity.
Creating Tables, Setting Constraints, and Datatypes What is a constraint and why do we use it? What is a datatype? What does CHAR mean? Page 97 in Course.
Creating Tables. 2 home back first prev next last What Will I Learn? List and provide an example of each of the number, character, and date data types.
Creating an Oracle Database Table Additional information is available in speaker notes!
Stephen C. Hayne 1 Database System Components The Database and the DBMS.
PL/SQL User Defined Types Record and Table Please use speaker notes for additional information!
Reports Using SQL Script Please check speaker notes for additional information!
Designing Databases In database design, you determine the fields, tables, and relationships between tables that are needed to satisfy the users’ requirements.
Order Entry System Please use speaker notes for additional information!
HTML and Forms Please use the speaker notes to receive the comments accompanying the slides!
Group functions using SQL Additional information in speaker notes!
Relational example using donor, donation and drive tables For additional information see the speaker notes!
Using input variables Please use speaker notes for additional information!
More on IF statements Use speaker notes for additional information!
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.
Dr. Chandra Amaravadi Western Illinois University INTRO TO ENTERPRISE DATABASES - II.
Designing a Database Unleashing the Power of Relational Database Design.
Week 2 Normalization and Queries
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
MS Access 2007 IT User Services - University of Delaware.
SQL Use of Functions Character functions Please use speaker notes for additional information!
COMPUTING FOR BUSINESS AND ECONOMICS-III. Lecture no.6 COURSE INSTRUCTOR- Ms. Tehseen SEMESTER- Summer 2010.
Cursors in PL/SQL Includes cursor example and continuation of first cursor example Please use speaker notes for additional information!
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 Understanding Relationships Academic Health Center Training (352)
Relational databases and third normal form As always click on speaker notes under view when executing to get more information!
 A database is a collection of data that is organized so that its contents can easily be accessed, managed, and updated. What is Database?
DATABASE DESIGN USING MICROSOFT ACCESS. What is a Database?  DMS Database management system  Database Collection of data organized in a manner that.
Introduction to Tables/Arrays Please use the speaker notes for additional information. Tables/Arrays.
More on relational databases, including 1 to 1, 1 to many and many to many relationships Please use speaker notes for additional information!
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 4 This material was developed by Oregon Health & Science.
1 CMPT 275 Phase: Design. Janice Regan, Map of design phase DESIGN HIGH LEVEL DESIGN Modularization User Interface Module Interfaces Data Persistance.
Applicants Please use speaker notes for additional information!
Using XML with ASP and the ASP:Repeater Please use speaker notes for additional information!
XML and DTD Please you speaker notes for additional information!
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.
More on views Please refer to speaker notes for additional information!
Constraints - primary and foreign keys in Oracle Please use speaker notes for additional information!
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
SQL and Conditions Speaker notes will provide additional information!
1 Introduction to Oracle Chapter 1. 2 Before Databases Information was kept in files: Each field describes one piece of information about student Fields.
Exceptions in PL/SQL Please use speaker notes for additional information!
Indexes in Oracle An Introduction Please check speaker notes for additional information!
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
Introduction to Oracle - SQL Additional information is available in speaker notes!
Database Management Supplement 1. 2 I. The Hierarchy of Data Database File (Entity, Table) Record (info for a specific entity, Row) Field (Attribute,
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!
Understand Primary, Foreign, and Composite Keys Database Administration Fundamentals LESSON 4.2.
Relational Database in Access Student System As always please use speaker notes!
Database design Using Access 2007
Howard Paul. Sequential Access Index Files and Data File Random Access.
PHP with MYSQL Please use speaker notes for additional information!
XHTML and Forms Please use speaker notes for additional information!
Unbound data fields, find, filter etc. using Data Environment Please use speaker notes for additional information!
More SQL functions As usual,there is additional information in the speaker notes!
Database (Microsoft Access). Database A database is an organized collection of related data about a specific topic or purpose. Examples of databases include:
Normalisation FORM RULES 1NF 2NF 3NF. What is normalisation of data? The process of Normalisation organises your database to: Reduce or minimise redundant.
DAY 20: ACCESS CHAPTERS 5, 6, 7 Larry Reaves October 28,
Find, filter etc with connection to Access code internally
Database Management  .
MySQL - Creating donorof database offline
Introduction to Views and Reports
Microsoft Applications
A Very Brief Introduction to Relational Databases
CSIS 254 Oracle Normalization
Using SQL with Access I create a database named
Presentation transcript:

Relational database - 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.

SQL> create table student00 2 (studentidno varchar2(4), 3 name varchar2(20), 4 stadr varchar2(20), 5 city varchar2(20), 6 state varchar2(2), 7 zip varchar2(5), 8 phone varchar2(10), 9 ssnum varchar2(9), 10 majorcode varchar2(2), 11 enrolled date); Table created. SQL> create table major00 2 (majorcode varchar2(2), 3 majorname varchar2(30), 4 chair varchar2(20)); Table created. SQL> create table stucourse00 2 (studentidno varchar2(4), 3 coursecd varchar2(5), 4 semtaken varchar2(5), 5 grade varchar2(2)); Table created. SQL> create table course00 2 (coursecd varchar2(5), 3 coursename varchar2(30), 4 credits number(1)); Table created. Create tables

SQL> SELECT * FROM student00; STUD NAME STADR CITY ST ZIP PHONE SSNUM MA ENROLLED Stephen Daniels 345 Midland Ave Yonkers NY BU 09-SEP Jennifer Ames 12 Ave F Fall River MA CI 02-SEP Carl Hersey 12 Ave F Fall River MA BU 02-SEP Mary Stanton 156 West St Taunton MA CI 05-SEP John Richards 76 Main St Fall River MA CI 06-SEP-00 Oracle tables SQL> SELECT * FROM major00; MA MAJORNAME CHAIR BU Business Administration Adams CI Computer Information Systems Grocer

Oracle tables SQL> SELECT * FROM course00; COURS COURSENAME CREDITS CIS11 Intro to Computer Info Systems 3 CIS44 Internet User/Developer 3 CIS50 Oracle and SQL 3 CIS56 Visual Basic 3 MAN11 Intro to Management 3 MAR11 Marketing Principles 3 SQL> SELECT * FROM stucourse00 2 ORDER by studentidno; STUD COURS SEMTA GR CIS11 F2000 A MAR11 F2000 A 1111 CIS44 S2000 A 1212 CIS44 S2000 A 2222 CIS44 S2000 A 2222 MAN11 F2000 A CIS50 F2000 I 3333 CIS44 F2000 B 3333 CIS50 F2000 B CIS56 S2000 A-

SELECT SQL> SELECT student00.studentidno, name, student00.majorcode, majorname 2 FROM student00, major00 3 WHERE student00.majorcode = major00.majorcode; STUD NAME MA MAJORNAME Stephen Daniels BU Business Administration 2222 Carl Hersey BU Business Administration 1212 Jennifer Ames CI Computer Information Systems 2345 Mary Stanton CI Computer Information Systems 3333 John Richards CI Computer Information Systems SQL> SELECT * 2 FROM major00; MA MAJORNAME CHAIR BU Business Administration Adams CI Computer Information Systems Grocer SQL> SELECT studentidno, name, majorcode 2 FROM student00; STUD NAME MA Stephen Daniels BU 1212 Jennifer Ames CI 2222 Carl Hersey BU 2345 Mary Stanton CI 3333 John Richards CI The link between student00 and major00 is based on the majorcode. In the case of the first student, the BU links to the BU in the major00 table and pulls out the name.

SQL> SELECT stucourse00.studentidno, name, stucourse00.coursecd, coursename, grade 2 FROM student00, stucourse00, course00 3 WHERE stucourse00.studentidno = student00.studentidno AND stucourse00.coursecd = course00.coursecd; STUD NAME COURS COURSENAME GR Stephen Daniels CIS11 Intro to Computer Info Systems A Stephen Daniels CIS44 Internet User/Developer A 1111 Stephen Daniels MAR11 Marketing Principles A 1212 Jennifer Ames CIS44 Internet User/Developer A 2222 Carl Hersey CIS44 Internet User/Developer A 2222 Carl Hersey MAN11 Intro to Management A Mary Stanton CIS50 Oracle and SQL I 3333 John Richards CIS44 Internet User/Developer B 3333 John Richards CIS56 Visual Basic A John Richards CIS50 Oracle and SQL B+ 11 rows selected. SQL> SELECT studentidno, name 2 FROM student00; STUD NAME Stephen Daniels 1212 Jennifer Ames 2222 Carl Hersey 2345 Mary Stanton 3333 John Richards SQL> SELECT * 2 FROM stucourse00; STUD COURS SEMTA GR CIS11 F2000 A MAR11 F2000 A 1111 CIS44 S2000 A 1212 CIS44 S2000 A 2222 CIS44 S2000 A 2222 MAN11 F2000 A CIS44 F2000 B 3333 CIS50 F2000 B CIS56 S2000 A CIS50 F2000 I SQL> SELECT coursecd, coursename 2 FROM course00; COURS COURSENAME CIS11 Intro to Computer Info Systems CIS44 Internet User/Developer CIS50 Oracle and SQL CIS56 Visual Basic MAN11 Intro to Management MAR11 Marketing Principles

SQL> SELECT stucourse00.studentidno, name, student00.majorcode, majorname, 2 stucourse00.coursecd, coursename, grade 3 FROM stucourse00, student00, course00, major00 4 WHERE stucourse00.studentidno = student00.studentidno AND 5 student00.majorcode = major00.majorcode AND 6 stucourse00.coursecd = course00.coursecd; STUD NAME MA MAJORNAME COURS COURSENAME GR Stephen Daniels BU Business Administration CIS11 Intro to Computer Info Systems A Stephen Daniels BU Business Administration CIS44 Internet User/Developer A 1212 Jennifer Ames CI Computer Information Systems CIS44 Internet User/Developer A 2222 Carl Hersey BU Business Administration CIS44 Internet User/Developer A 3333 John Richards CI Computer Information Systems CIS44 Internet User/Developer B 2345 Mary Stanton CI Computer Information Systems CIS50 Oracle and SQL I 3333 John Richards CI Computer Information Systems CIS50 Oracle and SQL B John Richards CI Computer Information Systems CIS56 Visual Basic A Carl Hersey BU Business Administration MAN11 Intro to Management A Stephen Daniels BU Business Administration MAR11 Marketing Principles A SQL> SELECT * 2 FROM stucourse00; STUD COURS SEMTA GR CIS11 F2000 A MAR11 F2000 A 1111 CIS44 S2000 A 1212 CIS44 S2000 A 2222 CIS44 S2000 A 2222 MAN11 F2000 A CIS44 F2000 B 3333 CIS50 F2000 B CIS56 S2000 A CIS50 F2000 I SQL> SELECT studentidno, 2 name, majorcode 3 FROM student00; STUD NAME MA Stephen Daniels BU 1212 Jennifer Ames CI 2222 Carl Hersey BU 2345 Mary Stanton CI 3333 John Richards CI SQL> SELECT majorcode, 2 majorname 3 FROM major00; MA MAJORNAME BU Business Administration CI Computer Information Systems SQL> SELECT coursecd, coursename 2 FROM course00; COURS COURSENAME CIS11 Intro to Computer Info Systems CIS44 Internet User/Developer CIS50 Oracle and SQL CIS56 Visual Basic MAN11 Intro to Management MAR11 Marketing Principles