Interview Questions

AJAX Interview Questions Android Interview Questions Angular 2 Interview Questions AngularJs Interview Questions Apache Presto Interview Questions Apache Tapestry Interview Questions Arduino Interview Questions ASP.NET MVC Interview Questions Aurelia Interview Questions AWS Interview Questions Blockchain Interview Questions Bootstrap Interview Questions C Interview Questions C Programming Coding Interview Questions C# Interview Questions C++ Interview Questions Cakephp Interview Questions Cassandra Interview Questions CherryPy Interview Questions Clojure Interview Questions Cobol Interview Questions CodeIgniter interview Questions CoffeeScript Interview Questions Cordova Interview Questions CouchDB interview questions CSS Buttons Interview Questions CSS Interview Questions D Programming Language Interview Questions Dart Programming Language Interview Questions Data structure & Algorithm Interview Questions DB2 Interview Questions DBMS Interview Questions Django Interview Questions Docker Interview Questions DOJO Interview Questions Drupal Interview Questions Electron Interview Questions Elixir Interview Questions Erlang Interview Questions ES6 Interview Questions and Answers Euphoria Interview Questions ExpressJS Interview Questions Ext Js Interview Questions F# Interview Questions Firebase Interview Questions Flask Interview Questions Flex Interview Questions Fortran Interview Questions Foundation Interview Questions Framework7 Interview Questions FuelPHP Framework Interview Questions Go Programming Language Interview Questions Google Maps Interview Questions Groovy interview Questions GWT Interview Questions Hadoop Interview Questions Haskell Interview Questions Highcharts Interview Questions HTML Interview Questions HTTP Interview Questions Ionic Interview Questions iOS Interview Questions IoT Interview Questions Java BeanUtils Interview Questions Java Collections Interview Questions Java Interview Questions Java JDBC Interview Questions Java Multithreading Interview Questions Java OOPS Interview Questions Java Programming Coding Interview Questions Java Swing Interview Questions JavaFX Interview Questions JavaScript Interview Questions JCL (Job Control Language) Interview Questions Joomla Interview Questions jQuery Interview Questions js Interview Questions JSF Interview Questions JSP Interview Questions KnockoutJS Interview Questions Koa Interview Questions Laravel Interview Questions Less Interview Questions LISP Interview Questions Magento Interview Questions MariaDB Interview Questions Material Design Lite Interview Questions Materialize CSS Framework Interview Questions MathML Interview Questions MATLAB Interview Questions Meteor Interview Questions MongoDB interview Questions Moo Tools Interview Questions MySQL Interview Questions NodeJS Interview Questions OpenStack Interview Questions Oracle DBA Interview Questions Pascal Interview Questions Perl interview questions Phalcon Framework Interview Questions PhantomJS Interview Questions PhoneGap Interview Questions Php Interview Questions PL/SQL Interview Questions PostgreSQL Interview Questions PouchDB Interview Questions Prototype Interview Questions Pure CSS Interview Questions Python Interview Questions R programming Language Interview Questions React Native Interview Questions ReactJS Interview Questions RequireJs Interview Questions RESTful Web Services Interview Questions RPA Interview Questions Ruby Interview Questions Ruby on Rails Interview Questions SAS Interview Questions SASS Interview Questions Scala Interview Questions Sencha Touch Interview Questions SEO Interview Questions Servlet Interview Questions SQL Interview Questions SQL Server Interview Questions SQLite Interview Questions Struts Interview Questions SVG Interview Questions Swift Interview Questions Symfony PHP Framework Interview Questions T-SQL(Transact-SQL) Interview Questions TurboGears Framework Interview Questions TypeScript Interview Questions UiPath Interview Questions VB Script Interview Questions VBA Interview Questions WCF Interview Questions Web icon Interview Questions Web Service Interview Questions Web2py Framework Interview Questions WebGL Interview Questions Website Development Interview Questions WordPress Interview Questions Xamarin Interview Questions XHTML Interview Questions XML Interview Questions XSL Interview Questions Yii PHP Framework Interview Questions Zend Framework Interview Questions

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

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])



ADVERTISEMENT
ADVERTISEMENT