! An organized collection of data. ! Can easily be accessed, managed, and updated. ! Data are organized as a set of tables.

Similar documents
Chapter 3. Introduction to relational databases and MySQL. 2010, Mike Murach & Associates, Inc. Murach's PHP and MySQL, C3

Server-side Web Programming

Working with Databases and Java

13 Creation and Manipulation of Tables and Databases

Introduction to relational databases and MySQL

Locate your Advanced Tools and Applications

Server-side Web Programming

Databases (MariaDB/MySQL) CS401, Fall 2015

Relational databases and SQL

Hello everyone! Page 1. Your folder should look like this. To start with Run your XAMPP app and start your Apache and MySQL.

Locate your Advanced Tools and Applications

Creating the Data Layer

An introduction for the novice. David Lawrence, JLab. 5/8/07 MySQL David Lawrence 1/36

CS 2316 Homework 9b GT Thrift Shop Due: Wednesday, April 20 th, before 11:55 PM Out of 100 points. Premise

PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008.

Database Systems. phpmyadmin Tutorial

SQL DDL. Intro SQL CREATE TABLE ALTER TABLE Data types Service-based database in Visual Studio Database in PHPMyAdmin

205CDE Developing the Modern Web. Assignment 2 Server Side Scripting. Scenario D: Bookshop

What is SQL? Toolkit for this guide. Learning SQL Using phpmyadmin

Mastering phpmyadmiri 3.4 for

WIRELESS DATABASE VIEWER PLUS (ENTERPRISE EDITION) SERVER SIDE USER GUIDE

DATABASE WRITEBACK. This document describes the process of setting up writeback to a database from a report within Cognos Connection.

/* The following are all SQL commands. They have to end with a ";" so that SQLite can read them! */

BLACKBERRY WIRELESS DATABASE VIEWER USER GUIDE PRODUCT VERSION: 1.0

Storage Tier. Mendel Rosenblum. CS142 Lecture Notes - Database.js

This lab will introduce you to MySQL. Begin by logging into the class web server via SSH Secure Shell Client

Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations. SQL: Structured Query Language

Welcome to the RISD Materials /Media Center Online Public Access Catalog

Chapter 10: MySQL & PHP. PHP and MySQL CIS 86 Mission College

Danulabs Bookstore task for applicants

A340 Laboratory Session #17

CRAF RFI Database: a MySQL implementation

Online Classified Portal

Adding a Admin account to Wordpress database

Adding JDBC Driver package to the Application Server

SQL. Often times, in order for us to build the most functional website we can, we depend on a database to store information.

ThingWorx Relational Databases Connectors Extension User Guide

IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population

Chapter 1 An introduction to relational databases and SQL

Electronic Sales Platform User s Manual

MOBILEDATABASE USER GUIDE PRODUCT VERSION: 1.0

1Z MySQL 5 Database Administrator Certified Professional Exam, Part II Exam.

Download and Installation Instructions: After WAMP Server download start the installation:

COP4540 TUTORIAL PROFESSOR: DR SHU-CHING CHEN TA: H S IN-YU HA

CS2300: File Structures and Introduction to Database Systems

TestsDumps. Latest Test Dumps for IT Exam Certification

Faculty of Environment & Technology

I need to get the maximum length of data per each column in a bunch of tables. are looking at BEGIN -- loop through column names in all_tab_columns.

Importing to WIRED Contact From a Database File. Reference Guide

SQL Stored Programs. You Can Not Do Everything in SQL SQL/PSM Cursors Recursion Triggers. Niklas Fors Stored Programs 1 / 21

COGS 121 HCI Programming Studio. Week 03 - Tech Lecture

tablename ORDER BY column ASC tablename ORDER BY column DESC sortingorder, } The WHERE and ORDER BY clauses can be combined in one

Quick Guide to Installing and Setting Up MySQL Workbench

HKTA TANG HIN MEMORIAL SECONDARY SCHOOL SECONDARY 3 COMPUTER LITERACY. Name: ( ) Class: Date: Databases and Microsoft Access

SQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas

Package sjdbc. R topics documented: December 16, 2016

Brekeke SIP Server Version 2.1 Using a Third-Party Database Tutorial Brekeke Software, Inc.

Database and MySQL Temasek Polytechnic

The connection has timed out

Configuring Pentaho to Use Database-Based Security

Module 3 MySQL Database. Database Management System

Accessing databases in Java using JDBC

CSC 215 PROJECT 2 DR. GODFREY C. MUGANDA

opencrx Installation Guide for MySQL 5

Getting Started With the Cisco PAM Desktop Software

IN THIS CHAPTER,YOU LEARN THE BASICS of databases, including how they

CSC System Development with Java. Database Connection. Department of Statistics and Computer Science. Budditha Hettige

WIRELESS DATABASE VIEWER PLUS FOR IPHONE: USER GUIDE PRODUCT VERSION: 1.0

Introduction to SQL on GRAHAM ED ARMSTRONG SHARCNET AUGUST 2018

Cyrus Shahabi Computer Science Department University of Southern California C. Shahabi

Application Programming for Relational Databases

Development Technologies. Agenda: phpmyadmin 2/20/2016. phpmyadmin MySQLi. Before you can put your data into a table, that table should exist.

Databases and SQL Lab EECS 448

SynApp2 Walk through No. 1

Department of Computer Science University of Cyprus. EPL342 Databases. Lab 2

CS 377 Database Systems. Li Xiong Department of Mathematics and Computer Science Emory University

Previously everyone in the class used the mysql account: Username: csci340user Password: csci340pass

origin destination duration New York London 415 Shanghai Paris 760 Istanbul Tokyo 700 New York Paris 435 Moscow Paris 245 Lima New York 455

The Object-Oriented Paradigm. Employee Application Object. The Reality of DBMS. Employee Database Table. From Database to Application.

Chapter 3 Introduction to relational databases and MySQL

CGS 3066: Spring 2017 SQL Reference

Database Explorer Quickstart

Acknowledgments About the Authors

PERSİSTENCE OBJECT RELATİON MAPPİNG

Project Design Internet Auction Web Site University of British Columbia Okanagan COSC Fall 2007

PARTS System Prototype. Everyone would start the PARTS system from an icon on their desktop. The icon could look similar to the following.

DB I. 1 Dr. Ahmed ElShafee, Java course

Previously everyone in the class used the mysql account: Username: csci340user Password: csci340pass

Database Application Development

Command Line Interface

MySQL Schema Best Practices

T Technical specification: FASTAXON Group: Muuntaja

COOKBOOK Row-Level Security

Data Analysis and Integration

How to use SQL to create a database

Chapter 9 SQL in a server environment

Oracle SQL Developer. Oracle TimesTen In-Memory Database Support User's Guide Release 4.0 E

Web Database Programming

MYRO My Record Oriented privilege system

Using PHP with MYSQL

Transcription:

What s Database INTRODUCTION OF DATABASE XIAOBO SUN! An organized collection of data! Can easily be accessed, managed, and updated Relational Database:! Data are organized as a set of tables.! Each table contains records(horizontal rows of the table).!! Each record contains fields(vertical columns of the table).! Fields can be of many different data types. DATABASE ACCESS (SQL) Table name: USER field header user_id password user_name created_date record user1 1111 Tom 12/10/2012 user2 2222 Kate 13/10/2012! SQL(Structured Query Language)! Data Definition! CREATE TABLE! DROP TABLE!! Data Manipulation! SELECT - Fetch rows from table! INSERT Add a row into table! UPDATE update rows in table! DELETE Remove rows from table

CREATE TABLE Create a new table Create the user table DROP TABLE Delete a table Delete the user table

INSERT Insert a row into table user1 1111 Tom 1 2012-10-17 23:30:00 Insert a row into user table SELECT Fetch records from table user1 1111 Tom 1 2012-10-15 13:00:52 user2 2222 Kate 2 2012-10-23 03:22:30 id1 3333 Rose 2 2012-09-23 22:20:00 1. Fetch single row from table Result:

user1 1111 Tom 1 2012-10-15 13:00:52 user2 2222 Kate 2 2012-10-23 03:22:30 id1 3333 Rose 2 2012-09-23 22:20:00 2. Fetch multiple rows from table and sort the results in descending UPDATE Update rows of table Result: DELETE user1 1111 Tom 1 2012-10-15 13:00:52 user2 2222 Kate 2 2012-10-23 03:22:30 id1 3333 Rose 2 2012-09-23 22:20:00 id2 4444 Jack 2 2012-09-25 12:00:22 user3 5555 newuser 3 2012-09-25 12:00:22 Delete rows from table Update rows in user table

MYSQL user1 1111 Tom 1 2012-10-15 13:00:52 user2 2222 Kate 2 2012-10-23 03:22:30 id1 3333 Rose 2 2012-09-23 22:20:00 id2 4444 Jack 2 2012-09-25 12:00:22 user3 5555 newuser 3 2012-09-25 12:00:22! The most used open source relational database system! Free! Can be easily managed by web-based tool (phpmyadmin) Delete a row from user table USE MYSQL CLIENT USE MYSQL IN JAVA 1. Install MYSQL Visit the website below, choose your os and download the package. http://dev.mysql.com/downloads/mysql/ 2. Connect to the MYSQL server! Step1: Design your tables! Step2: Create tables and add initial data using mysql client! Step3: Access tables from JAVA code (JDBC) 3. Execute SQL

1. DESIGN YOUR TABLES CREATE DOCUMENT In project2, we need tables to store users, books, and exchange history SELLER LOGIN PUBLISH BOOK SELL DATABASE Before creating the real tables, make document for your table design.user Table (store user login info) Field Name type length PK Purpose(Note) user_id VARCHAR 20 O Login ID password VARCHAR 20 Login password privilege INT 1.Book Table (store book info) BUYER LOGIN BUY Field Name type length PK Purpose(Note) ISBN CHAR 13 O The ISBN of book title VARCHAR 100 Book s title author VARCHAR 100 Book s author CREATE DOCUMENT SOME DETAILS.Transaction Table (store transaction history) Field Name type length PK Purpose(Note) tran_id CHAR 20 O Transaction ID buyer VARCHAR 20 Buyer s user id seller VARCHAR 20 Seller s user id YOU MAY NEED MORE TABLES FOR YOUR PROJECT!.Primary key (PK)! A combination of columns which uniquely specify a row! A table can have at most one primary key! The columns of primary key cannot be NULL.Data type(of fields)! INT: store integer! CHAR: store string(the length is fixed)! VARCHAR: store string(the length is variable)!

2. CREATE TABLES 3. USE MYSQL IN JAVA Create tables in advance before starting to code. *You don t need to create them in your JAVA program!! Translate your tables design into SQL(CREATE TABLE) JDBC: Java Database Connectivity. It enables Java programs to execute SQL statements. ACCESS MYSQL BY JDBC! Execute the SQL! Insert initial data if necessary *In project2, you may have to add book info into book table in advance. 3. USE MYSQL IN JAVA THREE STEPS TO USE JDBC: 1. Download JDBC driver (MYSQL connector/j) http://dev.mysql.com/downloads/connector/j/ CONNECT TO SERVER 2. Add the downloaded JAR file into your java project(build path) 3. Use JDBC classes to execute SQL

SELECT INSERT DISCONNECT THANK YOU!!