Sql Flashcards
How do you eliminate duplicates in sql
Select distinct
How do you name the column you are returning from database
As
How do you select what table you are querying in the database
Select* if searching the entire database
Select from to specify a table
String length
Len(column)
Length(column)
How do you add conditions
Where
How do you use the substring function
Substring(column,position of first character you want to return, total length of the substring)
Dml
Data manipulation language
Cast()
Can be used to convert anything from one data type to another.
Coalesce
Coalesce(columna,columnb) if no value in a it returns value in b
How do you change data types?
Cast
Cast as [data type]
From table
How do you avoid failed returns when casting (error)
Safe_cast: returns null value where the errors are. This allows the action to be completed without failing the entire command.
What data types are ther
Int
String
Datetime
Many more
What is unix_date
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.
Concat_ws
With separator adds character between
Sql stores info In a 64 bit memory system
Int64