CS/INFO 4154: Analytics-driven Game Design

Similar documents
Administrivia Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications

Mobile Application Programming: ios

Administrivia Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications

Create a simple database with MySQL

Mobile Application Programming: Android

Oracle 1Z MySQL 5.6 Developer.

Server Side Scripting Report

CS 186 Midterm, Spring 2003 Page 1

Homework 3: Relational Database Design Theory (100 points)

CLASS DISCUSSION AND NOTES

Oracle Exam 1z0-882 Oracle Certified Professional, MySQL 5.6 Developer Version: 7.0 [ Total Questions: 100 ]

Introduction to Data Management. Lecture 16 (SQL: There s STILL More...) It s time for another installment of...

CSCI-UA: Database Design & Web Implementation. Professor Evan Sandhaus

Querying Data with Transact-SQL

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

the gamedesigninitiative at cornell university Lecture 1 Course Overview

Querying Data with Transact SQL

Databases (MariaDB/MySQL) CS401, Fall 2015

Chapter 4: SQL Basics

T-SQL Training: T-SQL for SQL Server for Developers

INF 315E Introduction to Databases School of Information Fall 2015

Important Notes: For this course you must check the Regis Bookstore: for the most current online course material information.

OKC MySQL Users Group

Practice for Test 1 (not counted for credit, but to help you prepare) Time allowed: 1 hour 15 minutes

SQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas

Instructor: Craig Duckett. Lecture 04: Thursday, April 5, Relationships

DATABASE PERFORMANCE AND INDEXES. CS121: Relational Databases Fall 2017 Lecture 11

CS 327E Lecture 2. Shirley Cohen. January 27, 2016

Bases de Dades: introduction to SQL (indexes and transactions)

Creating the Data Layer

NULL. The special value NULL could mean: Unknown Unavailable Not Applicable

Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Administrivia. Administrivia. Faloutsos/Pavlo CMU /615

PostgreSQL Database and C++ Interface (and Midterm Topics) ECE 650 Systems Programming & Engineering Duke University, Spring 2018

CS 564: DATABASE MANAGEMENT SYSTEMS

Exact Numeric Data Types

EE221 Databases Practicals Manual

Database Systems. phpmyadmin Tutorial

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

CS/INFO 4154: Analytics-driven Game Design

Data Modelling and Databases. Exercise Session 7: Integrity Constraints

INDEX. 1 Basic SQL Statements. 2 Restricting and Sorting Data. 3 Single Row Functions. 4 Displaying data from multiple tables

Your (printed!) Name: CS 1803 Exam 3. Grading TA / Section: Monday, Nov. 22th, 2010

MTAT Introduction to Databases

Database Systems CSE 414

The appendix contains information about the Classic Models database. Place your answers on the examination paper and any additional paper used.

Who, where, when. Database Management Systems (LIX022B05) Literature. Evaluation. Lab Sessions. About this course. After this course...

User Guide. Data Preparation R-1.1

Midterm Exam #2 (Version A) CS 122A Winter 2017

What s a database anyway?

Using MySQL on the Winthrop Linux Systems

August/September 2008

This lecture. Basic Syntax

Introduction to Database Systems CSE 344

CS / Cloud Computing. Recitation 7 October 7 th and 9 th, 2014

Chapter 9: Working With Data

Midterm Exam #2 (Version B) CS 122A Spring 2018

DATABASE MANAGEMENT SYSTEMS

Querying Microsoft SQL Server 2014

MIS2502: Review for Exam 2. Jing Gong

MTA Database Administrator Fundamentals Course

CS143: Relational Model

1

Advanced SQL Tribal Data Workshop Joe Nowinski

User Guide. Data Preparation R-1.0

Interlude. Object Oriented Design

MATTHEW COLLINS H

Unit 1 - Chapter 4,5

Instruction Create Table Sql Primary Key Clustered Asc

Vendor: Oracle. Exam Code: 1Z Exam Name: MySQL 5.0, 5.1 and 5.5 Certified Associate Exam. Version: Demo

Mobile MOUSe MTA DATABASE ADMINISTRATOR FUNDAMENTALS ONLINE COURSE OUTLINE

CS 200 Fall 2012 Assignment 8 SQL Due Monday November 10 by 4:00 pm

Advance Database Systems. Joining Concepts in Advanced SQL Lecture# 4

MySQL. A practical introduction to database design

FIT 100 More Microsoft Access and Relational Databases Creating Views with SQL

Relational model and basic SQL

Provider: MySQLAB Web page:

3/3/2008. Announcements. A Table with a View (continued) Fields (Attributes) and Primary Keys. Video. Keys Primary & Foreign Primary/Foreign Key

CS317 File and Database Systems

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

MySQL for Beginners Ed 3

Reference: W3School -

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

Getting Started with SQL

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

Midterm Exam #2 (Version B) CS 122A Spring 2018

Module 3 MySQL Database. Database Management System

CS 240 Fall 2015 Section 004. Alvin Chao, Professor

MySQL Workshop. Scott D. Anderson

20761 Querying Data with Transact SQL

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

Database Systems Fundamentals

Goals for Today. CS 133: Databases. Final Exam: Logistics. Why Use a DBMS? Brief overview of course. Course evaluations

Midterm Exam #2 (Version C) CS 122A Spring 2018

DSC 201: Data Analysis & Visualization

MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9)

CSCI-UA: Database Design & Web Implementation. Professor Evan Sandhaus Lecture #17: MySQL Gets Done

Draft. Students Table. FName LName StudentID College Year. Justin Ennen Science Senior. Dan Bass Management Junior

Chapter 8: Working With Databases & Tables

Introduction to Data Management CSE 344

Scheduling. Scheduling Tasks At Creation Time CHAPTER

Transcription:

CS/INFO 4154: Analytics-driven Game Design Class 20: SQL

Final Course Deadlines We will not meet during the scheduled exam time Final report will be due at the end of exam time Cornell cannot delete exam from Student Center Final (Kongregate) Report due: Saturday, December 9th, NOON Final Peer Evaluations due: Monday, December 11th, 11:59pm

Mon Wed Fri 10/11 MySQL 10/13 Beta Playtesting 1 10/16 Beta Playtesting 2 10/18 Beta Postmortems 10/19: Midterm Peer Evaluations Due

Beta Postmortems Similar to Alpha postmortems Report something learned from analytics perfectly fine if not very insightful e.g. players clicked 5436 times!

Today Basic MySQL How the tables are implemented on GDIAC Open office hours

Today Basic MySQL How the tables are implemented on GDIAC Open office hours

SQL Structured Query Language a programming language designed to manage data stored in relational databases

SHOW TABLES Shows tables within current database mysql> SHOW TABLES; +----------------------------+ player_action_log player_pageload_log player_quest_log users +----------------------------+ 4 rows in set (0.00 sec)

Sample table: actions player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8)

DESCRIBE Tells you the table schema Example: DESCRIBE actions; important +-----------+--------------+------+-----+---------+-------+ Field Type Null Key Default Extra +-----------+--------------+------+-----+---------+-------+ player_id int(11) YES NULL quest_id int(11) YES NULL level_id int(11) YES NULL time int(11) YES NULL detail varchar(255) YES NULL +-----------+--------------+------+-----+---------+-------+

SELECT The basic query SELECT <attributes> FROM <one or more tables>;

SELECT player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) SELECT player_id FROM actions; player_id 0 0 0 0 1 1

DISTINCT Filters results for unique values Can be used as a keyword: SELECT DISTINCT player_id FROM actions; Can also be used as a function: SELECT DISTINCT(player_id) FROM actions;

DISTINCT player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) SELECT DISTINCTplayer_id FROM actions; player_id 0 1

COUNT() Function that counts number of rows Usage: COUNT(<rows>) Example: SELECT COUNT(player_id) FROM actions;

COUNT() player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) SELECT COUNT(player_id) FROM actions; COUNT(player_id) 6

How do I? player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) How do I get the number of unique players? SELECT COUNT(DISTINCT(player_id)) FROM actions COUNT(DISTINCT(player_id)) 2

SELECT * SELECT * returns all rows Example: SELECT * FROM actions; player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8)

WHERE Specifies constraints Example: SELECT * FROM actions WHERE time>20;

WHERE player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) SELECT * FROM actions WHERE time>20 player_id quest_id action_id time detail 1 0 2 78 (2, 1) 1 1 2 80 (3, 8)

WHERE Specifies constraints Example: SELECT * FROM actions WHERE time>20; Can combine WHERE constraints with AND: SELECT * FROM actions WHERE time<15 AND player_id=0;

How do I? player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) Count # of actions with id=2? SELECT COUNT(*) FROM actions WHERE action_id=2;

How do I? player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) Count # of players who had an action with id=1? SELECT COUNT(DISTINCT(player_id)) FROM actions WHERE action_id=1;

How do I? player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) Count # of players who performed an action at (2,x)? Can t do this yet.

LIKE Specifies looser constraints: _ matches a single character % matches any number of characters Example: SELECT * FROM actions WHERE detail LIKE (2,_) ;

WHERE player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) SELECT * FROM actions WHERE detail LIKE (2,_) ; player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 1 0 2 78 (2, 1)

How do I? player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) Count # of players who performed an action in quest #1 at (x,8) SELECT COUNT(DISTINCT(player_id)) FROM actions WHERE quest_id=1 AND detail LIKE '(_,8)';

How do I actions players player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) player_id player_info 0 Windows 1 Linux Get all actions performed on Windows?

INNER JOIN Merges tables Example: SELECT * FROM actions INNER JOIN players ON players.player_id=actions.player_id;

actions player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) players player_id player_info 0 Windows 1 Linux SELECT * FROM actions INNER JOIN players ON players.player_id=actions.player_id; player_id quest_id action_id time detail player_id player_info 0 0 0 14 (2, 2) 0 Windows 0 0 1 16 (2, 4) 0 Windows 0 0 2 19 (1, 3) 0 Windows 0 1 2 20 (1, 1) 0 Windows 1 0 2 78 (2, 1) 1 Linux 1 1 2 80 (3, 8) 1 Linux

actions player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) players player_id player_info 0 Windows 1 Linux SELECT * FROM actions INNER JOIN players ON players.player_id=actions.player_id WHERE players.player_info= Windows ; player_id quest_id action_id time detail player_id player_info 0 0 0 14 (2, 2) 0 Windows 0 0 1 16 (2, 4) 0 Windows 0 0 2 19 (1, 3) 0 Windows 0 1 2 20 (1, 1) 0 Windows

actions player_id quest_id action_id time detail 0 0 0 14 (2, 2) 0 0 1 16 (2, 4) 0 0 2 19 (1, 3) 0 1 2 20 (1, 1) 1 0 2 78 (2, 1) 1 1 2 80 (3, 8) players player_id player_info 0 Windows 1 Linux Count the # of actions that happened on Linux at (2,x)? SELECT COUNT(*) FROM actions INNER JOIN players ON players.player_id=actions.player_id WHERE player_info='linux' AND detail LIKE '(2,_)'; Count the # of unique players that played on Windows and performed an action after time=15? SELECT COUNT(DISTINCT(players.player_id)) FROM actions INNER JOIN players ON players.player_id=actions.player_id WHERE player_info='windows' AND actions.time>15;

Today Basic MySQL How the tables are implemented on GDIAC Open office hours

Four tables Users Sessions users player_pageload_log Tasks Actions player_quest_log player_action_log

Users: users user_id user_info user ID (automatic) user details (if you provided them)

Sessions: player_pageload_log client_timestamp log_id user_id server_timestamp game_id version_id session_id when the client recorded the event overall ID; continually increments user ID (automatic) when the server recorded the event your game ID your version ID ID for this play session (automatic)

Tasks: player_quest_log log_quest_id quest_id log_quest_ts user_id game_id version_id dynamic_quest_id quest_detail session_seq_id session_id client_timestamp level_end_timestamp overall ID; continually increments ID for the task/level/quest when the server recorded the event user ID (automatic) your game ID your version ID unique ID for this specific quest instance quest details (if you provided them) which task in this session ID for this play session (automatic) when the client recorded the event when the client finished the task

Actions: player_action_log client_timestamp log_id game_id quest_id user_id action_id action_detail log_timestamp session_seq_id quest_seq_id when the client recorded the event overall ID; continually increments your game ID ID for this task/level/quest user ID (automatic) ID for this action action details (if you provided them) when the server recorded the event which action in this session which action in this task

Today Basic MySQL How the tables are implemented on GDIAC Open office hours