SQL is a standard language for storing, manipulating and retrieving data in databases.SQL is a special-purpose programming language designed for managing data in a relational database, and is used by a huge number of apps and organizations.


A JOIN clause is used to combine rows from two or more tables, based on a related column between them.   Different types of join:   1. (INNER) JOIN Select records that have matching values in both tables. INNER JOIN is the same as JOIN.

SQL Case Expression

CASE is used to provide if-then-else type of logic to SQL. There are two formats, and both are used to return a result based on testing an expression.  The first is a Simple CASE expression, where we compare an expression to static values. It tests one expression against multiple values, this makes it great for transforming one

SQL Create View Statement

A view is the result set of a stored query on the data, which the database users can query. ·   Views can join and simplify multiple tables into a single virtual table. ·  Views can act as aggregated tables, where the database engine aggregates data (sum, average, etc.) and presents the calculated results as part of the data. · Views can

User Defined Functions(UDF) in SQL

User Defined Functions(UDF) SQL Server allows us to create our own functions called as user defined functions. A function is a stored program that you can pass parameters into and return a value. For example, if we want to perform some calculations then we can place them in separate function and store it in the database. Whenever we need the calculation,

Merge Statement in SQL

The MERGE statement is used to make changes in one table based on values matched from another. It can be used to combine insert, update, and delete operations into one statement.If you need to perform INSERT, UPDATE and DELETE operations on a TARGET table by matching the records from the SOURCE table Performs insert, update, or delete operations on

SQL Injection

A SQL Injection (SQLI) attack consists of insertion or “injection” of a SQL query via the input data from the client to the application. A successful SQL injection exploit can read sensitive data from the database, modify database data (Insert/Update/Delete), execute administration operations on the database (such as shutdown the DBMS), recover the content of a given file present on the DBMS file

Index in SQL

An index is used to speed up searching in the SQL Server database. An index can be used to efficiently find all row matching some column in your query and then walk through only that subset of the table to find exact matches similarly to the way a book’s index helps you find information quickly within that book. Indexes

Types of Database files

There are 3 types of database files:  1.   Data file It is a primary file and starting point of database. This stores all the data. It also points to other files in database. It has an extension .mdf   2.   Log file This stores all the transaction log information. All log information used to track and recover database. It

SQl Query Optimization

Consider a table with hundreds of columns and millions of records, if your application only really needs a few records, there’s no sense in querying for all the data. It’s a massive waste of resources.  Select all from Categories table: SELECT * FROM Categories  

Stored Procedure

A stored procedure is a group of SQL statements that has been created and stored in the database. A stored procedure will accept input parameters so that a single procedure can be used over the network by several clients using different input data. Stored procedures will reduce network traffic and increase the performance. If we modify a stored procedure