LEFT, RIGHT and SUBSTRING in SQL Server

In this tutorial, you’ll see how to apply LEFT, RIGHT and SUBSTRING in SQL Server. In particular, you’ll observe how to extract specific characters: 8 scenarios of LEFT, RIGHT and SUBSTRING in SQL Server For each of the scenarios to be reviewed, the ultimate goal is to extract only the digits within the strings. For … Read more

Case Statement using SQL

Here are 3 different ways to apply a case statement using SQL: (1) For a single condition: Copy CASE WHEN condition_1 THEN result_1 ELSE result_2 END AS new_field_name (2) For multiple conditions using AND: Copy CASE WHEN condition_1 AND condition_2 THEN result_1 ELSE result_2 END AS new_field_name (3) For multiple conditions and results: Copy CASE … Read more

How to Create a Table in SQL Server

In this tutorial, you’ll see the complete steps to create a table in SQL Server. An example is also reviewed for demonstration purposes. Steps to Create a Table in SQL Server Step 1: Create a database If you haven’t already done so, create a database where the table will be stored. For example, you may … Read more

How to Create or Drop a Database using SQL

To create a database using SQL: Copy CREATE DATABASE your_database_name; To drop a database using SQL: Copy DROP DATABASE your_database_name; Example of creating and dropping a database using SQL Let’s create a database called the “test_database” using this syntax: Copy CREATE DATABASE test_database; And if you want to drop that database, then use: Copy DROP … Read more

Export Query Output to Excel in SQL Developer

In this short guide, you’ll see how to export your query output to an Excel file in SQL Developer. The Steps Step 1: Run your query To start, you’ll need to run your query in SQL Developer. You can run any query based on your needs. Step 2: Open the Export Wizard Once you ran … Read more

Export Query Results to CSV in SQL Developer

In this short guide, you’ll see a quick way to export query results to CSV in SQL Developer. Steps to export query results to CSV in SQL Developer Step 1: Run your query Firstly, you’ll need to run your query in SQL Developer. You can choose any query based on your needs. Step 2: Open … Read more

Use Spool to Export Query Results to CSV

In this short guide, you’ll see how to use Spool to export your query results to a CSV file. You’ll also observe how to apply a quick tweak in order to export the query results to a text file. Use Spool to Export Query Results to a CSV File To start, here is a simple … Read more

Create Batch File to Export SQL Query Results to a Text File

In this tutorial, you’ll see how to create a batch file to export SQL query results to a text file. The Example Let’s say that you have a database, where: product_id product_name price 1 Computer 800 2 TV 1200 3 Printer 150 4 Desk 400 5 Chair 120 6 Tablet 300 The goal is to … Read more