SQL Flashcards

(22 cards)

1
Q

keyword to select from range

A

between

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

SELECT - only returns distinct values

A

unique

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

SELECT - from table

returns number of different “snail” values in table

A

count(distinct snail)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

keyword that returns results in sorted order

A

order by

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Using ‘order by’ without specifying asc/desc will result in an - query

A

asc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Select * from terrarium where

you want to select based on multiple conditions (color, moisture) with WHERE. What keyword separates each expression

A

and

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Use the NOT keyword to select all records where City is NOT “Berlin”.

SELECT * FROM Customers
—– = ‘Berlin”

A

where not City

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

SELECT * FROM Customers
WHERE City —-

select all the cities that are not x or y

A

NOT IN (‘x’, ‘y’);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

y/n when inserting values into a table, do you have to specify auto-increment values

A

n

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

is the values keyword used for both single row and multiple row inserts

A

y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

operator to test for null values

A

is null

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

SELECT column FROM table WHERE value ——;

select all the values that are not empty

A

is not null

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

keyword used to modify existing table rows

A

update

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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’;

A

update, set, where

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Delete all the values from customers table

— customers;

A

delete from

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what command deletes all rows in a table without deleting the table

17
Q

Use the MIN function to select the record with the smallest value of the Price column.

Select –
from products

18
Q

What sql wildcard represents exactly one character

19
Q

JOIN keyword performs a(n) - join by defult

20
Q

union VS union all

which one excludes duplicates

21
Q

call the sql function to round 4.5 to 1 decimal place

A

round(4.5, 1)