SQL : PostgreSQL

  Aggregate Functions Like most other relational database products,  PostgreSQL  supports  aggregate functions . An aggregate function computes a single result from multiple input rows. For example, there are aggregates to compute the  count ,  sum ,  avg  (average),  max  (maximum) and  min  (minimum) over a set of rows. As an example, we can find the highest low-temperature reading anywhere with: SELECT max(temp_lo) FROM weather; max ----- 46 (1 row) If we wanted to know what city (or cities) that reading occurred in, we might try: SELECT city FROM weather WHERE temp_lo = max(temp_lo); WRONG but this will not work since the aggregate  max  cannot be used in the  WHERE  clause. (This restriction exists because the  WHERE  clause determines which rows will be included in the aggregate calculation; so obviously it has to be evaluated before aggregate functions are computed.) However, as is o...

file structure and naming conventions

 



Learning Log: Review file structure and naming conventions

Overview

In the previous lesson, you were introduced to file structuring and naming conventions. Now, you’ll complete an entry in your learning log reviewing these concepts and reflecting on why they are so important. By the time you complete this entry, you will have a stronger understanding of how and why data analysts use file structuring and naming conventions on the job. This will help you think critically about file structuring and naming for your own projects in the future and keep your work more organized.

Review best practices

Before you begin thinking about what sort of naming conventions and patterns you would use in your own projects, take a moment to review the best practices for file structure and naming conventions. 

When creating a file structure and naming convention pattern for a project, you should always:

  • Work out your conventions early in your project. The earlier you start, the more organized you’ll be. 

  • Align file naming conventions with your team. Conventions are most useful when everyone follows them.

  • Make sure filenames are meaningful. Stick to a consistent pattern that contains the most useful information needed.

  • Keep file names short and to the point.

This includes understanding the expected structure of folders and files in a project. Where does your data live? Your spreadsheets? Your data visualizations? Being able to navigate your folders easily makes for a well-structured project. 

Remember, there are some stylistic choices you’ll need to make when it comes to filename conventions. However, there are still best practices you should follow here, too:

Formatting Convention

Example

Format Dates as yyyymmdd

SalesReport20201125

Lead revision numbers with 0

SalesReport20201125v02

Use hyphens, underscores, or capitalized letters

SalesReport_2020_11_25_v02


Comments

Popular posts from this blog

SQL : PostgreSQL

Using BigQuery / MySQL / other SQL

The R-versus-Python debate