chapter 2 Flashcards

1
Q

why can the describe command be abbreviated

A

In general, SQL keywords cannot be abbreviated. DESCRIBE is an Oracle Proprietary command, which is
why it can be abbreviated to DESC.

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

what does the desc cmd return

A

table name
data types
primary keys
foreign keys
nullable columns
length
precision
scale

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

what is concatenation

A

it means to connect or link together in a series

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

symbol for concatenation

A

||
double pipe character

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

when values are concatenated the result is a __________

A

character string

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

what happens when you don’t use a column alias when doing a concatenation operation

A

column aliases are useful when performing concatenation so that the default select line does not appear as the column heading

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

what is a literal value

A

it is a fixed data value such as a character, number or date

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

True or False
Number literals do not have to be enclosed in single quotes

A

True

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

what command will you use to find out how many unique instances of something exist

A

DISTINCT COMMAND

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

what is the syntax for distinct

A

select distinct <column_name> from <table_name>;</table_name></column_name>

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

Where in the query does the distinct command appear

A

Must appear directly after the select keyword

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

______ is optional in a select statement

A

Where clause

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

______- cannot be used in where clause

A

Alias

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

what are the comparison operators for not equal to

A

^=

!=

<>

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

character strings and dates in the where clause must be enclosed in ______

A

single quotation marks ‘ ‘

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

all character searches in the where clause are _____

A

case - sensitive

17
Q

What are the acceptable formats for date values

A

–> dash
–> forward slash
they can be in either upper, lower or initcap format

also remember to use 4 digit year values

18
Q

what is the between …and operator used for

A

it is used to select and display rows based on a range of values which are inclusive of the specified lower and upper limits

19
Q

_____ value must be listed first in the between … and operator

A

lower limit

20
Q

is there a performance benefit/drawback in using >= and <= over between …and operator ?

A

No, between …and is used over >= and <= as it is simpler to read

21
Q

the ‘in’ condition is also known as ?

A

membership condition

22
Q

what is the in condition used for

A

it is used to test whether a value is IN a specified set of values

23
Q

what is the LIKE condition in sql

A

allows you to select rows that match either characters, dates, or number patterns

24
Q

what are 2 wildcard characters in sql

A

% and _ (underscore)

25
Q

what are the wildcard characters used for in sql

A

used to construct a search string

26
Q

what is the % symbol used to represent

A

used to represent any sequence of ZERO or more characters

27
Q

what is _ symbol used to represent

A

used to represent a single character

28
Q

WHERE last_name LIKE ‘_o%’ represent

A

shows all the last names which have the second letter as o

29
Q

What is an escape option

A

–> is it used to indicate that the _ or % is part of the name, not a wildcard value

–> any character can be used as the escape character

30
Q

what is the syntax for escape character

A

SELECT last_name, job_id
FROM employees
WHERE job_id LIKE ‘%_R’ ESCAPE ‘ \ ‘

31
Q

which condition tests for data that is available in the database

A

IS NOT NULL

32
Q

which condition tests for data that is unavailable, unassigned or unknown data

A

IS NULL

33
Q

why does the column = NULL not work

A

This query will run, but it will not return any data, as the actual value of NULL is unknown.