sql判断数据库类型数据_SQL数据类型
sql判斷數據庫類型數據
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中也提供了用于定義各種類型的數據的功能。 SQL支持以下數據類型來指定關系/表的各種數據項或字段。 在SQL中,表的每一列都分配有一種數據類型,該數據類型傳達將存儲在該列中的值的類型。
SQL數據類型的類型 (Types of SQL Data Types)
Numeric data type:
數值數據類型 :
It includes datatypes like
它包括類似的數據類型
int, tinyint, bigint, float, real, etc.
int , tinyint , bigint , float , real等。
Date and Time data type:
日期和時間數據類型 :
It includes datatypes like
它包括類似的數據類型
Date, Time, Datetime, etc.
日期 , 時間 , 日期時間等等
Character and String datatype:
字符和字符串數據類型 :
It includes data types like
它包括類似的數據類型
char, varchar, text, etc.
char , varchar , text等。
Unicode character/string datatypes:
Unicode字符/字符串數據類型 :
It includes datatypes like
它包括類似的數據類型
nchar, nvarchar, ntext, etc.
nchar , nvarchar , ntext等。
Binary datatype:
二進制數據類型 :
It includes datatypes like
它包括類似的數據類型
binary, varbinary, etc.
二進制 , varbinary等
Miscellaneous datatype:
其他數據類型 :
It includes datatypes like
它包括類似的數據類型
clob, blob, xml, cursor, table, etc.
clob , blob , xml , 游標 , 表格等。
Many data types are discussed below...
下面討論了許多數據類型...
整數(數字) (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位數字的正整數和最多10位數字的負數。 整數的范圍是-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位帶符號整數值,存儲從-32768到32767范圍內的整數。 寬度最大為5位數字。
Syntax:
句法:
<SMALLINT>數字 (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.
數字以給定的格式存儲,其中x是數字的總數,y是小數點右邊的位數。 x必須在小數點后包含一個額外的位置。
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.,(-)
在給定的示例中,數字數據類型存儲一個數字,該數字在小數點前5位,小數點后2位,小數點后1位。 數字最多包含20個有效數字。 負數在符號處占一位,即( - )
十進制 (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.
數字以DECIMAL格式存儲,其中x是大小,即總位數,y是精度,即小數點右邊的位數。
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(-).
在上面的示例中,十進制數據類型存儲一個數字,該數字在小數點前5位,小數點后2位,小數點后1位。 十進制最多可包含19個有效數字。 負數的符號(-)使用一個位。
字符(固定長度) (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.
此數據類型在字符串中存儲' x '個字符。 一個字符串中最多可以存儲254個字符。 x或size是要存儲的字符數,其固定長度為指定字符數。 如果存儲的字符串的長度不超過' size '或' x '參數值,則剩余的空格將保持閑置狀態。
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個字符。 但是,學生的入學號在學校中為6位數字,因此CHAR(6)適合存儲所有學生的入學號 。 此數據類型適用于要存儲的字符數固定的情況。 CHAR數據類型的值必須用單引號或雙引號引起來。
字符(可變長度) (CHARACTER (variable length))
This data type is used to store variable-length alphanumeric data.
此數據類型用于存儲長度可變的字母數字數據。
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.
可以將學生的地址聲明為VARCHAR(25),以存儲最多25個字符的地址。 使用此數據類型的優點是VARCHAR不會留下未使用的空間。 釋放未使用的內存空間。
日期 (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.
此數據類型用于以' yyyy / mm / dd '格式存儲日期。 它存儲年,月和日期值。 DATE值只能相互比較。 要輸入的日期小數點值將用{}括起來或用單引號引起來 。
Syntax:
句法:
<DATE>時間 (TIME)
This data type is used to store time in hh:mm:ss format. It stores hour, minute, and second values.
此數據類型用于以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.
例如 ,一天中的某個時間可以設為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.
此數據類型用于存儲邏輯值true或false 。 在大寫和小寫形式中, T或Y代表邏輯true , F或N代表邏輯false 。 具有布爾(邏輯)數據類型的字段只能與其他邏輯列或常量進行比較。
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.
此數據類型最多可存儲65535個字符的數據 。 BLOB是“ 二進制大對象 ”,用于存儲大量數據,例如圖像,動畫,剪輯或其他類型的文件。
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.
此數據類型允許每秒最多存儲2 GB的字符或注釋。
Syntax:
句法:
<MEMO or LONG>翻譯自: https://www.includehelp.com/sql/data-types.aspx
sql判斷數據庫類型數據
總結
以上是生活随笔為你收集整理的sql判断数据库类型数据_SQL数据类型的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java scanner_Java Sc
- 下一篇: mysql镜像远程连接_docker 创