Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

T-SQL (transact-SQL) valid in SQLite and other SQL databases?

There doesn't seem to be any clear info out there about T-SQL and the ability to use it in SQLite and other non-microsoft SQL implementations. Most articles I come across say its Microsoft proprietary, so can we use T-SQL statements like CASE etc. on a SQLite database?

like image 329
dlitwak Avatar asked Jul 09 '11 02:07

dlitwak


People also ask

Does SQLite use T-SQL?

MySQL, sqlite, and others are the same way, and so sometimes a quirk with another platform will make "correct" and standards-compliant T-SQL be broken for that platform. In other words, if you know T-SQL, you know about 85% of what you need to write queries for SQLite, MySQL, oracle, db2, Informix, Access, etc.

What database uses T-SQL?

The obvious difference is in what they are designed for: SQL is a​ query language used for manipulating data stored in a database. T-SQL is also a query language, but it's an extension of SQL that is primarily used in Microsoft SQL Server databases and software.

What is the difference between Transact-SQL and SQL?

SQL is a query language that serves the purpose of data manipulation. TSQL is a query language, but it is an extension of SQL that serves Microsoft SQL Server databases and software.

What is difference between SQL and SQLite?

SQLite is an Relational Database Management System which is written in ANSI-C. SQL is standard which specifies how relational schema is created, data is inserted or updated in relations, transactions are started and stopped, etc. SQLite is file-based.


2 Answers

T-SQL is Microsoft's implementation (dialect) of the ANSI SQL standard. Like most implementations, there are portions that are proprietary and not standard, quirks that are permissible but not idiomatic for other platforms, and items defined in the standard that are not implemented. MySQL, sqlite, and others are the same way, and so sometimes a quirk with another platform will make "correct" and standards-compliant T-SQL be broken for that platform.

In other words, if you know T-SQL, you know about 85% of what you need to write queries for SQLite, MySQL, oracle, db2, Informix, Access, etc. However, there will be a few bumps; definitely don't expect code written for one platform to work on another.

CASE is one of those instances where the various flavors of sql tend to differ, with a number of other implementations choosing a syntax based on IF instead. The core SELECT, FROM, WHERE keywords, on the other hand, tend to be more consistent.

like image 68
Joel Coehoorn Avatar answered Oct 16 '22 20:10

Joel Coehoorn


ANSI SQL is the standard Structured Query Language.

Most database vendors support SQL. T-SQL is Microsoft's version of ANSI SQL.

like image 35
Mitch Wheat Avatar answered Oct 16 '22 22:10

Mitch Wheat