Final Project Preliminary Designs Pretty good designs. Remember that design is an iterative process. Don’t get married to your design. OK to change. You.

Slides:



Advertisements
Similar presentations
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Advertisements

CMPT 354 Views and Indexes Spring 2012 Instructor: Hassan Khosravi.
Microsoft SQL Server 2008 From the Program menu choose: Microsoft SQL Server 2008 R2  SQL Server Management Studio. You may see a window indicating the.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
Relational Databases Relational Model Primary Keys Relation or Relationship Foreign Keys Relationships between entities Integrity Constraints Power of.
Introduction to Structured Query Language (SQL)
Chapter 3. 2 Chapter 3 - Objectives Terminology of relational model. Terminology of relational model. How tables are used to represent data. How tables.
Another Join? Find videoIds and storeIds for all copies of Annie Hall which aren’t reserved. We can do a join of movie and video on movieId where title.
3-1 Chapter 3 Data and Knowledge Management
CIT 381 introduction to relations. Tables movieIdtitlegenrelengthrating 101The Thirty- Nine Steps mystery101R 123Annie Hallromantic comedy 110R 145Lady.
1 Minggu 2, Pertemuan 3 The Relational Model Matakuliah: T0206-Sistem Basisdata Tahun: 2005 Versi: 1.0/0.0.
Database Design Chapter 3.
Introduction to Structured Query Language (SQL)
1 Pertemuan 04 MODEL RELASIONAL Matakuliah: >/ > Tahun: > Versi: >
A Guide to SQL, Seventh Edition. Objectives Understand, create, and drop views Recognize the benefits of using views Grant and revoke user’s database.
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
Aggregates on Groups of Rows If you want to use aggregate functions to return more than one row of data you can use the GROUP BY clause. You use the GROUP.
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?
Microsoft Access 2010 Chapter 7 Using SQL.
Resources – MS Access Free Online Training Resources  Using an Access database to store and information (2 min)
 Keys are special fields that serve two main purposes: ◦ Primary keys are unique identifiers of the relation in question. Examples include employee numbers,
CSC271 Database Systems Lecture # 6. Summary: Previous Lecture  Relational model terminology  Mathematical relations  Database relations  Properties.
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
Chapter 4 The Relational Model Pearson Education © 2014.
Chapter 4 The Relational Model.
SQL Unit 5 Aggregation, GROUP BY, and HAVING Kirk Scott 1.
CSE314 Database Systems More SQL: Complex Queries, Triggers, Views, and Schema Modification Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
Learningcomputer.com SQL Server 2008 – Entity Relationships in a Database.
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
Chapter 3 The Relational Model. 2 Chapter 3 - Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between.
Lecture 7 Integrity & Veracity UFCE8K-15-M: Data Management.
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 2 This material was developed by Oregon Health & Science.
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
Chapter 6 1 © Prentice Hall, 2002 The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited) Project Identification and Selection Project Initiation.
Relational Databases Database Driven Applications Retrieving Data Changing Data Analysing Data What is a DBMS An application that holds the data manages.
1 The Relational Database Model. 2 Learning Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical.
Introduction to Databases Trisha Cummings. What is a database? A database is a tool for collecting and organizing information. Databases can store information.
9/7/2012ISC329 Isabelle Bichindaritz1 The Relational Database Model.
CPSC 203 Introduction to Computers Tutorial 03 & 29 By Jie (Jeff) Gao.
1 Outline  What is a Primary Key?  AutoNumber primary keys  Single-field primary keys  Composite-field primary key  About Foreign Keys  Database.
Views Lesson 7.
IST 220 Introduction to Databases Course Wrap-up.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Component 4/Unit 6b Topic II Relational Databases Keys and relationships Data modeling Database acquisition Database Management System (DBMS) Database.
Databases Illuminated Chapter 3 The Entity Relationship Model.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
Indexes and Views Unit 7.
Computer Science & Engineering 2111 Outer Joins 1CSE 2111 Lecture- Inner Vs. Outer Jioins.
Chapter 13 Views Oracle 10g: SQL. Oracle 10g: SQL2 Objectives Create a view, using CREATE VIEW command or the CREATE OR REPLACE VIEW command Employ the.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
The Relational Model. 2 Relational Model Terminology u A relation is a table with columns and rows. –Only applies to logical structure of the database,
The Relational Model © Pearson Education Limited 1995, 2005 Bayu Adhi Tama, M.T.I.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
Chapter 4 The Relational Model Pearson Education © 2009.
Data Resource Management Application Layer TPS A RCHITECTURE Data Layer Sales/MarketingHR Finance/Accounting Operations Spreadsheet Data MS Access Accounts.
Database Planning Database Design Normalization.
Rationale Databases are an integral part of an organization. Aspiring Database Developers should be able to efficiently design and implement databases.
More SQL: Complex Queries, Triggers, Views, and Schema Modification
The Relational Database Model
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
The Relational Model Transparencies
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
Views Base Relation View
Presentation transcript:

Final Project Preliminary Designs Pretty good designs. Remember that design is an iterative process. Don’t get married to your design. OK to change. You will implement this model in Access. If it doesn’t work you won’t be able to populate the database or query it. If you had red ink on your design come see me again with the final design before you implement it.

Common problems/issues Many-to-many relationship between presenter and proposal – not limited to just one co-presenter. Review question scores – only question number and the score for each review is recorded. Questions are not kept in this database. These are for individual and consensus reviews. Proposal and consensus review have one-to-one relationship. Be careful with primary keys. Do you have enough attributes to uniquely identify each instance? Year as discriminator for speaker and reviewer. A person can be a speaker/reviewer in multiple years. Review Captains – recursive or two relationships between group and reviewers?

Think about order of real world events and affects on db How should we connect consensus review, individual review, review group with proposal? The order these things happen is reviewers and review groups and proposals are first. Next is assignment of proposals to review groups. Then individual reviews happen. Then consensus reviews are conducted. And finally final status of proposal is determined. If we connect review group to consensus review then how can we assign proposals to review groups before consensus reviews occur? It may seem conceptually right to connect group to consensus review, but as long as the groupid is in proposal we can do joins to get info out?

SQL Functions (again) What happens with NULLS with Ave, Count, etc? NZ function allows values to be used where NULLS are NZ (expression, ValueIfNull) SELECT NZ(dateDue,"no due date") FROM Rental; Sort by aggregate function? either use function again or use ordinal position in output table

Views Virtual Tables – contents defined by queries Called Saved Queries in Access Used just like tables Purpose: Security – limiting access to data Query development – modularity

View Advantages Security – restrict user access to only subset of data. Specific to each user (group). Modularity – they allow programmers to create modular queries. Simplicity – users can create their own views to simplify complex tables Consistency – if underlying tables change, views can remain the same

View Disadvantages Performance – they appear to be tables but need to be created on-the-fly each time the view is referenced in a query. No indexing on views. Update Restrictions – simple views may allow updates, but complex views usually are only read-only

Video videoIddateAcquiredmovieIdstoreId 1011/25/ /5/ /31/ /5/ /5/ /25/ /12/ /29/ /25/ /10/ movieIdtitlegenrelengthrating 101The Thirty-Nine Stepsmystery101R 123Annie Hallromantic comedy110R 145Lady and the Trampanimated comedy93PG 189Animal Housecomedy87PG Elizabethcostume drama123PG Stagecoachwestern130R 987Duck Soupcomedy99PG-13 Movie Rental accountIdvideoIddateRenteddateDuecost /3/20021/4/2002$ /24/20025/2/2002$ /24/20024/30/2002$ /22/20022/25/2002$ /22/20022/25/2002$ /1/200112/31/2001$ /14/20022/16/2002$ /24/ /1/20021/8/2002$ /1/20021/4/2002$3.49

Create View Let’s find all rented comedy videos using a view. CREATE VIEW comedyvideos AS SELECT * FROM Movie m INNER JOIN Video v ON m.movieId=v.movieId WHERE m.genre like ‘*comedy*'; m.movieIdtitlegenrelengthratingvideoIddateAcquiredv.movieIdstoreId 123Annie Hallromantic comedy110R1112/5/ Annie Hallromantic comedy110R11212/31/ Annie Hallromantic comedy110R1134/5/ Annie Hallromantic comedy110R1233/25/ Lady and the Trampanimated comedy93PG1455/12/ Animal Housecomedy87PG /5/ Animal Housecomedy87PG /29/ Duck Soupcomedy99PG /10/

Use that in another query SELECT c.videoId FROM comedyvideos c INNER JOIN Rental r ON c.videoId=r.videoId; videoId

Inline View You can also put a “view” in the FROM part of the SQL statement. That is, a SELECT that SELECTS from a view. SELECT c.videoId FROM [SELECT * FROM Movie m INNER JOIN Video v ON m.movieId=v.movieId WHERE m.genre like '*comedy*']. AS c INNER JOIN Rental r ON c.videoId=r.videoId;