Showing posts with label sql. Show all posts
Showing posts with label sql. Show all posts

Monday, 28 August 2017

Visualising Australia's radio communication links

Mark Hansen suggested I create the Aussie version of his NZ wireless map, so I did 💁


Please interact with the map by clicking on icons and zooming in and out. Sydney Tower sure has a lot of radio links!

The full screen version is available here.


Instructions and code are available in my Github repository.

Tech used: PostgresSQL, Visual Studio Code, Google Fusion Tables

Tuesday, 30 May 2017

Comparing if two tables have identical content

Have you ever wanted to know if two database tables were the same? Perhaps you made some changes to a query and wanted to know if the result was still the same.

I was essentially looking for a way to diff two tables in Hive SQL, and used:
(TABLE a EXCEPT TABLE b)
UNION ALL
(TABLE b EXCEPT TABLE a);

Saturday, 14 January 2017

Importing CSV/TSV with Teradata SQL Assistant

  1. Set up Teradata to match the format of your text file
    1. To choose the delimiter:
      • Under Tools → Options, go to Export/Import and select one of the options in 'Use this delimiter between columns', e.g. tab, comma, or pipe
    2. To skip the first row, e.g. a header line:
      • Under Tools → Options, go to Import and select 'Ignore the first record in the import file (Skip Header)'
  2. Create the table in Teradata
    1. Run the command:
      • CREATE TABLE <TableName> (<column1> <datatype>, <column2> <datatype>, ...) PRIMARY INDEX (<column1>);
  3. Import the file
    1. Go to File → Import Data
    2. Run the command:
      • INSERT INTO <TableName> VALUES(?,?);
    3. where the number of ? matches the number of columns in your data file
    4. In the popup window, Open your file
    5. Unset Import mode by selecting File → Import Data
  4. Check that your table has loaded correctly
    1. Run the command:
      • SELECT * FROM <TableName>;