Skip to main content

Posts

Showing posts with the label MySQL for Analytics and Business Intelligence

MySQL for Analytics and Business Intelligence Part 1: Script to generate schema and tables

Please execute the following script to create database and related tables in mysql.  SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @@sql_mode='no_engine_substitution'; SET global time_zone = '-5:00';  SET SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';    DROP SCHEMA IF EXISTS mavenfuzzyfactory; -- this will cause an errror if DB doesn't exist. Dont worry CREATE SCHEMA mavenfuzzyfactory; USE mavenfuzzyfactory; -- -- Creating an empty shell for the table 'website_sessions'. We will populate it later.  -- CREATE TABLE website_sessions (   website_session_id BIGINT,   created_at TIMESTAMP,   user_id BIGINT,   is_repeat_session SMALLINT,    utm_source VARCHAR(12),    utm_campaign VARCHAR(20),   utm_content VARCHAR(15),    device_type VARCHAR(15),    http_referer VARCHAR(30),   PRIMARY KEY (website_session_id), ...