sql数据类型
SQL Data Types define the type of value that can be stored in a table column. For example, if we want a column to store only integer values, then we can define it’s data type as .
SQL数据类型定义可以存储在表列中的值的类型。 例如,如果我们希望一列仅存储整数值,则可以将其数据类型定义为 。
SQL data types can be broadly divided into following categories.
SQL数据类型可以大致分为以下几类。
- Numeric data types such as int, tinyint, bigint, float, real etc. 数值数据类型,例如int,tinyint,bigint,float,real等。
- Date and Time data types such as Date, Time, Datetime etc. 日期和时间数据类型,例如日期,时间,日期时间等。
- Character and String data types such as char, varchar, text etc. 字符和字符串数据类型,例如char,varchar,text等。
- Unicode character string data types, for example nchar, nvarchar, ntext etc. Unicode字符串数据类型,例如nchar,nvarchar,ntext等。
- Binary data types such as binary, varbinary etc. 二进制数据类型,例如binary,varbinary等。
- Miscellaneous data types – clob, blob, xml, cursor, table etc. 其他数据类型-clob,blob,xml,游标,表等
SQL数据类型要点 (SQL Data Types important points)
- Not all data types are supported by every relational database vendors. For example, Oracle database doesn’t support DATETIME and MySQL doesn’t support CLOB data type. So while designing database schema and writing sql queries, make sure to check if the data types are supported or not. 并非每个关系数据库供应商都支持所有数据类型。 例如,Oracle数据库不支持DATETIME,而MySQL不支持CLOB数据类型。 因此,在设计数据库架构和编写sql查询时,请确保检查是否支持数据类型。
- Data types listed here doesn’t include all the data types, these are the most popularly used data types. Some relational database vendors have their own data types that might be not listed here. For example, Microsoft SQL Server has and data types but since it’s not supported by other popular database vendors, it’s not listed here. 此处列出的数据类型并不包括所有数据类型,而是最常用的数据类型。 一些关系数据库供应商有其自己的数据类型,此处可能未列出。 例如,Microsoft SQL Server具有和数据类型,但是由于其他流行的数据库供应商不支持它,因此未在此处列出。
- Every relational database vendor has it’s own maximum size limit for different data types, you don’t need to remember the limit. Idea is to have the knowledge of what data type to be used in a specific scenario. 每个关系数据库供应商对于不同的数据类型都有自己的最大大小限制,您不必记住该限制。 想法是了解在特定情况下将使用哪种数据类型。
Let’s look into different categories of sql data types in detail.
让我们详细研究sql数据类型的不同类别。
SQL数值数据类型 (SQL Numeric Data Types)
SQL日期和时间数据类型 (SQL Date and Time Data Types)
SQL字符和字符串数据类型 (SQL Character and String Data Types)
Note that all the above data types are for character stream, they should not be used with unicode data.
请注意,以上所有数据类型均用于字符流,不应将它们与unicode数据一起使用。
SQL Unicode字符和字符串数据类型 (SQL Unicode Character and String Data Types)
Note that above data types are not supported in MySQL database.
请注意,MySQL数据库不支持上述数据类型。

SQL二进制数据类型 (SQL Binary Data Types)
SQL杂项数据类型 (SQL Miscellaneous Data Types)
That’s all for a quick roundup on SQL data types.
这就是快速汇总SQL数据类型的全部内容。
Reference: Oracle Database Data Types, mySQL Data Types
参考: Oracle数据库数据类型 , mySQL数据类型
翻译自: https://www.journaldev.com/16774/sql-data-types
sql数据类型

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/207556.html