sql判断数据库类型数据_SQL数据类型
sql判斷數(shù)據(jù)庫類型數(shù)據(jù)
SQL | 資料類型 (SQL | Data Types)
Just like other programming languages, facilities of defining data of various types are available in SQL also. SQL supports the following data types for the specification of various data-items or fields of a relation/table. In SQL, each column of the table is assigned a datatype which conveys the kind of value that will be stored in the column.
與其他編程語言一樣, SQL中也提供了用于定義各種類型的數(shù)據(jù)的功能。 SQL支持以下數(shù)據(jù)類型來指定關(guān)系/表的各種數(shù)據(jù)項或字段。 在SQL中,表的每一列都分配有一種數(shù)據(jù)類型,該數(shù)據(jù)類型傳達(dá)將存儲在該列中的值的類型。
SQL數(shù)據(jù)類型的類型 (Types of SQL Data Types)
Numeric data type:
數(shù)值數(shù)據(jù)類型 :
It includes datatypes like
它包括類似的數(shù)據(jù)類型
int, tinyint, bigint, float, real, etc.
int , tinyint , bigint , float , real等。
Date and Time data type:
日期和時間數(shù)據(jù)類型 :
It includes datatypes like
它包括類似的數(shù)據(jù)類型
Date, Time, Datetime, etc.
日期 , 時間 , 日期時間等等
Character and String datatype:
字符和字符串?dāng)?shù)據(jù)類型 :
It includes data types like
它包括類似的數(shù)據(jù)類型
char, varchar, text, etc.
char , varchar , text等。
Unicode character/string datatypes:
Unicode字符/字符串?dāng)?shù)據(jù)類型 :
It includes datatypes like
它包括類似的數(shù)據(jù)類型
nchar, nvarchar, ntext, etc.
nchar , nvarchar , ntext等。
Binary datatype:
二進(jìn)制數(shù)據(jù)類型 :
It includes datatypes like
它包括類似的數(shù)據(jù)類型
binary, varbinary, etc.
二進(jìn)制 , varbinary等
Miscellaneous datatype:
其他數(shù)據(jù)類型 :
It includes datatypes like
它包括類似的數(shù)據(jù)類型
clob, blob, xml, cursor, table, etc.
clob , blob , xml , 游標(biāo) , 表格等。
Many data types are discussed below...
下面討論了許多數(shù)據(jù)類型...
整數(shù)(數(shù)字) (Integer(Numeric))
It stores/represents positive whole number up to 11 digits and negative whole numbers upto 10 digits. The range of integers is from -2,147,483,648 to 2,147,483,647.
它存儲/表示最多11位數(shù)字的正整數(shù)和最多10位數(shù)字的負(fù)數(shù)。 整數(shù)的范圍是-2,147,483,648至2,147,483,647。
Syntax:
句法:
<INTEGER or integer>小靈通 (SMALLINT)
It is a 16-bit signed integer value that stores whole numbers in the range from -32768 to 32767. Its width is up to 5 digits.
它是一個16位帶符號整數(shù)值,存儲從-32768到32767范圍內(nèi)的整數(shù)。 寬度最大為5位數(shù)字。
Syntax:
句法:
<SMALLINT>數(shù)字 (NUMERIC)
Numbers are stored in the given format, where x is the total number of digits and y is the number of places to the right of the decimal point. x must include an extra place for the decimal point.
數(shù)字以給定的格式存儲,其中x是數(shù)字的總數(shù),y是小數(shù)點右邊的位數(shù)。 x必須在小數(shù)點后包含一個額外的位置。
Syntax:
句法:
<NUMERIC(x,y)>Example:
例:
Numeric(8,2)In the given example, numeric datatype stores a number that has 5 places before the decimal and 2 digits after the decimal and 1 digit place for the decimal point. Numeric holds up to 20 significant digits. A negative number holds one place for the sign, i.e.,(-)
在給定的示例中,數(shù)字?jǐn)?shù)據(jù)類型存儲一個數(shù)字,該數(shù)字在小數(shù)點前5位,小數(shù)點后2位,小數(shù)點后1位。 數(shù)字最多包含20個有效數(shù)字。 負(fù)數(shù)在符號處占一位,即( - )
十進(jìn)制 (DECIMAL)
Numbers are stored in the DECIMAL format, where x is the size,i.e., the total number of digits and y is precision, i.e., the number of places to the right of the decimal point.
數(shù)字以DECIMAL格式存儲,其中x是大小,即總位數(shù),y是精度,即小數(shù)點右邊的位數(shù)。
Syntax:
句法:
<DECIMAL(x,y) or DECIMAL(size,precision)>Example:
例:
Decimal(8,2)In the above example, decimal datatype stores a number that has 5 digits before the decimal and 2 digits after the decimal and 1 digit place for the decimal. Decimal holds up to 19 significant digits. A negative number uses one place for its sign(-).
在上面的示例中,十進(jìn)制數(shù)據(jù)類型存儲一個數(shù)字,該數(shù)字在小數(shù)點前5位,小數(shù)點后2位,小數(shù)點后1位。 十進(jìn)制最多可包含19個有效數(shù)字。 負(fù)數(shù)的符號(-)使用一個位。
字符(固定長度) (CHARACTER(fixed length))
This data type stores 'x' number of characters in the string. A maximum of 254 characters can be stored in a string. x or size is the number of characters to store which is of fixed length, to the number of characters specified. If you store strings that are not as long as the 'size' or 'x' parameter value, the remaining spaces are left unused.
此數(shù)據(jù)類型在字符串中存儲' x '個字符。 一個字符串中最多可以存儲254個字符。 x或size是要存儲的字符數(shù),其固定長度為指定字符數(shù)。 如果存儲的字符串的長度不超過' size '或' x '參數(shù)值,則剩余的空格將保持閑置狀態(tài)。
Syntax:
句法:
<CHAR(x) or CHAR(size)>Example:
例:
if you specify CHAR (10), strings such as "ram" and "technology" are each stored as 10 characters. However, a student admission_no is 6 digits long in a school, so CHAR(6) would be appropriate to store the admission_no of all the students. This data type is suitable where the number of characters to store is fixed. The values for CHAR data type have to be enclosed in single or double quotation marks.
如果指定CHAR(10) ,則諸如“ ram”和“ technology”之類的字符串均存儲為10個字符。 但是,學(xué)生的入學(xué)號在學(xué)校中為6位數(shù)字,因此CHAR(6)適合存儲所有學(xué)生的入學(xué)號 。 此數(shù)據(jù)類型適用于要存儲的字符數(shù)固定的情況。 CHAR數(shù)據(jù)類型的值必須用單引號或雙引號引起來。
字符(可變長度) (CHARACTER (variable length))
This data type is used to store variable-length alphanumeric data.
此數(shù)據(jù)類型用于存儲長度可變的字母數(shù)字?jǐn)?shù)據(jù)。
Syntax:
句法:
<VARCHAR(x) or VARCHAR2(x)>Example:
例:
The address of a student can be declared as VARCHAR (25) to store the address up to 25 characters long. The advantage of using this data type is that VARCHAR will not leave unused spaces. It releases the unused memory spaces.
可以將學(xué)生的地址聲明為VARCHAR(25),以存儲最多25個字符的地址。 使用此數(shù)據(jù)類型的優(yōu)點是VARCHAR不會留下未使用的空間。 釋放未使用的內(nèi)存空間。
日期 (DATE)
This data type is used to store a date in 'yyyy/mm/dd' format. It stores a year, month and date values. DATE values can be compared with each other only. The date decimal point values to be entered are to be enclosed in { } or with single quotation marks.
此數(shù)據(jù)類型用于以' yyyy / mm / dd '格式存儲日期。 它存儲年,月和日期值。 DATE值只能相互比較。 要輸入的日期小數(shù)點值將用{}括起來或用單引號引起來 。
Syntax:
句法:
<DATE>時間 (TIME)
This data type is used to store time in hh:mm:ss format. It stores hour, minute, and second values.
此數(shù)據(jù)類型用于以hh:mm:ss格式存儲時間。 它存儲小時,分鐘和秒值。
Syntax:
句法:
<TIME>For Example, a time of day can be taken as 12:30:45 p.m. where 12 means hours, 30 means minutes and 45 means seconds.
例如 ,一天中的某個時間可以設(shè)為12:30:45 pm,其中12表示小時,30表示分鐘,45表示秒。
BOOLEAN(邏輯) (BOOLEAN (logical))
This data type is used for storing logical values, either true or false. In both upper and lower case, T or Y stands for logical true and F or N stands for logical false. The fields with Boolean (logical) datatype can be compared only to other logical columns or constants.
此數(shù)據(jù)類型用于存儲邏輯值true或false 。 在大寫和小寫形式中, T或Y代表邏輯true , F或N代表邏輯false 。 具有布爾(邏輯)數(shù)據(jù)類型的字段只能與其他邏輯列或常量進(jìn)行比較。
Syntax:
句法:
<BOOLEAN>BLOB / RAW /長RAW (BLOB/RAW/LONG RAW)
This data type can store data up to a maximum length of 65535 characters. BLOBs are "Binary Large Objects" and are used to store large amounts of data, such as images, animations, clips or other types of files.
此數(shù)據(jù)類型最多可存儲65535個字符的數(shù)據(jù) 。 BLOB是“ 二進(jìn)制大對象 ”,用于存儲大量數(shù)據(jù),例如圖像,動畫,剪輯或其他類型的文件。
Syntax:
句法:
<BLOB or RAW or LONG RAW>For Example, image raw(2000);
例如 image raw(2000);
備忘/長 (MEMO/LONG)
This datatype allows storing characters or remarks upto 2 GB per second.
此數(shù)據(jù)類型允許每秒最多存儲2 GB的字符或注釋。
Syntax:
句法:
<MEMO or LONG>翻譯自: https://www.includehelp.com/sql/data-types.aspx
sql判斷數(shù)據(jù)庫類型數(shù)據(jù)
總結(jié)
以上是生活随笔為你收集整理的sql判断数据库类型数据_SQL数据类型的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java scanner_Java Sc
- 下一篇: linux 文件浏览器_浏览Linux文