Databases Dan Otero Alex Loddengaard

Slides:



Advertisements
Similar presentations
Query Methods (SQL). What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries.
Advertisements

Lecture Microsoft Access and Relational Database Basics.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
CSE 190: Internet E-Commerce Lecture 10: Data Tier.
COMPREHENSIVE Access Tutorial 2 Building a Database and Defining Table Relationships.
FIRST COURSE Access Tutorial 2 Building a Database and Defining Table Relationships.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
Phil Brewster  One of the first steps – identify the proper data types  Decide how data (in columns) should be stored and used.
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
CSCI 6962: Server-side Design and Programming
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Database Lecture # 1 By Ubaid Ullah.
Introduction –All information systems create, read, update and delete data. This data is stored in files and databases. Files are collections of similar.
ASP.NET Programming with C# and SQL Server First Edition
A CCESSING D ATABASES WITH JDBC CH 24 C S 442: A DVANCED J AVA P ROGRAMMING.
Concepts of Database Management Seventh Edition
1 MySQL and phpMyAdmin. 2 Navigate to and log on (username: pmadmin)
Access Tutorial 2 Building a Database and Defining Table Relationships
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
Database Technical Session By: Prof. Adarsh Patel.
Databases. Database A database is an organized collection of related data.
® Microsoft Office 2013 Access Building a Database and Defining Table Relationships.
Web Design: Basic to Advanced Techniques Fall 2010 Mondays 7-9pm 200 Sutardja-Dai Hall Databases & SQL Lecture Code:
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
Relational Database Management Systems. A set of programs to manage one or more databases Provides means for: Accessing the data Inserting, updating and.
INFO 344 Web Tools And Development CK Wang University of Washington Spring 2014.
1 Working with MS SQL Server Textbook Chapter 14.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Working with MSSQL Server Code:G0-C# Version: 1.0 Author: Pham Trung Hai CTD.
Relational Databases Database Driven Applications Retrieving Data Changing Data Analysing Data What is a DBMS An application that holds the data manages.
Database Essentials. Key Terms Big Data Describes a dataset that cannot be stored or processed using traditional database software. Examples: Google search.
1 Copyright © 2004, Oracle. All rights reserved. Introduction.
Concepts of Database Management Seventh Edition
® Microsoft Office 2010 Building a Database and Defining Table Relationships.
SQL Basics. 5/27/2016Chapter 32 of 19 Naming SQL commands are NOT case sensitive SQL commands are NOT case sensitive But user identifier names ARE case.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
Microsoft Access 2013 ®® Tutorial 10 Automating Tasks with Macros.
JDBC Tutorial CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
DAT602 Database Application Development Lecture 2 Review of Relational Database.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
CS453: Databases and State in Web Applications (Part 2) Prof. Tom Horton.
A CCESSING D ATABASES WITH JDBC CH 24 C S 442: A DVANCED J AVA P ROGRAMMING.
Planning & Creating a Database By Ms. Naira Microsoft Access.
DATA BASE ADMINISTRING DATABASE SERVICES IN RED HAT LINUX.
JDBC CS 260 Database Systems. Overview  Introduction  JDBC driver types  Eclipse project setup  Programming with JDBC  Prepared statements  SQL.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
Chapter 3: Relational Databases
Working with MySQL A290/A590, Fall /07/2014.
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.
SQL pepper. Why SQL File I/O is a great deal of code Optimal file organization and indexing is critical and a great deal of code and theory implementation.
Databases and SQL CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
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.
Introduction to Database Programming with Python Gary Stewart
Agenda for Today  DATABASE Definition What is DBMS? Types Of Database Most Popular Primary Database  SQL Definition What is SQL Server? Versions Of SQL.
Chapter 12 Introducing Databases. Objectives What a database is and which databases are typically used with ASP.NET pages What SQL is, how it looks, and.
Access Tutorial 2 Building a Database and Defining Table Relationships
INTRODUCTION TO DATABASES (MICROSOFT ACCESS)
Working in the Forms Developer Environment
Objectives Create an action query to create a table
Introduction to Web programming
Principles of Software Development
Database Management  .
Teaching slides Chapter 8.
Structured Query Language
IST 311 Object-Oriented Design and Software Applications
Lecture 2 Database & SQL Continued
CS3220 Web and Internet Programming SQL and MySQL
CS3220 Web and Internet Programming SQL and MySQL
Tutorial 9 Using Action Queries and Advanced Table Relationships
Presentation transcript:

Databases Dan Otero Alex Loddengaard

Basic Data Storage Memory –Small ( GB) –Non-persistent Text Files –Inefficient –Difficult to organize

Databases A program that –Manages possibly huge quantities of data –Facilitates fast and easy access –Makes data integrity guarantees –Has A LOT under the covers ACID -

Databases (cont.) Applications –Amazon.com, Facebook, IMDB, digg.com, banks, Google, etc Implementations –MySQL, Postgre, Oracle, Microsoft SQL Server

Database Organization A single database has multiple tables A table has multiple rows Each row has multiple columns Each column represents a different data category Table of actors:

Database Structure Column types –INT, VARCHAR (String), DOUBLE… Schemas –What tables exist? –What types of columns are in each table?

Database Operations (CRUD) Consider IMDB Create data in a table –A new actor has just appeared in a film Read data from a table –Somebody has searched for an actor Update data in a table –An actor has appeared in a new movie Delete data in a table –A planned movie is cancelled

Structured Query Language (SQL) The language that one uses to interface with a database Allows a user to perform CRUD operations on a particular database

Warning We are skipping a lot –Creating a database –Creating a table –Creating a user and setting permissions Use Google to find examples of each of these

Create (INSERT) Insert a row into the actors table containing id=5, name=“Nicole Kidman”, DOB=“06/20/1967” gender=“F” INSERT INTO actors VALUES (‘5’, ‘Nicole Kidman’, ‘06/20/1967’, ‘F’); Note that the order of values depends on the way the table was created

Read (SELECT) Get all rows and only the id column from the “actors” table SELECT id FROM actors; Get all rows and columns from the “actors” table SELECT * FROM actors; Get all rows and columns from the “actors” table whose name field is “Tom Cruise.” SELECT * FROM actors WHERE name = ‘Tom Cruise’; Get all rows and columns from the “actors” table whose name field is either “Tom Cruise” or “Katie Holmes.” SELECT * FROM actors WHERE name = ‘Tom Cruise’ OR name = ‘Katie Holmes’;

Update (UPDATE) Change Tom Cruise’s gender UPDATE actors SET gender = ‘F’ WHERE name = ‘Tom Cruise’; Change Tom Cruise’s gender if he is a man UPDATE actors SET gender = ‘F’ WHERE name = ‘Tom Cruise’ AND gender = ‘M’;

Delete (DELETE) Delete Tom Cruise from the table DELETE FROM actors WHERE name = ‘Tom Cruise’;

How the Database Fits In A table can be represented by a Java class (in the model) –Columns in the table represent fields in Java

The code… First –Install MySQL –Install MySQL’s JDBC driver –Include the driver as a library in your Eclipse project Right click on your project and go to “Properties” Go to “Java Build Path” and select the “Libraries” tab Click the “Add Exernal Jars…” button and select the jar file from the JDBC driver

Interacting with MySQL Option 1: Command line –Series of commands - use Google to find them Option 2 : Management Software – Option 3: Java programs

Relationships Actor IDs are “Primary Keys” in the actor table Actor IDs are “Foreign Keys” in the movie table

Relationship in SQL This is called “joining” Get the lead actor for the “Tommy Boy” movie SELECT a.* FROM actors a, movies m WHERE m.name = ‘Tommy Boy’ and a.id = m.lead_role; “a” and “m” are variables and the “join” occurs in the second where clause

ACID Atomicity –All or none Consistency –Always in a legal state Isolation –Each user is isolated from each other user Durability –Can recover after a crash or power failure

Useful Links IMDB Database: – –Download the plain text interface and import it into MySQL (see Google) Sun’s Data Access Object Pattern – erns/Patterns/DataAccessObject.html