Dynamic SQL Queries in Snowflake Scripting

Dynamic SQL is one of the important features that many databases support. Dynamic SQL allows you to write SQL queries during runtime. With the help of dynamic SQL, you can build your SQL query on the fly and execute them. In the data warehouse, there may be a situation where you want to generate dynamic SQL queries based on your requirement. In this article, we will check how to use dynamic SQL queries in Snowflake scripting. Dynamic SQL Queries in Snowflake Scripting Dynamic SQL Queries in Snowflake Snowflake supports writing…

Comments Off on Dynamic SQL Queries in Snowflake Scripting

Working with Snowflake Scripting Stored Procedures

Writing stored procedure is one of the import method to encapsulate your business logic using procedural language. Snowflake does support writing a stored procedure using JavaScript and recently they started supporting SQL scripting much similar to Oracle PLSQL. In this article, we will check how to write Snowflake scripting stored procedures. We will also look into some examples. Snowflake Scripting Stored Procedures In general, Stored procedure combines the complex SQL business logic with procedural statements such as IF-ESLE, LOOP, etc. Snowflake Stored Procedures Overview Snowflake stored procedures are used to encapsulate…

Comments Off on Working with Snowflake Scripting Stored Procedures

How to Export Snowflake Table to S3 bucket using DBT?

As cloud data warehouses are gaining popularity, new tools are emerging to interact with them. One of such tool is a Data Built Tool (DBT). DBT is a data transformation tool that focuses on the Transformation part in ELT (Extract, Load, Transform) processes. It supports data warehouses such as Snowflake, Redshift, BigQuery, Databricks, etc. In this article, we will check how to export your Snowflake table to S3 bucket using dbt. What is DBT and How it Works? Before jumping into the approach on exporting Snowflake table to AWS S3…

Comments Off on How to Export Snowflake Table to S3 bucket using DBT?

How to use Redshift NOT NULL Constraint? Its Syntax

In my other Redshift related article, we have discussed how to define a primary key, Unique key and Foreign key constraint in Amazon Redshift. In this article, we will check how to use Redshift NOT NULL constraint with its syntax and examples. Redshift NOT NULL Constraint Similar to most of the MPP databases such as Snowflake, the Amazon Redshift database allows you to define constraints. The Redshift database does not enforce constraints like primary key, foreign key and unique key. But, it does enforce the NOT NULL constraint. Constraints other…

Comments Off on How to use Redshift NOT NULL Constraint? Its Syntax

How to use Redshift Foreign key Constraint? Its Syntax

In my other Redshift related article, we have discussed how to define a primary key NOT NULL and Unique key constraints in AWS Redshift. In this article, we will check how to use Redshift FOREIGN KEY constraint with its syntax and examples. Redshift Foreign Key Constraint Amazon AWS Redshift is an analytical columnar cloud database. It is mainly used for analyzing your data to create a key KPI to make critical business decisions. The Redshift cloud database is based on PostgreSQL 8.x and many transactional database features such as table…

Comments Off on How to use Redshift Foreign key Constraint? Its Syntax

How to use Redshift Unique Key Constraint? Its Syntax

In my other Redshift related article, we have discussed how to define a primary key, foreign key and NOT NULL constraint. In this article, we will check how to use Redshift UNIQUE KEY constraint with its syntax. Redshift Unique Key Constraint Amazon AWS Redshift is an analytical columnar database. Many transactional database features are not supported on Redshift. You can define a unique key, but Unique key is informational only; They are not enforced by Amazon Redshift. The Amazon data warehouse appliance supports referential integrity constraints such as Redshift primary…

Comments Off on How to use Redshift Unique Key Constraint? Its Syntax

How to use Redshift Primary key Constraint? Its Syntax

Amazon Redshift is one of the earliest cloud data warehouses. It is based on the PostgreSQL. There are many features that are common in Redshift and PostgreSQL. Amazon Redshift provides many features to the user who wants to migrate to AWS Redshift. One of such features is primary key constraints. Basically, Redshift supports the referential integrity constraint such as primary key, foreign key, not null and unique key. You can create a primary key during table creation, that is, table DDL or you can use alter table command to add…

Comments Off on How to use Redshift Primary key Constraint? Its Syntax

Redshift WHERE Clause Multiple Columns Support

The relational databases such as Teradata and Oracle supports the multiple columns in WHERE clause. It is one of the main requirements when you are migrating from legacy databases such as Teradata to Amazon Redshift. In this article, we will check Redshift WHERE clause multiple columns support. What is a WHERE Clause? The WHERE clause contains conditions that either apply predicates to columns in tables or join multiple tables. Almost all modern databases allow you to join tables in WHERE clause. The WHERE clause specifies a condition that matches a subset of…

Comments Off on Redshift WHERE Clause Multiple Columns Support

How to Use Translate Function in Snowflake?

The Snowflake TRANSLATE function returns a string with all occurrences of each character in a string replaced by its corresponding character in the replacement string. For example, you can use Snowflake translate function to replace '#' with a '@' symbol and remove '$' from input string in one operation. The translate is one of the commonly used Snowflake string functions. In this article, we will check how to use the Translate function in the Snowflake cloud database. Snowflake Translate Function Example Translate Function in Snowflake As discussed in the previous example,…

Comments Off on How to Use Translate Function in Snowflake?

Replace Function in Snowflake – Usage and Examples

The Replace function in Snowflake is one of the commonly used functions in string manipulations. For example, you can use the replace function to remove the unwanted or junk characters from your string. This function is similar to the translate function available in Snowflake. We will discuss about translate function in another post. For now, let us continue with the replace function, its syntax and some examples. Replace Function in Snowflake Replace Function in Snowflake In general, replace function in SQL replaces each instance of a pattern in the input…

Comments Off on Replace Function in Snowflake – Usage and Examples