SQL Delete Cascade – SQL query to delete parent-child referenced rows

In this article, we will learn DELETE CASCADE rules in SQL Server with foreign key constraint having multiple examples.

OVERVIEW – SQL DELETE CASCADE

1.  DELETE CASCADE : In the SQL server, when we create a foreign key using the delete cascade option, it deletes all the related rows from the child table when the referenced row is deleted from the parent table having primary key constraint.

SQL-DELETE-CASCADE
SQL-Delete cascade rule

The following are the SQL scripts that create a parent (Departments), child (Employees) table, and a foreign key on the child table without the delete cascade rule.

Continue reading “SQL Delete Cascade – SQL query to delete parent-child referenced rows”

SQL Comparison Operators (Less than, Greater than, Equal, Not Equal operators)

 Introduction  : In this SQL Operators article, we will learn all about SQL Comparison operators in details with multiple examples.

SQL Server Comparison Operators

In SQL Server, the comparison operators are useful to compare one expression with another expression using mathematical operators.
Comparison operators return  true  or  false  based on the comparison.
The following are the list of different type of comparison operators available in SQL.

Consider X is the variable and the value assigned to X = 5 ;

OperatorDescriptionExample
<Less Than (<) OperatorX < 10 (returns true)
>Greater Than (>) OperatorX > 10 (returns false)
<=Less Than or Equal To (<=) OperatorX <= 10 (returns true)
>=Greater Than or Equal To (>=) OperatorX >=5 (returns true)
=Equal (=) OperatorX = 5 (returns true)
!=Not Equal (!=) OperatorX != 5 (returns false)
<>Not Equal (<>) OperatorX <>5 (return false)
SQL Comparison operators

The following are the examples of the above SQL comparison operators.

Continue reading “SQL Comparison Operators (Less than, Greater than, Equal, Not Equal operators)”

Inheritance in C# with examples.

In this article, we are going to talk about the use of Inheritance in C# with examples.

What is Inheritance?

Inheritance is a kind of relationship or association between two classes that allows one class to inherit code from the other class.
Inheritance means a parent-child relationship where we can create a new class by using the existing class code.

Inheritance is the  IS-A  type of relationship.
(Example: Apple is a fruit, Car is a Vehicle)

Parent Class In Inheritance, the class whose features are inherited is known as parent class(or a generalized class, superclass, or base class).
Child Class The class that inherits the existing class is known as child class(or a specialized class, derived class, extended class, or subclass).

Continue reading “Inheritance in C# with examples.”

Generics in C# .NET With Examples

Generic method in C#

In this article, we are going to talk about the use of Generics in C# with examples.

What is Generic in C#

 Generic  in C# was introduced in.NET Framework 2.0, it is basically enhancement of collection which makes our code type independent so that we can reuse our code with different data types.

For example, List in C# is a generic collection that can be used with the different data type, such as List<int>, List<float>, List<string>, or List<Employee>

Generics in C# belongs to  System.Collections.Generic  namespace which contains several generic-based collection classes. Continue reading “Generics in C# .NET With Examples”

Properties In C# with examples

In this article, we are going to talk about the use of properties in C# with examples.

What are the Properties in C#?

A Property in C# is an extension of a field that provides a public way for the classes to read, write, and expose the private fields while hiding the implementation details.

Properties in C# are actually a special kind of getter and setter methods wrapped around a private variable. A  get  property accessor is used to retrieve the value and the  set  accessor is used to assign the new value. In simple words, Property in C# is used to get and set the data from the private field in a class.

( get : Retrieve  set : Assign)                  

C# Properties
Properties in C#

Property Syntax in C#

Continue reading “Properties In C# with examples”