Download presentation
Presentation is loading. Please wait.
1
The Watson Game Database Group Members: Joshua Shapiro - Team leader Dan Dauchy - MySQL table creation scripts Andy Modansky - MySQL data transfer script Aaron Perlstein - MySQL data maintenance (PHP) Josh Spindel - Challenge data/database statistics (PHP)
2
Josh Shapiro: Why use a database? n Easy to implement n Easy to extend n Efficient n Easily interfaced with by a wide variety of languages/architectures
3
Why MySQL and not Access? n Access is tied to the Windows platform n Response times n Scalability
4
SQL Table Creation: Dan Dauchy n CREATE TABLE `challenge` ( `ChallengeID` bigint(20) NOT NULL auto_increment, `CourseID` bigint(20) default '0', `ChallengeDifficulty` varchar(50) default NULL, `ChallengeQuestion` text, `ChallengeAnswer` varchar(50) default NULL, KEY `challenge_ID` (`ChallengeID`), CONSTRAINT `FK_wag_Course_Challenge` FOREIGN KEY (`CourseID`) REFERENCES `course` (`CourseID`) n This creates a table with its corresponding fields n NOTE: always create tables with foreign keys last (always after the tables that they reference)
5
SQL Insertion Example INSERT INTO `challenge` (ChallengeID, CourseID, ChallengeDifficulty, ChallengeQuestion, ChallengeAnswer (1, 2, '1', ‘bla bla?', ‘correct‘); Inserts values into corresponding fields of the challenge table
6
Script overview: Andrew Modansky n Export database structure from Microsoft Access in SQL n Use the exported data as input into the script n “Relationships” -> Foreign Keys n Tables without foreign keys must be created first
7
n Java - robust database interfacing through the JDBC library import java.sql.*; Connection conn; Class.forName("org.gjt.mm.mysql.Driver"); conn = DriverManager.getConnection(url, username, password); Statement st = conn.createStatement(); st.executeUpdate(SOME_SQL_STATEMENT); JDBC Example
8
Data maintenance: Aaron Perlstein n MySQL shortcoming: no GUI n But PHP makes it easy! PHP - (Hypertext Preprocessor) Object oriented programming language particularly suited towards web application development. Runs by means of an interpreter that is either called at compile time or integrated into the web server binary.
9
Example PHP code: Connecting to a database n $connect = mysql_connect ("localhost", $username, $password) or die("Connection Failure to Database"); mysql_select_db ($database, $connect) or die ("Database not found."); $result = mysql_db_query ($database, $query) or die("Failed Query"); n Concise, easy to read code n Makes interfacing with databases a pleasure
10
What the administration module does n Acts as Access replacement n Add/Delete/Modify for existing tables n Integrated with in-game statistics module, which is also written in PHP and the responsibility of...
11
Web statistics: Joshua Spindel n Relevant game statistics will be displayed from database n Live statistics also available n Searchable
12
Data collection n Game expansion n Electrical Engineering n Mechanical engineering n Data goes in both Faculty and Challenge tables
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.