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)

  1. Numeric data type:

    数值数据类型

    It includes datatypes like

    它包括类似的数据类型

    int, tinyint, bigint, float, real, etc.

    int , tinyint , bigint , float , real等。

  2. Date and Time data type:

    日期和时间数据类型

    It includes datatypes like

    它包括类似的数据类型

    Date, Time, Datetime, etc.

    日期 , 时间 , 日期时间等等

  3. Character and String datatype:

    字符和字符串数据类型

    It includes data types like

    它包括类似的数据类型

    char, varchar, text, etc.

    char , varchar , text等。

  4. Unicode character/string datatypes:

    Unicode字符/字符串数据类型

    It includes datatypes like

    它包括类似的数据类型

    nchar, nvarchar, ntext, etc.

    nchar , nvarchar , ntext等。

  5. Binary datatype:

    二进制数据类型

    It includes datatypes like

    它包括类似的数据类型

    binary, varbinary, etc.

    二进制 , varbinary等

  6. 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.

此数据类型用于存储逻辑值truefalse 。 在大写和小写形式中, TY代表逻辑trueFN代表逻辑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数据类型相关推荐

  1. sql 不同数据库同步数据_什么是SQL数据同步

    sql 不同数据库同步数据 SQL Data Sync is a service that allows synchronizing data across multiple Azure SQL da ...

  2. 了解SQL Server数据库静态数据及其如何适合数据库生命周期管理

    什么是静态数据 (What is static data) Static data (aka Code, Lookup, List or Reference data), in the context ...

  3. c#窗体点餐系统 使用sql server 数据库保存数据

    c#窗体点餐系统 使用sql server 数据库保存数据 登录界面 using System; using System.Collections.Generic; using System.Comp ...

  4. 利用SQl对数据库实行数据拆分与组合

    利用SQl对数据库实行数据拆分与组合实现提供以下几种方案: 方法一: WITH CTE AS ( SELECT A.Id,A.[Uid],UserName FROM ( SELECT A.[id], ...

  5. JAVA判断各种类型数据是否为空(亲测)

    1.判断list是否为空(Map.Set同list) if(list != null && list.size() == 0){ }if(list != null && ...

  6. SQL Server数据库六种数据移动方法

    1. 通过工具DTS的设计器进行导入或导出DTS的设计器功能强大,支持多任务,也是可视化界面,容易操作,但知道的人一般不多,如果只是进行SQL Server数据库中部分表的移动,用这种方法最好,当然, ...

  7. sql查看数据库线程数_SQL Server始终在可用性组数据库上的最大辅助线程

    sql查看数据库线程数 This article gives an overview of the Max Worker Threads for the SQL Server Always On Av ...

  8. mysql sql查询昨天的数据_sql语句,查询昨天的数据

    如果在程序中,有前台传来两个时间点:beginTime和endTime,在sql查询中的限制条件就是查询昨天的数据,那么可以这样写: 但是如果在这里要查询昨天的数据的话, 则不能简单地在开始时间的那里 ...

  9. sql 查询数据库索引重建_SQL查询性能的杀手– –了解不良的数据库索引

    sql 查询数据库索引重建 Poor indexing is one of the top performance killers, and we will focus on them in this ...

最新文章

  1. 解决android引用library project错误
  2. 浙江科技学院计算机专业录取分数线,浙江科技学院2017年艺术类本科专业录取分数线...
  3. android 模拟器配置上网_10 款主机模拟器,让你畅玩全球大作,嗨到飞起
  4. apache在win2003下的安全设置
  5. uos系统断网怎么安装mysql_【学习笔记】 UOS安装MySQL
  6. Android是否会因低价打败iPhone
  7. 静态static关键字修饰成员变量
  8. Request 接收参数乱码原理解析
  9. 阿里云 推荐码   为自己省钱
  10. csv文件转换成html,jQuery 把CSV文件数据转换为HTML表格(Bootstrap Table)
  11. amos看拟合度在哪里看_amos模型拟合度
  12. RHEL7挂载本地yum源
  13. 【2020总结】脚踏实地,仰望星空
  14. 使用SINet进行伪装目标检测
  15. 【转】我那实现了自己理想的创业老公,却一毛钱股份都没有拿到
  16. 【仿真】后仿真中的notifier是奏啥滴!
  17. Linux配置pip清华镜像源
  18. 重装系统(win7)
  19. 晨风机器人插件编辑器_晨风机器人文本编辑器
  20. 数据结构与算法入门——二叉树之平衡二叉树单螺旋双螺旋

热门文章

  1. php是静态语言,Thinkphp静态缓存多语言切换
  2. 2020年最快的dns_2020年哪里换旅行证最快取证?需要几天?
  3. 神经网络加载数据 自建数据集 官方数据集 pytorch 显示数据集
  4. 备份spfil、控制文件等
  5. 创造型模式——抽象工厂模式
  6. JDK源码解析之 java.lang.Thread
  7. Real提示“作为受限用户,您无足够的windows操作权限”的解决办法
  8. wordpress后台无法登录问题
  9. 使用pipenv代替virtualenv管理python包
  10. Python自动化开发学习13-联合唯一