EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login
Home Data Science Data Science Tutorials Database Management Tutorial TSQL Interview Questions
Secondary Sidebar
Database Management Tutorial
  • TSQL Basic
    • TSQL
    • What is T-SQL
    • T-SQL Commands
    • T-SQL String Functions
    • TSQL Interview Questions
  • DataBase Management
    • Text Data Mining
    • Roles of Database Management System in Industry
    • SQL Server Database Management Tools
    • Databricks CLI
    • Database administrator skills
    • Database Management Systems Advantages
    • Database Testing Interview Questions
    • Netezza Database
    • Data Administrator
    • Database Administrator
    • Data manipulation
    • Database Management Software
    • DataStage
    • Types of Database Models
    • Types of Database
    • Hierarchical Database Model
    • Relational Database
    • Relational Database Advantages
    • Operational Database
    • What is RDBMS?
    • Data Masking Tools
    • Database Security
    • Data Replication
    • Bitmap Indexing
    • Second Normal Form
    • Third Normal Form
    • Fourth Normal Form
    • Data Definition Language
    • Data Manipulation Language
    • Data Control Language
    • Transaction Control Language
    • Dataset Normalization
    • jdbc connection
    • Conceptual Data Model
    • Entity-Relationship Model
    • Relational Database Model
    • Sequential File Organization
    • Teradata Create Table
    • Teradata Database
    • Centralized Database
    • Data Storage in Database
    • Thomas write Rule
    • DBA Interview Questions
    • What is JDBC?
    • jdbc hive
    • Apriori Algorithm
    • JDBC Architecture
    • JDBC Interview Questions
    • Datastage Interview Questions
    • Wildcard Characters
    • Distributed Database System
    • Multidimensional Database

Related Courses

SQL Certification Course

PL/SQL Certification Course

Oracle Certification Course

TSQL Interview Questions

By Priya PedamkarPriya Pedamkar

TSQL Interview Questions

Introduction to TSQL Interview Questions And Answers

If you are looking for a job that is related to TSQL, you need to prepare for the 2023 TSQL Interview Questions. Though every interview is different and the scope of a job is also different, we can help you out with the top TSQL Interview Questions and answers, which will help you take the leap and get you success in your TSQL Interview.

Below is the list of Important 2023 TSQL Interview Questions that are asked mostly in an interview

Part #1 – TSQL Interview Questions And Answers (Basic)

Below are the basic interview questions and answers

All in One Data Science Bundle(360+ Courses, 50+ projects)
Python TutorialMachine LearningAWSArtificial Intelligence
TableauR ProgrammingPowerBIDeep Learning
Price
View Courses
360+ Online Courses | 50+ projects | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (86,241 ratings)

1. Explain what is T-SQL?

Answer:
T-SQL stands for Transact-Structured Query Language, which is an extension of SQL functionality supported by Microsoft SQL Server and Sybase ASE.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

2. Explain what are the differences between SQL and T-SQL?

Answer:
The difference between T-SQL and SQL is that SQL is a query language to operate on sets, while TSQL is a proprietary procedural language used by MS SQL Server. Also, T-SQL has a different implementation of DELETE and UPDATE than SQL.

3. Please name at least five commands which can manipulate text in the T-SQL code. For example, replace a text string, obtain a portion of the text, etc.

Answer:
•LEFT(character_expression, integer_expression ) – It returns the left part of a character expression with the specified number of characters.
•CHARINDEX( findTextData, text data, [startingPosition] ) – It returns starting position of an expression in a character string, and starting position is optional.
•REPLACE( textData, findTextData, replaceWithTextData ) – It replaces a new value for occurrences of text found in the string.
•REVERSE( character_expression ) – It returns the reverse of a character expression.
•LEN( textData ) – It returns the length of the string, excluding trailing blanks.
•LOWER ( character_expression ) – After converting an uppercase character to lowercase, it will return a character expression.
•LTRIM( textData) – Leading blanks will be removed.
•PATINDEX( findTextData, textData ) – It returns the starting position integer value of text found in the string.
•REPLICATE(character_expression, integer_expression ) – It repeats a character expression for a specified number of times.
•RTRIM( textData) – Removes trailing blanks. SPACE( number of spaces ) – It repeats the space value specified a number of times.
•STUFF( textData, start, length, insert text data ) – It deletes a specified length of characters and inserts another set of characters at a specified starting point.
•SUBSTRING( textData, startPosition, length ) – It returns portion of the string.
•UPPER( character_expression ) – It returns a character expression with lowercase character to uppercase.

4. Is it possible to import data directly from T-SQL commands without using SQL Server Integration Services? If so, what are the commands?

Answer:
Yes – There are Six commands available to import data directly into the T-SQL language. These commands include:
•BCP
•Bulk Insert
•OpenRowSet
•OPENDATASOURCE
•OPENQUERY
•Linked Servers

5. Mention what is ‘GO’ in T-SQL?

Answer:
‘GO’ is not a Transact-SQL statement but a batch separator. It is a command identified by the sqlcmd and osql utilities and SQL Server Management Studio Code editor. SQL Server utilities read “GO” as a signal that they should send the current batch of TSQL statements to an instance of SQL Server.

6. Mention the difference between the DELETE statement and TRUNCATE statement?

Answer:
With the use of the DELETE and TRUNCATE command, all data will be lost in a table. The difference between the DELETE statement and TRUNCATE statement is that,
•DELETE is used for conditional removal of data records from Tables. These operations are logged.
•TRUNCATE is used for the unconditional removal of data records from Tables. Truncate operations are not logged.

Part #2- TSQL Interview Questions And Answers (Advanced)

Below are the advanced interview questions and answers

7.When to use COALESCE() & ISNULL() Functions?

Answer:
The NULLability of result expression is different for ISNULL and COALESCE. The ISNULL return value is always considered NOT NULLable (assuming the return value is a non-nullable one), whereas COALESCE is not. So the expressions ISNULL(NULL, 1) and COALESCE(NULL, 1), although equivalent, has different NULLability values. This makes a difference if you are using these expressions in computed columns and creating key constraints or making the return value of a scalar UDF deterministic so that it can be indexed.

8. Mention what is sub-query?

Answer:
A sub-query is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved. A sub-query can be used with the statements like Update, select, delete and insert with the operators like =, >, <, >=,<=, etc.

9. What are the types of XML indexes in SQL Server?

Answer:
Microsoft SQL Server supports different types of XML indexes. An XML index is different from a relational index. There are basically TWO types of XML Indexes viz., Primary XML Indexes and Secondary XML indexes. The primary XML index is a clustered index on an internal table known as the node table that users cannot use directly from their T-SQL statements. To enhance search performance, we create secondary XML indexes. These create secondary links (RID) at leaf level for existing clustered index-based KEY pages. A primary XML index should be created prior to creating the Secondary XML Indexes.

10. What is SQL Server?

Answer:
SQL Server is a vast, easy, powerful Relational Database Management (also Data warehouse Management) application from Microsoft. It offers Database Development, Database Management, and Business Intelligence capabilities. This wonderful technology is very easy to master and manage. This offers the following advantages:
•Easy To Use
•Support for Small, Medium and Large Database Storage
•Cheaper, compared to other RDBMS
•Data warehouse Support
•Enhanced Security Features
•Enterprise Feature Support
•In-Memory Processing
•Business Intelligence Support
•Highly Scalable and Powerful
•Low Cost of Ownership

11. Mention new error handling commands which are introduced with the SQL Server 2005 and beyond? What commands did they replace? How is the command used?

Answer:
The new commands introduce with SQL Server 2005 are TRY and CATCH. Though they do not replace directly any specific command, but in many aspects, TRY and CATCH can be used instead of RAISERROR. The TRY block covers business logic, whereas the CATCH logic is for capturing the error.

12. Mention what TOP is in TSQL?

Answer:
TOP limits the rows returned in a query result set to a specified number of rows or percentage of rows in SQL Server. When TOP is used in combination with the ORDER BY clause, the result set is limited to the first N number of ordered rows. Otherwise, it retrieves the first N number of rows in an undefined order.

Recommended Article

This has been a guide to the List Of TSQL Interview Questions and answers so that the candidate can crackdown on these Interview Questions easily. This is the most useful and valuable post on TSQL Interview Questions and answers. You may also look at the following articles to learn more –

  1. SSIS Interview Questions And Answer
  2. Cognos Interview Questions And Answer
  3. SSAS Interview Questions And Answer
  4. OBIEE Interview Questions
Popular Course in this category
Programming Languages Training (41 Courses, 13+ Projects, 4 Quizzes)
  41 Online Courses |  13 Hands-on Projects |  322+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

SQL Training Program (7 Courses, 8+ Projects)4.9
PL SQL Training (4 Courses, 2+ Projects)4.8
Oracle Training (14 Courses, 8+ Projects)4.7
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

SPSS, Data visualization with Python, Matplotlib Library, Seaborn Package

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more