SQL Flashcards
(22 cards)
keyword to select from range
between
SELECT - only returns distinct values
unique
SELECT - from table
returns number of different “snail” values in table
count(distinct snail)
keyword that returns results in sorted order
order by
Using ‘order by’ without specifying asc/desc will result in an - query
asc
Select * from terrarium where
you want to select based on multiple conditions (color, moisture) with WHERE. What keyword separates each expression
and
Use the NOT keyword to select all records where City is NOT “Berlin”.
SELECT * FROM Customers
—– = ‘Berlin”
where not City
SELECT * FROM Customers
WHERE City —-
select all the cities that are not x or y
NOT IN (‘x’, ‘y’);
y/n when inserting values into a table, do you have to specify auto-increment values
n
is the values keyword used for both single row and multiple row inserts
y
operator to test for null values
is null
SELECT column FROM table WHERE value ——;
select all the values that are not empty
is not null
keyword used to modify existing table rows
update
Set the value of the City columns to ‘Oslo’, but only the ones where the Country column has the value “Norway”.
— Customers
— City = ‘Oslo’
— Country = ‘Norway’;
update, set, where
Delete all the values from customers table
— customers;
delete from
what command deletes all rows in a table without deleting the table
delete from
Use the MIN function to select the record with the smallest value of the Price column.
Select –
from products
min(price)
What sql wildcard represents exactly one character
_
JOIN keyword performs a(n) - join by defult
inner
union VS union all
which one excludes duplicates
union
call the sql function to round 4.5 to 1 decimal place
round(4.5, 1)