Bags, foreign keys, selects, joins, and yes, btw, SVN 2/18/2014.

Slides:



Advertisements
Similar presentations
DB glossary (focus on typical SQL RDBMS, not XQuery or SPARQL)
Advertisements

SQL - Subqueries and Schema Chapter 3.4 V3.0 Napier University Dr Gordon Russell.
1. What is Subversion? Why do we need CM? Basic concepts Repositories Options Setup Clients Options Setup Operation Troubleshooting Slide 2.
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.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
Database Design -- Basic SQL
Introduction to Structured Query Language (SQL)
Introduction to Structured Query Language (SQL)
SQL components In Oracle. SQL in Oracle SQL is made up of 4 components: –DDL Data Definition Language CREATE, ALTER, DROP, TRUNCATE. Creates / Alters.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
Introduction to Structured Query Language (SQL)
The Relational Model Codd (1970): based on set theory Relational model: represents the database as a collection of relations (a table of values --> file)
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
Version Control. What is Version Control? Manages file sharing for Concurrent Development Keeps track of changes with Version Control SubVersion (SVN)
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
The Relational Model These slides are based on the slides of your text book.
Subversion. What is Subversion? A Version Control System A successor to CVS and SourceSafe Essentially gives you a tracked, shared file system.
Microsoft Access 2010 Chapter 7 Using SQL. Change the font or font size for SQL queries Create SQL queries Include fields in SQL queries Include simple.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 8 SQL-99: Schema Definition, Constraints, and Queries and Views.
Introduction to Accounting Information Systems
Learningcomputer.com SQL Server 2008 – Entity Relationships in a Database.
Database Technical Session By: Prof. Adarsh Patel.
2440: 141 Web Site Administration Database Management Using SQL Professor: Enoch E. Damson.
INFO 344 Web Tools And Development CK Wang University of Washington Spring 2014.
CHAPTER:14 Simple Queries in SQL Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 UNIT 6: Chapter 7: Introduction to SQL Modern Database Management 9 th Edition Jeffrey A.
Chapter 2 Adapted from Silberschatz, et al. CHECK SLIDE 16.
FEN  Data Definition: CREATE TABLE, ALTER TABLE  Data Manipulation: INSERT, UPDATE, DELETE  Queries: SELECT SQL: Structured Query Language.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
9/7/2012ISC329 Isabelle Bichindaritz1 The Relational Database Model.
U:/msu/course/cse/103 Day 06, Slide 1 CSE students: Do not log in yet. Review Day 6 in your textbook. Think about.
FALL 2004CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
M1G Introduction to Database Development 2. Creating a Database.
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
Chapter 25 Databases. Chapter Scope Database concepts Tables and queries SQL statements Managing data in a database Java Foundations, 3rd Edition, Lewis/DePasquale/Chase25.
M Taimoor Khan Course Objectives 1) Basic Concepts 2) Tools 3) Database architecture and design 4) Flow of data (DFDs)
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
EXAM 1 NEXT TUESDAY…. EXAMPLE QUESTIONS 1.Why is the notion of a “state” important in relational database technology? What does it refer to? 2.What do.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
Chapter 8 Part 2 SQL-99 Schema Definition, Constraints, Queries, and Views.
Chapter 9 Constraints. Chapter Objectives  Explain the purpose of constraints in a table  Distinguish among PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK,
Oracle 11g: SQL Chapter 4 Constraints.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
DBSQL 5-1 Copyright © Genetic Computer School 2009 Chapter 5 Structured Query Language.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
1 DBS201: More on SQL Lecture 3. 2 Agenda How to use SQL to update table definitions How to update data in a table How to join tables together.
CS453: Databases and State in Web Applications (Part 2) Prof. Tom Horton.
DATA AND SCHEMA MODIFICATIONS CHAPTERS 4,5 (6/E) CHAPTER 8 (5/E) 1.
Mining real world data RDBMS and SQL. Index RDBMS introduction SQL (Structured Query language)
Date: 13/03/2015 Training Reference: 2015 GIS_01 Document Reference: 2015GIS_01/PPT/L4 Issue: 2015/L4/1/V1 Addis Ababa, Ethiopia GIS Data Base Management.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
Query Processing – Implementing Set Operations and Joins Chap. 19.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
 CONACT UC:  Magnific training   
SQL Basics Review Reviewing what we’ve learned so far…….
Source Control Dr. Scott Schaefer. Version Control Systems Allow for maintenance and archiving of multiple versions of code / other files Designed for.
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
Source Control Dr. Scott Schaefer.
CMSC-461 Database Management Systems
Relational Database Design
Presentation transcript:

Bags, foreign keys, selects, joins, and yes, btw, SVN 2/18/2014

SVN - Subversion  The subversion server is student.cs.jmu.edu/cs474/groupName.  I have placed into each groups canvas, the name of the group which will be the folder and the password. Change the password.  You also have a starter set of files and folders to help organize your work on the project.  Each project deliverable from here on out will be uploaded to subversion. For PD2, you can also upload to Canvas, but part of the score will be whether or not you have the same on subversion.

From Dr. Mayfield’s slide

Some basic commands  Check out a working copy of the entire directory. One time only (except if major structural changes are made)  svn co svn+ssh://student.cs.jmu.edu/cs474/group  Make changes to the file/files you are interested in  Merge changes from any group members  svn update  Upload the changes to the repository  svn commit –m “brief description of what you changed”

Others  add filename – Adds the file to the repository  rm filename – Removes a file from the repository.  status – to see what has happened with the repository.  diff – to see differences between two revisions (useful if you need to resolve conflicts)  help – everything you wanted to know about svn commands.

Databases – not done yet, but  Each team will have a db with your team name and all of you will be associated with a role with the same name as the db.  The role will have full access to the db. My recommendation is that you put one person in charge of making db changes and a second as a backup. Make sure that you update your scripts as you update the db so that you can recreate it at any time.

PD 2  Posted – You will build your database schema for the project.  We know that this is a first pass attempt. Do the best you can with it and be selective in what you are working with. You might start out loading the db with a small sample of data rather than the full db.

Bags – Chapter 5.1  So relations are well and good and operate as sets. No duplicate tuples or attributes allowed.  But that is not the real world of SQL.  Modern RDBMS operate like bags.  What’s a bag?

Consider ABC Relation R ABC Relation S

Special operators for bags  δ- duplicate elimination  Removes duplicate tuples  Ex: δ(π A (R)) results in only 3 tuples not 4.  ϒ – grouping (organizes results into groups on a value.  π- Not limited to columns but to other values  τ- Sorting the results based on one or more columns.

Moving back to queries  π=  σ =  =  U =  X =

And for bags  δ= DISTINCT  ϒ = GROUP BY  τ= ORDER BY  SELECT DISTINCT age FROM drivers;  SELECT * FROM drivers ORDER BY lastName;  SELECT * FROM dLangs GROUP BY language;

JOIN – FROM Clause  FROM A JOIN B  FROM A JOIN B ON A.a = B.b  FROM A, B WHERE A.a = B.b  FROM A OUTER JOIN B ON A.a = B.b And many more table-expressions.html  FROM A JOIN B ON A.a = B.b JOIN C on A.a = C.c

Subqueries  Sometimes it is easier to choose (select) rows based on a list of values chosen from a different table. You can use subqueries to do a two pass kind of selection.  SELECT drivers.lastName FROM drivers WHERE drivers.age IN (SELECT visitors.age FROM visitors);

Finally  Foreign keys  Data field in one table (may be a key or key component) represents the key or key component of another table.  Referential integrity  A value (if present) in one table must be matched by the same value in the other.  ALTER TABLE xyz ADD CONSTRAINT fkeyabc FOREIGN KEY (abc) REFERENCES qrs (abc)  The column in xyz, abc, references the key of qrs which is also named abc.