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.
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.
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 ;
Less Than (<) Operator
X < 10 (returns true)
Greater Than (>) Operator
X > 10 (returns false)
Less Than or Equal To (<=) Operator
X <= 10 (returns true)
Greater Than or Equal To (>=) Operator
X >=5 (returns true)
Equal (=) Operator
X = 5 (returns true)
Not Equal (!=) Operator
X != 5 (returns false)
Not Equal (<>) Operator
X <>5 (return false)
SQL Comparison operators
The following are the examples of the above SQL comparison operators.
In this article, we will discuss how to Create, Alter, and Drop a database in SQL Server. In my previous article, we have discussed all about the Types of SQL Commands.
Database : In the SQL server a database is a place to store the data in an electronic format. It is an organized collection of database objects such as tables, views, functions, stored procedures, triggers and so on. It allows a user to easily access or manipulate the data.
Create Database In SQL Server
In SQL Server, there are two ways to create a user-defined database, either by using the Transact-SQL statements or by using SQL Server Management Studio.