Documente Academic
Documente Profesional
Documente Cultură
1/4
Diferencias de Sintaxis entre varios SGBDR (Sistemas Gestores de Bases de Datos Relacionales)
En LIKE
0 o ms carct.
ANSI SQL
MySQL
Teradata
%
_ (Subrayado)
[0-9]
Un carcter
Un dgito
Funciones Nildicas:
Fecha Actual
Hora Actual
Fecha y Hora
Usuario BBDD
CURRENT_USER
SESSION_USER
SESSION_USER()
Usuario S.O.
SYSTEM_USER
SYSTEM_USER()
SubCadena
-----------
Sys_Context('USERENV',
'SESSION_USER')
Sys_Context('USERENV',
'OS_USER')
||
CHAR[ACTER]_LENGTH
CHARS(txt) y -->
UPPER(txt)
LOWER(txt)
POSITION(subtxt in txt)
SUBSTRING
SUBSTR[ING]
(txt From ini [For long])
LENGTH(txt)
INSTR(subtxt in txt)
SubStr
(txt, ini, long)
Quita Espacios: Sintaxis genrica: TRIM( [Leading | Trailing | Both] [Carcter] [From] txt)
TRIM(Leading From txt)
A la Izquierda
TRIM(Trailing From txt)
A la Derecha
TRIM(txt)
TRIM(Both From txt)
Ambos lados
TRIM(txt)
2007 Joaqun Caselles - Curso de Lenguaje SQL (Ver. 1.5 Febrero 2015)
SQL Server
Access
*
?
#
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURRENT_USER()
USER
Usuario Actual
Funciones de Cadena:
Concatenar
Longitud
Maysculas
Minsculas
Encontrar
Oracle
Cast(getDate() AS Date)
Cast(getDate() AS Time)
CURRENT_USER
Date()
Time()
Now
CurrentUser
SESSION_USER
-----------
SYSTEM_USER
Environ('UserName')
+
LEN(txt)
&
Len(txt)
UCase(txt)
LCase(txt)
InStr(inicio, txt, subtxt)
SUBSTRING
(txt, ini, long)
LTRIM(txt)
RTRIM(txt)
RTRIM(LTRIM(txt))
LTRIM(txt)
RTRIM(txt)
TRIM(txt)
sql.jjcaselles.com - sql.coninteres.es
ANSI SQL
Funciones de Fechas:
Parte de Fecha
Funciones Numricas:
Entero Superior
Entero Inferior
Redondeo
Valor Absoluto
Potencia
exponente
resultado
Teradata
Oracle
SQL Server
Access
DatePart(parte , Fecha_Hora)
CEILING(valor)
CEIL(valor)
FLOOR(valor)
ROUND(valor, precisin)
ABS(valor)
POW
** / POWER
POWER
**
(base , exponente)
(base , exponente)
(base , exponente)
SQRT(valor)
DIV
/
/
dividendo % divisor
MOD(dividendo , divisor)
CEIL[ING](valor)
-----------
POWER
(base , exponente)
Raz Cuadrada
Divisin Entera
Resto
MySQL
= valor
Conversin
Funciones de Decisin:
Anlisis
Si
ndice
Si Nulo ...
Nulo si ...
2007 Joaqun Caselles - Curso de Lenguaje SQL (Ver. 1.5 Febrero 2015)
2/4
----------Int(valor)
base ^ exponente
Sqr(valor)
\
dividendo mod divisor
EXP(exponente)
LN(valor)
LOG(valor)
CAST(dato AS Tipo)
Especficas: CTipo(dato)
sql.jjcaselles.com - sql.coninteres.es
ANSI SQL
Operaciones de Conjuntos:
Unin
INTERSECT
Interseccin
EXCEPT
Diferencia
MySQL
---------------------
START TRANSACTION
COMMIT
ROLLBACK
2007 Joaqun Caselles - Curso de Lenguaje SQL (Ver. 1.5 Febrero 2015)
Teradata
Oracle
UNION [ALL]
INTERSECT
EXCEPT / MINUS
MINUS
[INNER] JOIN
, (Coma) o CROSS JOIN
NATURAL JOIN
(Implicito) COMMIT
COMMIT
ROLLBACK
SQL Server
Access
EXCEPT
---------------------
3/4
INNER JOIN
-----------
, (Coma) (Implcita)
-----------
-----------
BEGIN TRAN[SACTION]
COMMIT [TRAN]
COMMIT
ROLLBACK [TRAN]
ROLLBACK
sql.jjcaselles.com - sql.coninteres.es
Tipos de Datos:
Lgico
Texto (long. fija)
Texto (long. var.)
Entero (1 byte)
Entero (2 bytes)
Entero (4 bytes)
Entero (8 bytes)
Decimal
Coma Flotante
Fecha
Hora
Instante
ANSI SQL
Boolean
Char
VarChar
MySQL
Boolean
Char
VarChar
SmallInt
Integer
SmallInt
Integer
Decimal
Float
Date
Time
TimeStamp
Binary Large Object BLOB
Decimal
Float
Date
----BLOB
Teradata
Char
VarChar
ByteInt
SmallInt
Integer
BigInt
Decimal(n,m)
Date
Time
TimeStamp
Oracle
--[N]Char
[N]VarChar2
SmallInt
Integer
Number [(p[, s])]
Float
Date
--TimeStamp
BLOB (mx. 4 Gb)
SQL Server
Bit
[N]Char, Character
[N]VarChar
TinyInt
SmallInt
Int, Integer
BigInt
Decimal / Numeric
Float
(4 u 8 bytes)
DateTime
DateTime
TimeStamp
Binary
4/4
Access
Bit / Boolean
Character
Text
Byte
SmallInt / Integer2
Integer / Integer4
Decimal
Float
Date
DateTime
--Binary
(17 bytes)
(8 bytes)
(8 bytes)