SQL Advance Tutorial
SQL Triggers
SQL Server triggers are special kind of Stored Procedures that invokes whenever a special event in the database occurs.
SQL Server uses two virtual tables INSERTED and DELETED, whenever a trigger is called . These table is used to capture the data of the modified row before and after the event occurs tables , these tables are called as magic tables or virtual tables.
![]()
SQL DML AFTER TRIGGER
After Trigger (using FOR/AFTER CLAUSE)
This type of trigger fires after SQL Server finishes the execution of the action successfully that fired it.
![]()
SQL STUFF
SQL STUFF() function is used to delete a sequence of given length of characters from a string and inserting the given sequence of characters from the specified starting index.
Syntax
STUFF(String, Start, Length, Newstring)
String – It is the string to be modified.
Start – The starting index from where the given length of characters will be deleted and new sequence of characters will be inserted.
Length -The number of characters to delete from string
![]()
SQL TRANSLATE()
The SQL TRANSLATE() is a string function that is used to replaces a sequence of characters in a string with another sequence of characters.
The function replaces a single character at a time. Until SQL Server 2016, we used use REPLACE() function to replace each character.
![]()
SQL SPACE
SQL SPACE() is a string function that replicates the number blanks that we want add to the given string.
Syntax
SPACE(number)
![]()
CREATE DATABASE
Database in SQL Server is a collection of tables that stores a specific set of structured data. You can eaisly interact with data such as you can Select, Update and Delete the data in tables.
![]()
How to check if User table or Temp table exists in database?
How to check if User table or Temp table exists in database?
![]()
SQL DATENAME()
The DATENAME() function returns a string, navarchar type, that represents a specified date part of date ,it can be a day , month ,year or time of specific date.
![]()
SQL DATEFROMPARTS
SQL DATEFROMPARTS() function is a date function that returns a date value that maps to a year, month, and day values.
![]()
SQL CASE STATEMENT
The CASE statement has the functionality of an IF-THEN-ELSE . It goes through conditions and returns a value when the first condition is met . So, once a condition is true, it will stop reading and return the result.
![]()
Schedule a Job in SQL
The SQL Server Agent job is the specified action or series of actions that the SQL Server Agent will execute at any specific date time.
![]()
SQL LIKE CLAUSE
The SQL LIKE clause is used to match a value to a similar values using wildcard operators. It is used with Where Clause.
There are two type of wildcards used in conjunction with the LIKE operator.
The percent sign (%) that is used to represent zero , one, or multiple characters.
The underscore (_) that is used to represent a single number or character.
![]()
USER DEFINED FUNCTIONS
SQL Server allows us to create our functions called as user defined functions in SQL Server.
![]()
How to display Cumulative total in SQL ?
A Cumulative total or running total refers to the sum of values in all cells of a column that precedes the next cell in that particular column
![]()
What is Correlated Subquery in SQL?
A correlated subquery is a subquery that uses the values of the outer query and it is evaluated for each row processed by the outer query
A correlated subquery always depends on outer query for its value. Because of this dependency, a correlated subquery cannot be executed independently as a simple subquery .
![]()
What is SubQuery in SQL ?
A Subquery is a query within another query. The outer query is called as main query and inner query is called as sub query.
![]()



















