Sql-Interview

SQL Interview: 31 Create a copy of an Azure SQL Database on the same logical server

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database. Section: Administration Level: Intro Question: You have an Azure SQL Database. How can you create a copy of the Azure SQL Database on the same logical server? Answer: The easiest option is to use the CREATE DATABASE AS COPY OF command.

2025-03-25

SQL Interview: 30 Temporary stored procedures in SQL Server

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database. Section: Administration Level: Advanced Question: Your session is connected to a database named PublicWorks. You want to create a temporary stored procedure, that only lasts until your session has ended. It should be available to all other sessions while your session is still active.

2025-03-23

SQL Interview: 29 Add column to middle of SQL Server table

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database. Section: Development Level: Medium Question: You need to add a new column to a table. A developer insists that the column needs to be inserted into the middle of the existing table, not as a new column at the end.

2025-03-21

SQL Interview: 28 When computed columns are calculated in SQL Server

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database. Section: Development Level: Medium Question: You add a computed column to an existing table. You then select from the table. When is the value of the computed column calculated i.e., when the value is inserted or updated, or when the value is selected?

2025-03-19

SQL Interview: 27 Copy only backups in SQL Server

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database. Section: Administration Level: Intro Question: You need to take an additional backup copy of a database to send to another site. You are considering using the Copy Only backup option. What exactly is different about a Copy Only backup, compared to a Full backup?

2025-03-17

SQL Interview: 26 Whole of data operations when adding columns in SQL Server

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database. Section: Administration Level: Medium Question: You need to add additional columns to a table. You are concerned that you do not want to lock the table for long periods. You plan to avoid any operation that would rewrite every row i.

2025-03-15

SQL Interview #25: Extended Stored Procedures in SQL Server

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database. Section: Development Level: Advanced Question: You are reviewing stored procedures in the master database. You note both Stored Procedures, and Extended Stored Procedures. What is the difference between these types of procedures? Answer: Stored Procedures are written in T-SQL or SQL CLR and run in the standard user memory space of a SQL Server session.

2025-03-11

SQL Interview #24: DROP and CREATE vs ALTER for T-SQL Functions

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database. Section: Development Level: Medium Question: You are writing a script to change the code in a T-SQL function. You can choose to either DROP IF EXISTS and CREATE the procedure, or to use an ALTER statement. What advantage would you get from using an ALTER statement?

2025-03-07

SQL Interview #23: Logical issues related to ISNULL in SQL Server T-SQL

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database. Section: Development Level: Medium Question: A query included within a stored procedure, has a predicate written like this: WHERE ISNULL(ProductSize, '') = ISNULL(@ProductSize, '') A problem has been identified with this predicate. The system needs to be able to differentiate between NULL values for product size and blank strings.

2025-02-23

SQL Interview #22: Working with Credentials in Azure SQL DB

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database. Section: Security Level: Medium Question: With SQL Server on-premises, you can create a CREDENTIAL and they are stored in the master database. What option do you have with Azure SQL Database? Answer: You can create a DATABASE SCOPED CREDENTIAL in both SQL Server and in Azure SQL Database.

2025-02-21