Posts

Showing posts from September, 2020

IN, ALL, ANY operators in SQL

Image
Hello, and welcome to the blog. In this blog we are going to talk about some operators in SQL which help us when we are are adding WHERE clause with large data. This is going to be a good practice when we are going to learn about " SUBQUERIES ". This is going to be a very small but very useful blog. So, In this blog we are going to talk about IN Operator BETWEEN Operator ALL Operator ANY Operator Currently our Employee1 table look like this: So, let's get started, 1) IN Operator The IN operator allows you to specify multiple values in a WHERE clause. The IN operator is shorthand for multiple "OR" conditions. let's jump to the syntax: SELECT column_name FROM table WHERE coulmn_name IN (value_1,value_2,...,value_n) You can always replace va...

SQL Joins | Inner Join | Left Join | Right Join | Full Join | Self Join

Image
Hello, and welcome to the blog. In this blog we are going to talk about " Joins ". In the  previous blog  we have seen most important topic of Primary Key, Foreign Key and now its time to join some of the tables. So, In this blog we are going to talk about What is join and its purpose Type Of Joins Inner Join Left Join Right Join Full Join Self Join Let's  start with 1) What is join and its purpose There is a clause in SQL called Join. And its purpose is to combine rows from two or more tables which are connected with each other by a common column. When I say connected with each other by a common column I am talking about Foreign Key which we have covered in previous blog. Although if you haven't enforced foreign key for this blog but we do have a common column then also you can perform jo...

Identity Column, Primary Key and Foreign Key

Image
Hello, and welcome to the blog. In this blog we are going to talk about " Identity columns, Primary Key and Foreign Key ". In the  previous blog  we have seen some constraints and I told you there are more coming and here they are now. These constraints hold way too much powers as compare to what we have learnt in previous blog. Believe me if you these have arrows in your quiver, it is very easy for you to conquer the practices of designing a fully functional database. So let's not create more hype about this and start exploring theses things. In this blog we are going to talk about Identity Column Primary Key Foreign Key Let's start the discussion with 1) Identity Column: When you want to create a column whose value should get incremented every time you insert a new record then IDENTITY COLUMN is the thing you shou...

Alter command with constraints

Image
Hello, and welcome to the blog. In this blog we are going to talk about " Alter command with constraints ". In the previous blog we have seen how to create a table with constraint. If you are following the blog we already have a table "Employee", what if we have to apply constraints to that table. Don't worry "ALTER" command is there to help us. So, In this blog we are going to talk about Adding Constraints Adding null/ not null constraint Adding UNIQUE constraint Adding CHECK constraint Adding Default constraint Adding Index Knowing Constraints Renaming Constraints Removing Constraints Let's begin with, 1) Adding Constraints When we initially started, we created a simple table without any constraints here. So we are going to add constraint in that ta...