My CD Database THE BEST Shoemaker, Ray, Gleisberg.

Slides:



Advertisements
Similar presentations
Relational Database Systems Higher Information Systems Advanced Implementation in MySQL/PHP.
Advertisements

More SQL Data Definition
Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
MS-Access XP Lesson 1. Introduction to MS-Access Database Management System Software (DBMS) Store data in databases Database is a collection of table.
Relational Database. Relational database: a set of relations Relation: made up of 2 parts: − Schema : specifies the name of relations, plus name and type.
Keys, Referential Integrity and PHP One to Many on the Web.
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.
Greg Riccardi Florida State University. Using SQL to Manipulate Database Content and Structure How to create queries in SQL –Simple select statements.
Maintenance Modifying the data –Add records –Delete records –Update records Modifying the design –Add fields into tables –Remove fields from a table –Change.
Introduction to Structured Query Language (SQL)
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, Copyright © 2010 All Rights Reserved. 1.
1 Relational Model. 2 Relational Database: Definitions  Relational database: a set of relations  Relation: made up of 2 parts: – Instance : a table,
Creating a Blank Database 1. Open up Microsoft Access 2. Click on Blank document button 3. On the right panel, Specify the location for saving your database.
DT211 Stage 2 Databases Lab 1. Get to know SQL Server SQL server has 2 parts: –A client, running on your machine, in the lab. You access the database.
Introduction to Structured Query Language (SQL)
Relational Database Design and MySQL
Using Relational Databases and SQL Steven Emory Department of Computer Science California State University, Los Angeles Lecture 2: Single-Table Selections.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Chapter 5 Introduction to SQL. Structured Query Language = the “programming language” for relational databases SQL is a nonprocedural language = the user.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
1 MySQL and phpMyAdmin. 2 Navigate to and log on (username: pmadmin)
Introduction to Microsoft Access 2003 Mr. A. Craig Dixon CIS 100: Introduction to Computers Spring 2006.
PHP meets MySQL.
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
PHP and MySQL CS How Web Site Architectures Work  User’s browser sends HTTP request.  The request may be a form where the action is to call PHP.
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
1 SQL Tarek El-Shishtawy Professor Ass. Of Computer Engineering.
1 The Relational Model. 2 Why Study the Relational Model? v Most widely used model. – Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. v “Legacy.
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.
Damian Tamayo Tutorial DTM Data Generator Fall 2008 CIS 764.
SQL: DDL. SQL Statements DDL - data definition language –Defining and modifying data structures (metadata): database, tables, views, etc. DML - data manipulation.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Creating Databases for web applications [Complete presentations] More SQL Class time: discuss final projects. Do posting if you have not done it.
CN2180 MS SQL Server Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Soompi Music By: Karen Sin. Introduction to Soompi Music This database models from the various artists and group data gathered from the Korean based English.
Security Considerations Steve Perry
Computer Apps 1 Queries-part b. Queries Query – a database object that requests information from a database and creates a dataset (list of selected.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
Visual Programing SQL Overview Section 1.
John Ykema, Director of Sales & Marketing. Agenda  Understanding the NEW Tool  Table JOINS & Database Views  Building your first report  Charts and.
Transactions, Roles & Privileges Oracle and ANSI Standard SQL Lecture 11.
1 CS 430 Database Theory Winter 2005 Lecture 10: Introduction to SQL.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
CREATE TABLE ARTIST ( ArtistID int NOT NULL IDENTITY (1,1), Namechar(25) NOT NULL, TEXT ERROR Nationality char (30) NULL, Birthdate numeric (4,0) NULL,
Relational Database Design and MySQL Charles Severance
DAY 14: ACCESS CHAPTER 1 RAHUL KAVI October 8,
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
Physical Model Lecture 11. Physical Data Model The last step is the physical design phase, In this phase data is – Store – Organized and – Access.
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.
VOCAB REVIEW. A field that can be computed from other fields Calculated field Click for the answer Next Question.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
Databases.
Chapter 5 Introduction to SQL.
Relational Database Design
Insert, Update and the rest…
SQL – CRUD.
SQL – More Table Constraints
Database application MySQL Database and PhpMyAdmin
ISC440: Web Programming 2 Server-side Scripting PHP 3
CS122 Using Relational Databases and SQL
CSE Students: Please do not log in yet.
Session - 6 Sequence - 1 SQL: The Structured Query Language:
ICT Database Lesson 2 Designing a Database.
CS122 Using Relational Databases and SQL
Session - 6 Sequence - 1 SQL: The Structured Query Language:
Presentation transcript:

My CD Database THE BEST Shoemaker, Ray, Gleisberg

MY CDDB The CD Database will be used by a person who wants to store information about their CD collection. Contains information about –CD’s title –Songs –Track #’s and Lengths –Genre –Label and Date the CD was released –Artists Groups (The Beatles) Individual (Paul McCartney) Main or Supporting

Sample Queries What CDs have the word “all” in the title? What are the names of all of the songs on Eminem Show? What are the names of all rap CDs? On what songs are The Beatles main artists? Did Blink 182 release an album in 2001? What CDs in the database have every track length longer than the average track length? What is the longest song on Eminem Show? The shortest?

Relational Model genre(name) artist(id, name, type) members(aid, gid) –Foreign Key: aid and gid references id in artist cd(id, title, releaseyear, genre, aid) –Foreign Key: aid references id in artist –Foreign Key: genre references name in genre cdtrack(cdid, track_num, musicpiece, length) –Foreign Key: cdid references id in cd performance(cdid, track_num, aid, type) –Foreign Key: aid references id in artist –Foreign Key: cdid, track_num references cdtrack cdlabel(cdid, label) –Foreign Key: cdid references id in cd

SQL Schema CREATE TABLE genre ( id SERIAL PRIMARY KEY, name CHARACTER VARYING (20) UNIQUE NOT NULL); CREATE TABLE artist ( id SERIAL PRIMARY KEY, name CHARACTER VARYING (50) NOT NULL, type CHARACTER VARYING (10) DEFAULT 'individual' CHECK (type IN ('individual','group','various')));

SQL Schema CREATE TABLE members ( aid INTEGER, gid INTEGER, PRIMARY KEY (aid, gid), FOREIGN KEY (aid) REFERENCES artist (id) ON DELETE CASCADE, FOREIGN KEY (gid) REFERENCES artist (id) ON DELETE CASCADE); CREATE TABLE cd ( id SERIAL PRIMARY KEY, title CHARACTER VARYING (60)DEFAULT 'none', releaseyear NUMERIC (4)NOT NULL, gid INTEGER NOT NULL, aid INTEGER NOT NULL, FOREIGN KEY (aid) REFERENCES artist (id), FOREIGN KEY (gid) REFERENCES genre (id));

SQL Schema CREATE TABLE cdtrack ( id SERIAL PRIMARY KEY, cdid INTEGERNOT NULL, track_num INTEGERNOT NULL, musicpiece CHARACTER VARYING (100) DEFAULT 'no name', length INTERVAL (0), UNIQUE (cdid,track_num), FOREIGN KEY (cdid) REFERENCES cd (id) ON DELETE CASCADE); CREATE TABLE performance ( tid INTEGER, aid INTEGER, type CHARACTER VARYING (10) DEFAULT 'main' CHECK (type IN ('main', 'supporting')), PRIMARY KEY (tid, aid), FOREIGN KEY (aid) REFERENCES artist (id) ON DELETE CASCADE, FOREIGN KEY (tid) REFERENCES cdtrack (id) ON DELETE CASCADE);

SQL Schema CREATE TABLE cdlabel ( cdid INTEGER, label CHARACTER VARYING (20), PRIMARY KEY (cdid, label), FOREIGN KEY (cdid) REFERENCES cd (id) ON DELETE CASCADE);

User Interface at a Glance Inserting, modifying, and deleting data.

Searching How it works 1.The typed in search string is sent to a php web page 2.The string along with the options chosen created into an SQL query. 3.Here is an example of the SQL query string created with 4.like, and cd options are chosen: 5.SELECT id, title 6.FROM cd 7.WHERE title LIKE ‘%all%’ order by title 8.This query returns a cd’s id and title.

My CDDB Home Page

Searching Regular Searching –Searching with EXACTLY only returns exact matches –LIKE returns results that include the entered sub string. This is done by using the PostgreSQL wild card character %. Ex. select name from genre where name LIKE ‘%all%’ –The last option is what you are searching.

Searching After the SQL query is created 1.Query is run using pg_query() 2.The results are accessed using pg_fetch_array() 3.Get the number of rows returned using pg_numrows()

Advanced Search

Advanced Searching Accomplishing the SQL –All the tables involved are joined. –If a field is entered, then that condition is added to the end of the sql statement. Example: SELECT c.title FROM cd c, artist a, performance p, cdtrack t WHERE c.id = t.cdid AND p.aid = a.id AND p.tid = t.id AND a.name =‘john lennon’ AND p.type = ‘supporting’;

Simple Searches What CDs have the Beatles released? What are the names of all of the songs on Eminem Show? What are the names of all the rap CDs?

Advanced Searches What songs are The Beatles main artists? Did Blink 182 release an album in 2001?

SQL Queries What CDs in the database have every track length longer than the average track length? What is the longest song on Eminem Show? The shortest?