SQL2 Flashcards
SQL built-in data type categories?
Exact numbers Approximate numbers Date and time Character strings Unicode character strings Binary strings Other data types CLR data types:(common language runtime) Spatial data types
Data type?
Is an attribute that specifies the type of data an object can hold. As well as how many bytes each data type takes up.
Most commonly used data type?
Money Datetime Integer (int) : numeric data type varchar or nvarchar (international) Boolean: bit data type (T or F) Float: numeric data type ( 4-byte-7 digits / 8-byte-15 digits)
Exact number?
Bit 1b Tinyint 1b Smallint 2b Int 4b Bigint 8b Numberic varies Decimal varies Smallmoney 4b Money 8 b
Character strings?
Char: fixed length
Varchar: variable length
A regular character uses one byte of storage for each character.
Syntax ‘ ‘ ( single quotes)
Unicode character strings?
Nchar: fixed length
Nvarchar: variable length
(2 x storages)
Character strings?
Char: fixed length
Varchar: variable length
A regular character uses one byte of storage for each character.
Syntax ‘ ‘ ( single quotes)
Binary strings?
Binary: fixed length
Varbinary: variable length
Ex: image
What determined when two expressions have different data type?
- Lower precedence converted to higher precedence
- SQL Server predefined collation precedence
- The result depend on the precision,scale,length of the input expression
Scales(s)?
Reflects the maximum number of decimal digits that can be stored to the right of the decimal point.
Ex: decimal [(p[,s])]
Precision (p)?
Is the maximum total number of decimal digits that can be stored,both to the left and to the right of the decimal point. This value must be at least 1 and at most 38. The default precision number is 18.
Ex: decimal [(p[,s])]
Implicit conversions?
Data type conversion are done automatically.
Two common naming convention ?
PacalCase
camelCase
No space or use _ as word separators
Explicit conversion?
Data type conversions require you to use the functions Cast or Convert specifically.
Cast and Convert functions
A view?
Is simply a virtual table consisting of different columns from one or more tables.