Lesson 2: March 12, 2024 Flashcards
Reviewer
DML
Data Manipulation Language
DQL
Data Query Language
DDL
Data Definition Language
Command for viewing
SELECT * FROM tableName;
Command for viewing specific columns
SELECT colName1, colName2, colName3 FROM tableName;
Command for viewing specific row
SELECT * FROM tableName WHERE colName=’condition’;
Command for viewing values that are unique
SELECT DISTINCT colName FROM tableName;
SQL Arithmetic Operators
*
/
%
^ (exponent)
Select command with alias
SELECT colname1, colname1+colname 2 aliasName FROM tableName;
SQL Comparison Operators
=
>
<
>=
<=
<> (not equal)
SQL Logical Operators
AND - both true
(WHERE City=’London’ AND ‘Paris’);
BETWEEN - within the range
(WHERE Price BETWEEN 50 AND 60, includes 50 and 60)
EXISTS (WHERE EXISTS Condition)
IN
(WHERE City IN(‘Paris’, ‘London’);
LIKE
(WHERE City LIKE ‘s%’)
NOT LIKE ‘’
OR
(same syntax with and)
‘a%’
starting with a
‘%a’
ending with a
‘%a%’
contains a
‘V%a%’
Starts with V and contains a