SQL

sql-rename

SQL Table Renaming: A Guide

Introductiuon In SQL, Creating and inserting data is important but maintaining databases are also important. Sometimes user are not happy with the current name of the table and wants to rename them according to needs. CAUTION : Before committing to any change, user should double check that renaming the table will not make or break …

SQL Table Renaming: A Guide Read More »

sql-unpivot

SQL: Unpivoting Data for Analysis

Introduction In SQL , learning unpivoting of data is as important as learning pivoting of data.Sometimes we need to transform data from column to rows for efficient analysis. The UNPIVOT function is useful when you have data in a pivoted format, with values spread across multiple columns, and you want to convert it back into …

SQL: Unpivoting Data for Analysis Read More »

sql-pivot

SQL Pivot – Rows To Columns

In SQL Server, You can use PIVOT to convert rows into columns. Syntax: <non-pivoted column> are columns which are not intended for pivot[pivoted column1], [pivoted column2] are columns which we want to pivotThe Select statement in FROM clause is for source table<aggregate_function> is useful when we have two or more rows with similar primary key …

SQL Pivot – Rows To Columns Read More »

sql-floor-ceiling

SQL FLOOR AND CEILING FUNCTIONS

FLOOR() Function: SQL FLOOR is used to return the largest integer less than or equal to the specified numeric expression. Syntax: EXAMPLE: The result is the numeric part with the same data type. CEILING() Function: SQL CIELING() is used to get the smallest integer greater than, or equal to, the specified numeric expression as return …

SQL FLOOR AND CEILING FUNCTIONS Read More »

SQL LIKE Operator in Queries

SQL LIKE SQL LIKE operators are used in conjunction with WHERE clause to find patterns in the strings. Two wild card characters are used with LIKE operators-‘%’ is used to represent  zero, one, or multiple character‘_’ is used when you want to represent only one character Syntax: WHERE Clause in above statement will match with …

SQL LIKE Operator in Queries Read More »

sql-date-functions

SQL Date Functions – Important

SQL date functions are important to learn if you want to do anything related to-Forecasting.Managing historical data.There are several types of SQL Date functions but we are going to learn basics first. The Three SQL functions we are going to learn in this lesson are – DATEPART() This function returns an integer representing the specified datepart of …

SQL Date Functions – Important Read More »

sql_case

SQL Case Expression-SQL Conditions

SQL case are used to evaluate a set of expression and return the expression that fulfils the condition. There are two types of SQL CASE – The simple CASE expression compares an expression to a set of simple expressions to determine the result. The searched CASE expression evaluates a set of Boolean expressions to determine …

SQL Case Expression-SQL Conditions Read More »