Couple things that catched my eyes. 1) Primary Key always creates a clustered index - no, only if CI dosen't exist, if it does nonclustered unique is created. 2) clustered is faster than nonclustered - it depends on what we're doing. If we searching only for indexed columns or non indexed are included into nonclustered index - they will be performing the same or nonclustered will be faster... Overhead is only when nonclustered index needs take rest of the data from a heap or clustered index... 3) Cross join is also part of sql server logical joins (in documentation at least). Logical joins are a wage topic. Some people will also include any operation that is based on physical joins so semi joins, set operations (union, intersect, except, concatenation as union all), aggregates are also included. 4) Self Joins... Oracle people talk a lot about it... I've never heard this phrase in a sql server community... 5) Drop table could be also rolled back in sql server. Answer to this question: Dml VS ddl. Operation on data itself vs definition of the data. Dml are fully logged, ddl minimal... 6) Nth salary... Order by clause is not allowed in derived tables (subqueries). What if more than one person has the same salary? Use dense_rank 7) Consistency stands for capability of rdbms to be consistent apart from transaction result. So if transaction passes - save the data, if not or was hanged - roll itself back to the former state... It is quite obvious when everything's fine but it's really crucial after server crush... After reboot consistency of every db is checked... It has 3 phases - Analysis (what needs to be committed, what needs to be rolled back) Redo - store committed but not saved transactions. Undo - rollback uncomited transactions that were saved (it's called "dirty pages) - it happens when server operates under memory pressure - data are stored despite they're not committed... 7) Improving performance: 1) look at obvious issues with your query/procedure. Do some stuff. It if helped - you're good to go, if not 2) look at estimated execution plan - apply some indexes etc. 3) look at real execution plan - check if your sp is not victim of parameters sniffing etc. 8) memory consumption isn't so important with cursors... Thier iterative nature is... They're terribly slow compered to set/batch operations. That's why never use cursors unless you need to.
Great video. Thanks for sharing! There is a minor correction in the video on Delete vs Truncate. While the Delete can be rolled back Truncate can't be rolled back. The video incorrectly mentions that both can be rolled back.
What to do if the auto-increment value reaches its limit?. Considering that it's a banking application I don't want to delete the older data how are you going to resolve the issue?
At 42.07 you said that we can't use SELECT, INSERT, UPDATE, DELETE with SP and can use with Function. That's wrong. Only SELECT statement can be use with Function.
In 90% cases we can replaced cursor with loops and that is recommended because cursor is performance heavy. I just wanted to explain cursor, that's why :)
When you create your application database tables from scratch, then you have to follow some rules - 1NF, 2NF, 3NF, BCNF... If you will not follow these rule, then later when data is filled in those tables.. you will face difficulty in managing that data.
Couple things that catched my eyes. 1) Primary Key always creates a clustered index - no, only if CI dosen't exist, if it does nonclustered unique is created.
2) clustered is faster than nonclustered - it depends on what we're doing. If we searching only for indexed columns or non indexed are included into nonclustered index - they will be performing the same or nonclustered will be faster... Overhead is only when nonclustered index needs take rest of the data from a heap or clustered index...
3) Cross join is also part of sql server logical joins (in documentation at least). Logical joins are a wage topic. Some people will also include any operation that is based on physical joins so semi joins, set operations (union, intersect, except, concatenation as union all), aggregates are also included.
4) Self Joins... Oracle people talk a lot about it... I've never heard this phrase in a sql server community...
5) Drop table could be also rolled back in sql server. Answer to this question: Dml VS ddl. Operation on data itself vs definition of the data. Dml are fully logged, ddl minimal...
6) Nth salary... Order by clause is not allowed in derived tables (subqueries). What if more than one person has the same salary? Use dense_rank
7) Consistency stands for capability of rdbms to be consistent apart from transaction result. So if transaction passes - save the data, if not or was hanged - roll itself back to the former state... It is quite obvious when everything's fine but it's really crucial after server crush... After reboot consistency of every db is checked... It has 3 phases - Analysis (what needs to be committed, what needs to be rolled back) Redo - store committed but not saved transactions. Undo - rollback uncomited transactions that were saved (it's called "dirty pages) - it happens when server operates under memory pressure - data are stored despite they're not committed...
7) Improving performance: 1) look at obvious issues with your query/procedure. Do some stuff. It if helped - you're good to go, if not 2) look at estimated execution plan - apply some indexes etc. 3) look at real execution plan - check if your sp is not victim of parameters sniffing etc.
8) memory consumption isn't so important with cursors... Thier iterative nature is... They're terribly slow compered to set/batch operations. That's why never use cursors unless you need to.
Great Explanation!
I gave an interview just a few days back and all the questions were explained here except for one or two.
Thank you!
Thanks Aditi
What position ?
This is a great video for interview purpose. Thanks a lot!
wc Pallavi.. and thanks for your comment
Though i am familiar with SQL server quite few years, still lot of points to learn with your video, really nice content. thanks.!
Great to hear! Thanks @Arm_luckyno23
Great video. Thanks for sharing! There is a minor correction in the video on Delete vs Truncate. While the Delete can be rolled back Truncate can't be rolled back. The video incorrectly mentions that both can be rolled back.
Thanks Nallavan for sharing.
Check in MS SQL server it can be rollback
Very information and useful for my SQL interviews. Thanks Happy.
That is my objective Kesavan, all the best for your interviews.
@@interviewhappy
Need interviewer like you who knows logic is magic. some interviewer patterns makes us to loose confidence who expect bookish answers
❤❤
Seriously..you have explained very nicely, it's very useful 😊 thank you !
Your Welcome . Glad you liked it Vidhyadhar.
Thanks sir..coming Saturday I have interview ..I am watching your videos and preparing . I can easily understand your explanation
Thanks Jamuna, best of luck, if you know any answer try to elaborate it as much as possible.
@@interviewhappy how to reach u brother 🙂
@@veerabhadrarao258 whatever queries you have regarding interviews - careers.. just post it here and we can discuss.
@@interviewhappy i need personal support frm you
@@veerabhadrarao258 this is my email id anuragrawat123@gmail.com. We can discuss on email.
I think unique key cols can have multiple null values?
Hello you said Truncate can be rollback, but actually Truncate cannot be rollback. By the way excellent video and appreciate your efforts
Truncate can be rolled back. You might be referring DROP command
Check in SQL server it can be rollback
Truncation can rolled back if used inside a transaction
Most of the places it's showing truncate can't be rollback.
Thank you a lot for the effort to make this valuable video. Keep it up.
wc and Thanks Rasika. Wish you all the best for your career.
Hi Sir, Thank you so much for these wonderful videos.
Could you please make a video on How To Return A Value From A Stored Procedure in Sql Server.
Hi Jyothi, use out parameters is the answer.
great knowledge for interview . ❤❤
Thanks Fahim. Wish you all the best for your career.
What to do if the auto-increment value reaches its limit?. Considering that it's a banking application I don't want to delete the older data how are you going to resolve the issue?
Now a days GUID are used for ID's. That will never let that problem happen.
But , If we can Insert or update the data of View also be updated to the original table, then what's the benefit pf View..?
Can you please do Video for Azure.. Your videos are really useful for us.. Thank you for your effort
Sure Rathika, soon I will
Sir can you do normalisation video with practical examples ? Thank you
I will try soon
Again very nice collection and well explained.. 😇😇
Thanks a lot 😊 Satinder
Can you please create a video about C# design pattern interview questions
Yes vignesh soon will update . Stay connected
Your book has kindle addition only . I want paperback book of interview questions. Please tell me how can i get the book.
Sorry Sonal, the paperback is not available right now. May be in future. All the best for your career.
super bro
Thanks bro. All the best for your career.
we use insert update delete in the sp and cannot in the function this point is wrong broh in your video
you are right
At 42.07 you said that we can't use SELECT, INSERT, UPDATE, DELETE with SP and can use with Function. That's wrong. Only SELECT statement can be use with Function.
Awesome video sir
Thanks
Thank you so much
Thank you so much sir
Welcome Amruta. All the best.
Hi,Mr.: All are perfect, however, Q24for '"Truncate rollback " seems like "not rollback"
Thanks Kevin, I will cross check that question.
Can you do video on .Net core please. nice videos
Thanks Bhargavi. I already created videos on .NET Core also. You can check in my channel.
TRUNCATE reset the auto increment IDs but DELETE not
Good point Chaturanga
There was one question why we are using cursor instead of a while loop?
In 90% cases we can replaced cursor with loops and that is recommended because cursor is performance heavy. I just wanted to explain cursor, that's why :)
@@interviewhappy I was asked this question in the interview? Why cursor when we can use while loop. What should be the answer for this question ?
Thank you so much sir
Most welcome
Difference between table variable and cte
Thank you 😊
You're welcome 😊
SIr please make video on user defined function and its types
Sure I will try to cover that in future.
Logic is tha Magic
Yup
please make video on azure interview
Sure will try to do it soon@gkmishra2009
thanks sir
wc King
very helpful vidoe
Glad you think so!
What is Normalization in SQL?
When you create your application database tables from scratch, then you have to follow some rules - 1NF, 2NF, 3NF, BCNF...
If you will not follow these rule, then later when data is filled in those tables.. you will face difficulty in managing that data.
Shared one email regarding interview questions I faced last week sir. Please give reply.
Oh, that's you, I already replied. Thanks for your email.
@@interviewhappy thank you sir 🙏
Sir practical kar k dikha dete to or bhi achha hota
Noted Pooja.. next time
Thank you sir
Sir normalization ka ek video bana dijiye interview me bahut baar puchh chhuke hai
@@poojaswain4722 sure this is related with the design of tables in database. Right now I am creating something in Angular but will cover this soon.
Okk sir
♥️👍