CODING THE ULTIMATE GUIDE : STEP BY STEP GUIDE ,LEARN COMPUTER CODING by WILLIAM HANSON

CODING THE ULTIMATE GUIDE : STEP BY STEP GUIDE ,LEARN COMPUTER CODING by WILLIAM HANSON

Author:WILLIAM HANSON [HANSON, WILLIAM]
Language: eng
Format: azw3, epub
Published: 2020-06-18T00:00:00+00:00


INT – Integer Data Type

The integer data type stores whole numbers. Examples include -23, 0, 5, and 10045. Whole numbers don’t include decimal places. Since the SQL server uses a variety of computer words to represent an integer, there are maximum and minimum values that it can represent. An INT data type can store a worth from -2,147,483,648 to 2,147,483,647.

Practical uses of the INT data type include using it to count values, store a person’s age, or use it as an ID key to a table.

But INT wouldn’t be so good to stay track of a terabyte disk drive address space, because the INT data type only goes to 2 billion and that we would wish to trace into the trillions. For this, you'll use BIGINT.

VARCHAR and NVARCHAR – Text Values

Use VARCHAR and NVARCHAR to store variable-length text values. “VARCHAR” stands for variable-length character.

What makes VARCHAR popular is that values but fifty characters take less space. Space is allocated as required. This differs from the CHAR data type, which always allocates the required length, no matter the length of the particular data stored.

The VARCHAR data type can typically store a maximum of 8,000 characters. Use the NVARCHAR datatype to store Unicode text. Since UNICODE characters occupy twice the space, NVARCHAR columns can store a maximum of 4,000 characters.

The advantage NVARCHAR has over VARCHAR is it can store Unicode characters. This makes it handy to store extended character sets like those used for languages like Kanji.

Databases designed before SQL 2008 typically use VARCHAR; however, more modern databases or those global in nature tend to use NVARCHAR.

DATETIME – Date and Time

Use the DATETIME data type to store the date and time. An example of a DATETIME value is 1968-10-23 1:45:37.123

This is the worth for October 23rd, 1968, at 1:45 AM. Actually, time is more precise than that. The time is basically 45 minutes, 37.123 seconds.

In many cases, you only got to store the date. In these cases, the time component is zeroed out. Thus, November 5th, 1972 is 1972-11-05 00:00:00.000

A DATETIME can store dates from January 1, 1753, through New Year's Eve, 9999. This makes the DATETIME good for recording dates in today’s world, but not such a lot in William Shakespeare’s.

As you get more conversant in the varied SQL built-in functions, you’ll be ready to manipulate the info. To offer you a glimpse, we’ll use the YEAR function to count employees hired annually. When given a DATETIME value, the YEAR function returns the year.

DECIMAL and FLOAT – Decimal Points

Use both DECIMAL and FLOAT datatypes to figure with decimal values like 10.3.

I lumped DECIMAL and FLOAT into an equivalent category since they both can handle values with decimal points; however, they both do so differently:

If you would like precise values, like when working with financial or data, then use DECIMAL. The rationale is that the DECIMAL datatype allows you to define the number of decimal points to take care of.

DECIMAL

DECIMAL data types are defined by precision and scale. The precision determines the



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.