Interview Questions SQL Server - amitbhilagude/userfullinks GitHub Wiki
- Difference between SQL vs MySQL
- Both are relational databases.
- SQL is developed by Microsoft and MySQL is developed by Oracle.
- SQL is a licensed version and MySQL is open source
- SQL Supports C#, Java, PHP, etc., and MySQL was not supporting but in the recent update, there is also the support of C#
- Require more storage space in SQL
- SQL Server Agent
- When there is an agent then it is used to run a different job or scheduler in Azure or On-Prem.
- In Azure We are using Elastic Job Agent.
- Authentication Modes
- Windows authentication mode and mixed-mode on On-Prem.
- in Azure we have two options, Connectionstring and Service principal
- Local Temporary Table and Global Temporary Table
- Local Table gets deleted when the connection is closed. #table
- Global Table exists permanently and only rows get deleted. ##table
- Single User mode
- It will allow you to connect to only one user. Most common scenario if you want to change the scenario or restore data
- SQL Server Profiler
- It is used for troubleshooting and debugging the issue and analysis.
- It analyses the traces and give the performance of each query
- TCP/IP Port SQL Server runs
- 1433
- Subquery
- Having multiple queries outer query and subsequent queries. Subsequent queries are subqueries and will be run first.
- SQL Server Replication
- Merge, Transactional and Snapshot
- Transactional and Snapshot are most commonly used in Azure.
- Intend Lock
- It is a higher-level lock and it gives which lock is applied in the lock hierarchy.
- Three types: Shared lock, updated lock, and exclusive lock. They are used at the row level.
- Magic Tables
- It will automatically be created by SQL Server
- It keeps tracks of Insert and deletes records
- Temporal Tables
- Latest feature in SQL server 2016.
- Keep tracks of versioning of each record and get the recorded history.
- Triggers
- Execute SQL script if any event occurs e.g. Insert, Update, Delete, and Instead of
- Instead of will skip Insert, update or delete operation and perform the only trigger.
- Recursive Stored Procedure
- It is similar to recursive function and call the stored procedure again and again
- Trace Flag
- Substring and char index
- Substring will return String from StartIndex and EndIndex
- CharIndex will return the index of specific char
- Mirroring Server
- Mirroring server is a secondary server in Azure for failover.
- SQL Server curser
- Read each record one by one where the cursor is pointed.
- SQL Performance best practices
- How you design schema
- How you manage the connections
- How much data you retrieve
- How many round trips you do. Is your database chatty?
- How many concurrent connections are opened
- Memory and CPU or plan selected for your SQL server
- Stored Proc vs Function
- Function must return value. Store proc is optional
- You can use the function in the Select query. This was used in our data masking script.
- Joins in SQL
- Inner Join
- inLeft Jo
- Full Join
- Right Join
- Check Constraint in SQL
- Check is basically used to check the conditions in columns
- It is used in creating a table and adding a check will allow these values.
- Floor Function
- Round up the function
- Sp_locks
- List of locks currently held by the database.
- Sign Function
- Check if the number is negative, Positive
- Common performance issue in SQL Server
- Fragmentation
- Input or Output bottleneck
- Blocking
- Deadlock
- Missing Index