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.

Slides:



Advertisements
Similar presentations
Complex Integrity Constraints in SQL. Constraints over a Single Table Table Constraint: Create TABLE Sailors (sid INTEGER, sname CHAR(10), rating INTEGER,
Advertisements

Database design by Sarah Huynh.
Query Methods (SQL). What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries.
1 Constraints, Triggers and Active Databases Chapter 9.
Keys, Referential Integrity and PHP One to Many on the Web.
Hierarchies & Trees in SQL by Joe Celko copyright 2008.
Database Theory Each Table in a Database needs a Primary Key Data TypesDescriptionExample TextCharacters (Letters, numbers and symbols) ABC 123 NumberNumerical.
Review Indra Budi Fakultas Ilmu Komputer UI 2 Database Introduction Database vs File Processing Main purpose of database Database Actors.
COMP 3715 Spring 05. Working with data in a DBMS Any database system must allow user to  Define data Relations Attributes Constraints  Manipulate data.
Book Chapter 3 (part 2 ) From ER to Relational Model.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
My CD Database THE BEST Shoemaker, Ray, Gleisberg.
Murali Mani SQL DDL and Oracle utilities. Murali Mani Datatypes in SQL INT (or) INTEGER FLOAT (or) REAL DECIMAL (n, m) CHAR (n) VARCHAR (n) DATE, TIME.
5 Chapter 5 Structured Query Language (SQL1) Revision.
Structured Query Language Chapter Three (Excerpts) DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
30-Jun-15 SQL A Brief Introduction. SQL SQL is Structured Query Language Some people pronounce SQL as “sequel” Other people insist that only “ess-cue-ell”
Structured Query Language Chapter Three DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
SQL DDL constraints Restrictions on the columns and tables 1SQL DDL Constraints.
Relational Database Design and MySQL
Midterm 1 Concepts Relational Algebra (DB4) SQL Querying and updating (DB5) Constraints and Triggers (DB11) Unified Modeling Language (DB9) Relational.
DATABASES AND SQL. Introduction Relation: Relation means table(data is arranged in rows and columns) Domain : A domain is a pool of values appearing in.
SQL Basics. SQL SQL (Structured Query Language) is a special-purpose programming language designed from managing data in relational database management.
1 MySQL and phpMyAdmin. 2 Navigate to and log on (username: pmadmin)
The 2 nd Hand Student Book Database Jon Havier High Distinction Assignment, Autumn 2007.
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
INFO 344 Web Tools And Development CK Wang University of Washington Spring 2014.
SQL Server 7.0 Maintaining Referential Integrity.
“National Electoral Division Profiles” Case Study Vincent Tang High Distinction Assignment, Autumn 2007.
Slide 1 Chapter 7 – Part 1 Data Definition Language & Data Manipulation Language.
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.
Recap of SQL Lab no 8 Advance Database Management System.
© 2002 by Prentice Hall 1 Database Processing with Microsoft Access David M. Kroenke Database Concepts 1e Appendix A.
Database Processing with Microsoft Access Appendix DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
CS499 Project #3 XML mySQL Test Generation Members Erica Wade Kevin Hardison Sameer Patwa Yi Lu.
Dec 8, 2003Murali Mani Constraints B term 2004: lecture 15.
Introduction to Database System Adisak Intana Lecturer Chapter 7 : Data Integrity.
DBSQL 5-1 Copyright © Genetic Computer School 2009 Chapter 5 Structured Query Language.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
Visual Programing SQL Overview Section 1.
SQL LANGUAGE and Relational Data Model TUTORIAL Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
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.
An Introduction to SQL For CS Overview of SQL  It is the standard language for relational systems, although imperfect  Supports data definition.
Databases.  Question 1: What does SQL stand for? …………………………………………………………………… (1 point)  Question 2: Considering programming paradigms, what kind of language.
1 CS 430 Database Theory Winter 2005 Lecture 10: Introduction to SQL.
Managing Database With Oracle Replacement for Ch10 COP 4708.
© 2002 by Prentice Hall 1 Structured Query Language David M. Kroenke Database Concepts 1e Chapter 3 3.
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 6 This material was developed by Oregon Health & Science.
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,
Constraints Review. What is a constraint? Unique – forbids duplicate values Referencial – Foreign key Check Constraint – sets restrictions on data added.
Jenny Jirathammakul High Distinction Assignment Database Principles Autumn, 2007 Melbourne City Toyota.
Relational Database Design and MySQL Charles Severance
الفصل السادس لغة Structured Query Language) SQL الفصل السادس لغة Structured Query Language) SQL.
FEN Introduction to the database field: The development process Seminar: Introduction to relational databases Development process: Analyse.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Databases Introduction - concepts. Concepts of Relational Databases.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Big Data Yuan Xue CS 292 Special topics on.
The Booktopia Database
Structured Query Language
Understanding SQL Statements
Insert, Update and the rest…
SQL – More Table Constraints
The Dance Fever Case Study
From ER to Relational Model
CS122 Using Relational Databases and SQL
Relational Databases.
CS122 Using Relational Databases and SQL
Presentation transcript:

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 forum called ‘ This database shows the various aspects of artists information that many people have interests in. It allows users to search up their favourite solo artists or groups and shows fanclubs, the various albums they may have released and their promotional events they have participated in.

Soompi Music Management ERD SM_Artist SM_AlbumDetails SM_PromotionalEvents SM_GroupDetails ArtistId ArtistStageName ArtistRealName DOB PlaceOfBirth Gender GroupName ManagementId AlbumDetailsId ArtistId* GroupDetailsId* AlbumName AlbumNumber AlbumYear Language PromotionalEventId ArtistId* GroupDetailsId Location EventType Date GroupDetailsId GroupName YearDebuted GroupSize ManagementId SM_FanClubDetails FanClubDetailsId FanClubName ArtistId* GroupDetailsId* YearFormed Colour SM_ArtistPE ArtistId* PromotionalEventId*

One to Many Relationship One Group can contain many artists. SM_Artist SM_GroupDetails ArtistId ArtistStageName ArtistRealName DOB PlaceOfBirth Gender GroupName ManagementId GroupDetailsId GroupName YearDebuted GroupSize managementid

Many to Many Relationship SM_Artist SM_AlbumDetails SM_GroupDetails ArtistId ArtistStageName ArtistRealName DOB PlaceOfBirth Gender GroupName ManagementId AlbumDetailsId ArtistId* GroupDetailsId* AlbumName AlbumNumber AlbumYear Language GroupDetailsId GroupName YearDebuted GroupSize ManagementId Many Artists can have many albums and many albums can contain many groups

Query on a single entity/table Show all the artists that were born at Seoul. SELECT * FROM SM_Artist WHERE PlaceOfBirth = ‘Seoul’; artistid | artiststagename | artistrealname | dob | placeofbirth | gender | groupname | managementid | Micky | Park YooChun | | Seoul | M | DBSK | SM | Max | Choi Kang Changmin | | Seoul | M | DBSK | SM5 (2 rows)

Natural Join Show artist stage name, Group Name and fan club name where gender of an artist is female. SELECT ArtistStageName, GroupName,FanClubName FROM SM_Artist NATURAL JOIN SM_FanclubsDetails WHERE Gender = ‘F’; artiststagename | groupname | fanclubname BoA | NULL | Jumping BoA (1 row)

Cross Product Join SELECT ArtistStageName, GroupName, FanClubsName FROM SM_Artist, SM_FanclubsDetails WHERE SM_Artist.ArtistId = SM_FanclubsDetails.ArtistId and Gender = ‘F’; artiststagename | groupname | fanclubname BoA | NULL | Jumping BoA (1 row)

Group By using Having Show the total number of albums released by each group that has more than 1 album released SELECT artiststagename, count(*) AS TotalAlbums FROM SM_GroupDetails, SM_Artist, SM_AlbumDetails WHERE SM_GroupDetails.Groupname = SM_AlbumDetails.Groupname and SM_AlbumDetails.ArtistId = SM_Artist.ArtistId GROUP BY artiststagename having count(*)>1; artiststagename | totalalbums DBSK | 3 (1 row)

Sub Query Show all the albums with the album number greater than the average for all album numbers SELECT AlbumName, AlbumNumber FROM SM_AlbumDetails WHERE AlbumNumber > (SELECT AVG(AlbumNumber) FROM SM_AlbumDetails); albumname | albumnumber Miracle | 4 Atlantis Princess | 5 Shine We Are | 6 My Name | 7 Girls On Top | 8 Cao Cao | 4 Utada Hikaru Single Collection | 4 Ultra Blue | 5 (8 rows)

Self Join Show all the albums that were released in the same year as the ‘Rising Sun’ album SELECT n2.albumname, n1.albumyear FROM SM_AlbumDetails n1, SM_AlbumDetails n2 WHERE n1.albumname = 'Rising Sun' and n1.albumyear = n2.albumyear; albumname | albumyear Rising Sun | 2005 Girls On Top | 2005 No | 2005 Cao Cao | 2005 (4 rows)

Check Statements Check if a group meets the requirement of having 2 or more members CONSTRAINT SM_GroupDetails_GroupSize CHECK ( GroupSize >= 2), Check if album number is a positive integer CONSTRAINT SM_AlbumDetails_AlbumNumber CHECK (AlbumNumber >= 1),

SQL Action Statements CREATE TABLE SM_FanClubsDetails ( FanClubDetailsId CHAR(3) NOT NULL, FanClubName TEXT, ArtistId CHAR(4), GroupDetailsId CHAR(5), DateFormed CHAR(4), Colour TEXT, --Colour used to represent the fan club CONSTRAINT SM_FanClubsDetails_PK PRIMARY KEY (FanClubDetailsId), CONSTRAINT SM_FanClubsDetails_FK FOREIGN KEY (ArtistId) REFERENCES SM_Artist (ArtistId) ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT SM_FanClubsDetails_DateFormed CHECK ((DateFormed >= 1900) AND (DateFormed <= 2007)) ); This is used here so that even if a fan club dismisses it does not mean an artist will be deleted aswell

SQL Action Statements ); Prevents the deletion of data used by any other groups in other tables. CREATE TABLE SM_PromotionalEvents ( PromotionalEventsId Char(4) NOT NULL, ArtistId Char(4), Location TEXT, EventType TEXT, Date DATE, CONSTRAINT SM_PromotionalEvents_PK PRIMARY KEY (PromotionalEventsId), CONSTRAINT SM_PromotionalEvents_FK FOREIGN KEY (ArtistId) REFERENCES SM_Artist ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT SM_PromotionalEvents_Date CHECK ((Date >= 1900) AND (DATE <= 2007))--Events must of alreadly occurred to be here );

Creating a View Show every album every artist in the database have released CREATE VIEW SM_EveryArtistandAlbum (ArtistStageName, AlbumName)As SELECT ArtistStageName, AlbumName FROM Sm_artist, Sm_albumdetails where SM_artist.Artistid= SM_albumdetails.artistid; artiststagename | albumname DBSK | Miduhyo DBSK | Rising Sun DBSK | O Jung Ban Hab BoA | Id Peace B BoA | Dont Start Now BoA | No.1 BoA | Miracle BoA | Atlantis Princess BoA | Shine We Are BoA | My Name BoA | Girls On Top JJ Lin | Music Voyage JJ Lin | Haven JJ Lin | No JJ Lin | Cao Cao Utada Hikaru | First Love Utada Hikaru | Distance Utada Hikaru | Deep River Utada Hikaru | Utada Hikaru Single Collection Utada Hikaru | Ultra Blue (20 rows)