Sql Flashcards

1
Q

How do you eliminate duplicates in sql

A

Select distinct

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

How do you name the column you are returning from database

A

As

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

How do you select what table you are querying in the database

A

Select* if searching the entire database
Select from to specify a table

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

String length

A

Len(column)
Length(column)

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

How do you add conditions

A

Where

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

How do you use the substring function

A

Substring(column,position of first character you want to return, total length of the substring)

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

Dml

A

Data manipulation language

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

Cast()

A

Can be used to convert anything from one data type to another.

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

Coalesce

A

Coalesce(columna,columnb) if no value in a it returns value in b

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

How do you change data types?

A

Cast
Cast as [data type]
From table

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

How do you avoid failed returns when casting (error)

A

Safe_cast: returns null value where the errors are. This allows the action to be completed without failing the entire command.

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

What data types are ther

A

Int
String
Datetime
Many more

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

What is unix_date

A

UNIX_DATE returns the number of days that have passed since January 1, 1970 and is used to compare and work with dates across multiple time zones. You will likely use CAST most often.

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