Redshift Conditional Statements – IF, LOOP, WHILE, FOR, CONTINUE and EXIT

The Redshift SQL conditional statements are a useful and important part of the plpgsql language. You can use Redshift control structures to perform some critical decisions based on data and manipulate SQL data in a flexible and powerful way. In Redshift, you can use conditional statements to control the flow of execution of a SQL script based on conditions. You can use these Redshift conditional statements for data manipulation in your complex SQL queries. Redshift Conditional Statements The Redshift conditional control flow statements are categorized into two parts: Conditional control…

Comments Off on Redshift Conditional Statements – IF, LOOP, WHILE, FOR, CONTINUE and EXIT

Redshift Stored Procedure Return Result Set – Working Example

Redshift stored procedures are used to encapsulate business logic such as transformation, data validation, etc. You can also use the stored procedure to return the result set in your applications. Typically, stored procedure returns a unique value, it can also return result set in the form of cursor or temporary tables. In this article, we will check Redshift Stored Procedure Return Result set with an example. Redshift Stored Procedure Return Result Set Return records from the Redshift stored procedure is bit different compared to other postgreSQL databases such as Netezza.…

Comments Off on Redshift Stored Procedure Return Result Set – Working Example

How to Create and Use Redshift Cursor Variable? – Examples

Just like many other SQL procedural languages, the latest version of Redshift plpgsql supports cursor type variables. You can use a cursor to retrieve a few rows at a time from the result set of a larger query. You can use the cursor type inside Redshift stored procedures (SP). They are used in selections and FOR loops to hold one row from a SELECT operation. In this article, we will check how to create and use Redshift cursor variable inside your stored procedure. Redshift Cursor Variable As mentioned earlier, Redshift…

Comments Off on How to Create and Use Redshift Cursor Variable? – Examples

Redshift Dynamic SQL Queries and Examples

When you are working on the various data sources and different kind of SQL queries, there may be situations where you want to generate dynamic SQL queries dynamically based on your requirement. In Redshift you can PREPARE SQL statement and EXECUTE it. Redshift also support use of EXECUTE command in Redshift stored procedures. In this article, we will check Redshift Dynamic SQL Queries, how to PREPARE them and run using EXECUTE statements. The dynamic SQL in Redshift can be useful in many scenarios, such as when you need to execute…

Comments Off on Redshift Dynamic SQL Queries and Examples

Redshift Connection Issues – Causes and Resolution

Redshift is a petabyte data warehouse provided by AWS cloud. If you have created Redshift cluster by default it will be publicly accessible. Amazon has taken a lot of measure to secure Redshift cluster from unforeseen events such as unauthorized access from the network. In this article, we will discuss common Redshift connection issues, causes and resolution. Redshift Connection Issues Accessing redshift from EC2 instance is easy as you don't have to take any security measures as EC2 instance is also created in the AWS cloud. But if you are…

Comments Off on Redshift Connection Issues – Causes and Resolution

Working with Amazon Redshift Stored Procedure

Amazon Redshift supports stored procedures written in PL/pgSQL, a dialect of the PostgreSQL database language. Stored procedures in Redshift are used to encapsulate logic on the database side and can be executed by multiple client applications, improving code reusability and reducing the amount of duplicated code in your applications. In this article, we will check how to create a stored procedure in Redshift using simple examples. Amazon Redshift Stored Procedure Overview Amazon Redshift stored procedures are used to encapsulate the data migration, data validation and business specific logic's and same time…

Comments Off on Working with Amazon Redshift Stored Procedure

Amazon Redshift Features – Benefits and uses

Amazon Reshift is one of its kind cloud data warehouse appliance on the AWS cloud. It is lightning-fast, Massively parallel processing (MPP), scalable data warehouse and data processing solutions without a massive investment in infrastructure. Redshift provides access to other tools like storage service S3, data lake, machine learning modules, etc. Amazon Redshift is a lot different compared to other MPP data warehouse appliances like Netezza, Greenplum, etc. In this article, we will check Amazon Redshift features, benefits and its uses. Amazon Redshift Features Redshift is a great Platform as…

Comments Off on Amazon Redshift Features – Benefits and uses

How to Export Spark-SQL Results to CSV?

Data plays important role in today's decision making process. Be it online bookstore, e-commerce website or online food delivery applications use user data to provide better customer service. These are many organizations that share data to decision making systems. These companies provide data in the form of flat files or direct access to the source system. Many companies use Spark as an execution engine. In this article, we will check how to export Spark-SQL results to CSV flat file. The created flat files or CSV files then be transported using…

Comments Off on How to Export Spark-SQL Results to CSV?

Amazon Released PartiQL – An Open Source SQL Compatible Query language

Today, most of the business critical decisions are driven by data. As data grows, it is typically spread across a combination of relational databases, non-relational data stores, and data lakes. As per Harvard business review, on average, less than half of structured data is being used to make business critical decision. Structured data could be a data from relational databases. They do no have facilities to consider other data sources such as the local file system or NoSQL database data or data lakes. In this article, we will check newly…

Comments Off on Amazon Released PartiQL – An Open Source SQL Compatible Query language

How to use Impala Replace Function and Examples

The latest version of the Cloudera supports Impala replace function. String manipulation function replace is very much needed in case if you are manipulating strings and when there is a need to replace the particular value. Value could be a junk value or any other values based on your requirements. In this article, we will check Impala replace function and alternative methods that you can use whenever required. Impala Replace Function As mentioned earlier, the latest version of Cloudera impala does provide support for replace function. The syntax and usage…

Comments Off on How to use Impala Replace Function and Examples