This repository contains solutions to the SQL and scripting challenges. The tasks involve setting up database schemas, optimizing large datasets, and automating the installation and verification of Tableau Server on a Linux environment.
- Operating System: Ubuntu 22.04
- Database: PostgreSQL 16.3
The SQL scripts in the database/
directory define the schema for a weather data table. This table is designed to collect weather data on an hourly basis across different regions.
part1.sql
:- Creates the
weather_data
table with columns for locality, country, temperature, datetime, cloud coverage, UV index, atmospheric pressure, and wind speed. - Ensures data integrity with unique constraints and primary keys.
- Creates the
As the table grows, optimizations are necessary to maintain performance.
part2.sql
:- Adds composite indexes to optimize query performance.
- Implements partitioning strategies to manage large datasets efficiently.
- Discusses the potential for data compression and adjustment of
autovacuum
settings for older data.
To meet new requirements, the data is converted and aggregated differently.
part3.sql
:- Creates a new table to store temperature in Fahrenheit.
- Aggregates the data on a daily basis instead of hourly.
New requirements ask for calculating the temperature difference between records.
part4.sql
:- Implements functions and triggers to calculate the temperature delta between successive records.
- Updates both the hourly and daily tables to include this delta.
The tableau-server/
directory contains scripts to automate the installation and management of Tableau Server on a Linux environment.
install.sh
:- Updates the system and installs necessary dependencies.
- Downloads and installs Tableau Server.
- Initializes Tableau Server and verifies its successful startup.
For convenience, the repository also includes a script to uninstall Tableau Server.
uninstall.sh
:- Stops the Tableau Server services.
- Removes Tableau Server from the system.
To use the SQL scripts:
- Navigate to the
database/
directory. - Execute each SQL script in sequence (
part1.sql
,part2.sql
,part3.sql
,part4.sql
) using a PostgreSQL client.
To install Tableau Server:
- Ensure you are running Ubuntu 22.04.
- Navigate to the
tableau-server/
directory. - Run the installation script:
./install.sh