2018 - 07 - 02 (월)
오라클 ROWNUM
SELECT * FROM Customers
WHERE ROWNUM <= 3;
--상위 3개의 레코드만 가져온다.
SELECT TOP 3 * FROM Customers
WHERE Country='Germany';
오라클 is null / is not null
-- address 가 Null 값인.
SELECT LastName, FirstName, Address FROM Persons
WHERE Address IS NULL;
-- Address 가 Null 값이 아닌..
SELECT LastName, FirstName, Address FROM Persons
WHERE Address IS NOT NULL;
오라클 LIKE
SELECT * FROM Customers
WHERE CustomerName LIKE '%or%';
-- City 명이 b or s or p 로 시작하는
SELECT * FROM Customers
WHERE City LIKE '[bsp]%';
-- City 명이 a~c 로 시작하는
SELECT * FROM Customers
WHERE City LIKE '[a-c]%';
-- City 명이 b or s or p 로 시작하지 않는
SELECT * FROM Customers
WHERE City LIKE '[!bsp]%';
SELECT * FROM Customers
WHERE City NOT LIKE '[bsp]%';
오라클 In
-- Country 가 Germany, France, UK 인..
SELECT * FROM Customers
WHERE Country IN ('Germany', 'France', 'UK');