Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Null Value MySQL supports the null value. Oracle does not support the null value.

===========================================================================

Character MySQL support only two characters that are CHAR and VARCHAR. Oracle
supports four different characters that are CHAR, VARCHAR2, NCHAR, and NVARCHAR2.

==========================================================================

For auto-incremented identity columns

Oracle :- Sequence object which can be used to generate automatic numbers

CREATE TABLE Orders (order_id number(1), amount number(20))

INSERT INTO Orders(id_sequence.NEXTVAL, 200)

INSERT INTO Orders(id_sequence.NEXTVAL, 400)

MySQL :- uses auto_increment

CREATE TABLE customers (cust_id INT PRIMARY KEY AUTO_INCREMENT...)

========================================

Current date

mysql :- select now()

oracle :- select sysdate from dual;

==========================================================

To list the tables

ORacle :- select * from user_tables

MySQL

show tables;

================================================

Types of Joins
MySQl :- inner, equi, outer, cross, self

Oracle :- inner, outer, equi, self, cross, anti, semi

The below table contains differences of the most popular string functions between SQL Server,
Oracle and MySQL.

Descriptio
Function SQL Server Oracle MySQL
n
ASCII code
ASCII(string_expressi of a
yes yes yes
on) leftmost
character.
Character yes and additionally
CHR(integer_express
from int yes yes supports more than
ion)
ASCII code. one character
Starting
CHARINDEX(find_e
INSTR(string, position of
xpr, search_expr, yes yes
substring) a string in a
start_pos)
string.
Concatenat yes but only two
CONCAT(str_expr1, es string string
yes yes
str_expr2, ...) expressions expressions are
into one. allowed
Formats a
partially,
FORMAT(value, numeric or TO_CHAR(valu
yes FORMAT(value,
format) date time e, format)
decimal_digits)
value.
SUBSTR(str_ex
LEFT(str_expr, Left part of
yes pr, 1, yes
num_of_chars) str_expr.
num_of_chars)
Number of yes (LEN vs LENGTH(str_ex CHAR_LENGTH(str_e
LEN(str_expr)
characters. DATALENGTH) pr) xpr)
Lowercase
LOWER(str_expr) version of yes yes yes
string.
no, but can be
Pads left
LPAD(str_expr, achieved by mixing
side of yes yes
length, pad) REPLICATE,
str_expr.
concatenation, LEN
Removes
LTRIM(str_expr) leading yes yes, extended yes
blanks.
Replaces
REPLACE(str_expr, all
yes yes yes
pattern, replacement) occurrence
s of pattern
no, but can be
Pads right
RPAD(str_expr, achieved by mixing
side of yes yes
length, pad) REPLICATE,
str_expr.
concatenation, LEN
Reverse
REVERSE(str_expr) ordering of yes yes yes
characters.
SUBSTR(str_ex
RIGHT(str_expr, Right part
yes pr, - yes
num_of_chars) of str_expr.
num_of_chars)
Removes
RTRIM(str_expr) trailing yes yes, extended yes
blanks.
SUBSTRING(str_expr SUBSTR(str_ex
Part of text. yes yes
, start, length) pr, start, length)
Uppercase
UPPER(str_expr) version of yes yes yes
string.

You might also like