×

Top 15 T-SQL(Transact-SQL) Interview Questions for 2024

1) What is T-SQL?

T-SQL stands for Transact Structured Query Language. T-SQL is the extension of SQL functionality supported by Microsoft SQL Server and Sybase ASE.

2) What are the features of T-SQL?

T-SQL makes enhancement in SQL server and provides the following features:
  • TRUNCATE TABLE with PARTATION.
  • DROP IF EXISTS.
  • Advanced Analytics Extensions.
  • Querying Temporal Tables
  • JSON support.
  • FORMATMESSAGE

3) What is difference between T-SQL and SQL?

  • T-SQL gives different implementation of DELETE and UPDATE than SQL.
  • T-SQL is best if it use Microsoft SQL servers.
  • T-SQL supports local variable, procedural programming but, SQL does not.
  • T-SQL is proprietary control under Microsoft while SQL is an open format.

4) What are the different data types in T-SQL?

T-SQL has different categories of data types:
Integer types (bigint, int, smallint, tinyint, bit,decimal,numeric,money,smallmoney).
Floating types (Float, Real).
Character Strings (char, varchar, Varchar(max), text)
Unicode Charcter Strings (nchar, nvarchar, Nvarchar(max), ntext)
Date and Time types (datetime, smalldatetime, date, datetimeoffset, datetime2, time).
Binary Strings (binary, varbinary, varbinary(max), image).
Others (sql_variant, timestamp, uniqueidentifier, xml, cursor, table, hierarchyid).

5) How can you execute a T-SQL query from command prompt?

  • OSQL
  • SQLCMD

6) What do you understand about Index in TSQL?

Index is special lookup used to retrieve data from database very fast. CREATE INDEX statement is used to create an index. Index is not visible to user. Creating and deleting of INDEX dose not effects on data. Syntax:
CREATE INDEX index_name ON table_name;

7) How local variable is defined in T-SQL?

Local variable is defined by using “DECLARE” statement and the name of local variable must start with "@" character in T-SQL. Syntax:
DECLARE @variable_name data_type;

8) What is "GO" in T-SQL?

GO is not a T-SQL statement, it signs the end of batch of T-SQL statement. It is a command recognized by the sqlcmd and osql utilities and SQL Server Management Studio Code Editor.

9) What is dynamic SQL statement?

A dynamic SQL statement is created at execution time. Dynamic SQL statement is useful when you need to decide at run time what field to be chosen with different criteria of queries. Syntax:
DECLARE @WhereClause NVARCHAR(2000)  
SET @WhereClause = ' Prouct = ''Computer'''  

SELECT * FROM SalesHistory WHERE @WhereClause
Example:
DECLARE @Product VARCHAR(20)  
SET @Product = 'Computer'   

SELECT * FROM SalesHistory WHERE Product = @Product

10) What is the difference between TRUNCATE and DELETE statement?

DELETE TRUNCATE
DELETE statement is used to remove data record with condition clause. TRUNCATE statement is used to remove all data records from table without any condition.
DELETE is slower. TRUNCATE is faster.
DELETE is DML statement. TRANCATE is DDL statement.

11) What is NULL and UNKNOWN in T-SQL?

NULL is a value which is unknown. A null value is different from zero or an empty value. The comparison between two null values returns unknown because the value of each null is unknown.

12) What is @@ERROR in T-SQL?

@@ERROR returns the error number of last T-SQL statement executed. 
It returns 0 if the last executed statement has no error.

13) What are the Join Types in TSQL?

TSQL has the following join types:
  • Inner join
  • Outer join
  • Left outer join
  • Right outer join
  • Left outer join with Exclusions
  • Right outer join with Exclusions
  • Full outer join
  • Full outer joins with Exclusions
  • Cross join

14) What is transaction Auto commit?

Auto commit is a default transaction management mode. Every statement is committed or rolled back when complete. When SQL statement successfully completed it is committed otherwise it is rolled back.

15) What is sub-query in TSQL?

Sub Query is a query that is nested inside another query. A sub query returns data which is further used in main query as a condition to generate final result. The sub query executed before the parent query. Syntax:
FROM   table1 [, table2 ]  
WHERE  column_name OPERATOR  
    (SELECT column_name [, column_name ]  
    FROM table1 [, table2 ]   [WHERE])

Related Topics

Top 14 MathML Interview Questions for 2024

1) What is MathML? MathL stands for Mathematical Markup Language. It is extended form of XML. It is used to describe mathematical and scientific notations. 2) Who is the developer of MathML? World...

3 minutes read.

Top 15 Xamarin Interview Questions for 2024

1) What is Xamarin? Xamarin is a .NET framework. It allows to create an application that run on multiple platforms. Xamarin Tutorial uses C# language and .NET framework to deliver native...

2 minutes read.

Top 30 Cassandra Interview Questions for 2024

1) Explain. What is Cassandra? Cassandra is an open source data storage system. It was developed at Facebook for inbox search and designed for storing and managing large amount of data. 2)...

5 minutes read.

Top 14 Apache Presto Interview Questions for 2024

1) What is Presto? Presto is a distributed SQL query engine. It is an open source software project to develop a database. 2) What are the features of Presto? There are following features...

2 minutes read.

Bugzilla interview Questions

Frequently asked questions about Bugzilla Q1. What are reports in Bugzilla? A1. Reports can be defined as an interface between the user and the database of Bugzilla. It helps to examine and...

4 minutes read.

Top 15 XML Interview Questions for 2024

1) What is XML? XML (eXtensible Markup Language) is designed to transport and store data. It has user executive tags i.e. no pre-defined tags used as in HTML. This language is...

2 minutes read.

Top 14 Web icon Interview Questions for 2024

1) What is Web Icon? Web Icon is a symbol that is used to represent a specific action or a capability on a webpage. It is used in documents as well...

5 minutes read.

Top 30 TypeScript Interview Questions for 2024

1) What is TypeScript? TypeScript is an object-oriented and compiled language. TypeScript is also known as a set of tools. TypeScript is used for application-scale development. 2) What are the features of TypeScript? Features of...

4 minutes read.

Top 15 Hadoop Interview Questions for 2024

1) What is Hadoop? Hadoop is a framework which is used to store and process Big Data. It is a distributed computing platform and helps in analyzing Big Data. 2) What are the...

2 minutes read.

Top 16 WebGL Interview Questions for 2024

1) What is WebGL? WebGL stands for Web Graphics Library. It is a JavaScript API that is used for rendering 3D graphic in any compatible web browser. It is written in...

3 minutes read.

Top 30 PyTorch Interview Questions and Answers

Q1: What is PyTorch? Answer: PyTorch is a machine learning library for the programming language Python, based on Torch library, used for application such as natural language processing. It is free...

9 minutes read.

Top 32 Laravel Interview Questions for 2024

1) What is Laravel? Laravel is an open source PHP framework. It is used to design and develop web applications. It is based on MVC (Model-View-Controller) design pattern. It is created by Taylor...

6 minutes read.

Top 15 iOS (iPhone, iPad) Interview Questions for 2024

Top 20 Most Frequently asked iOS Interview Questions and Answers 1) What is iOS? iOS is a mobile operating system developed by Apple Inc. iOS offers iPhone and iPad application development using...

3 minutes read.

Top 30 Ruby on Rails Interview Questions for 2024

1) What is Ruby on Rails? It is a server-side web application framework. It is an open source ruby framework which is used for developing database-backed web applications. Here, no compilation phase is...

4 minutes read.

Top 30 SQLite Interview Question for 2024

1) What is SQLite? It is an in-process library which implements self-contained, serverless, zero-configuration, transactional SQL database. 2) What datatype does SQLite supports? It uses dynamic typing and data can be stored in...

5 minutes read.

Top 30 FuelPHP Framework Interview Questions for 2024

1) What is FuelPHPFramework? FuelPHP Framework is an open source web application and written in PHP scripting language. It is based on the HMVC (Hierarchical Model View Controller) design pattern. It was released...

6 minutes read.

VB.NET Interview Questions

1) What is VB.NET? VB.NET stands for Visual Basic .NET. It is an object oriented programming language. It is implemented on .NET framework and launched by Microsoft in 2001. 2) Who is...

3 minutes read.

Top 15 ES6 Interview Questions for 2024

Commonly Asked ES6 Interview Questions and Answers 1) What is ES6? ES6 is a scripting language specification standardized. It is used to enable client-side scripting. The specification is influenced by programming languages (Self, Python, Perl,...

2 minutes read.

Top 30 Drupal Interview Questions for 2024

1) What is Drupal? Drupal is an open source CMS (Content Management System) framework. It is written in php and provides rich set of tools to create web sites. 2) What are...

4 minutes read.

Top 40 TensorFlow Interview Questions and Answers

Commonly Asked TensorFlow Interview Questions for Fresher Q1. What is TensorFlow? TensorFlow is the machine learning library developed by Google's brain team, it supports multiple abstraction levels, and we can choose the...

13 minutes read.