SQL Series II: SQL Fundamental WHERE Statement and IN, OR, AND, BETWEEN, & LIKE Operator

select productCOde, productName, productLine, buyPrice from products where productLine = 'Motorcycles';
select productCode, productName, producLine, buyPrice from products where productLine != ‘Motorcycles’;
select productCode, productName, productLine, buyPrice from products where buyPrice >= 70;

Penggunaan Operator OR dan AND

select productCode, productName, productLine, buyPrice, from products where productLine = ‘Motorcycles’ and buyPrice > 50;
select productCode, productName, productLine, buyPrice from products where productLine = ‘Planes’ OR buyPrice > 70;

Penggunaan Operator IN

select productCode, productName, productLine, buyPrice from products where productLine in (‘Planes’,‘Ships’);

Penggunaan Operator BETWEEN

select select productCode, productName, productLine, buyPrice from products where productLine between 50 AND 70;

Penggunaan Operator LIKE

https://www.w3schools.com/sql/sql_like.asp
select concat(firstName, ' ', lastName) as employee_name
from employees
where lastName like '%a' or lastName like '%e' or lastName like '%i' or lastName like '%o' or lastName like '%u';

--

--

I’m a Data Scientist who never stop learning.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store