Varbinary –Variable-length binary data with a maximum length of 8,000 bytes Text –Variable-length non-Unicode data with a maximum length of 2^31 – 1 (2,147,483,647) charactersīinary –Fixed-length binary data with a maximum length of 8,000 bytes Varchar –Variable-length non-Unicode data with a maximum of 8,000 characters Smalldatetime –Date and time data from January 1, 1900, through June 6, 2079, with an accuracy of one minuteĬhar –Fixed-length non-Unicode character data with a maximum length of 8,000 characters Real –Floating precision number data from -3.40E + 38 through 3.40E + 38ĭatetime –Date and time data from January 1, 1753, to December 31, 9999, with an accuracy of one-three-hundredths of a second, or 3.33 milliseconds Smallmoney –Monetary data values from -214,748.3648 through +214,748.3647, with accuracy to one-ten-thousandth of a monetary unitįloat –Floating precision number data from -1.79E + 308 through 1.79E + 308 Uniqueidentifier –A globally unique identifier (GUID) Smallint –Integer data from 2^15 (-32,768) through 2^15 – 1 (32,767)ĭecimal –Fixed precision and scale numeric data from -10^38 -1 through 10^38 The data type, as described below, must be a system data type or a user-defined data type. Many of the data types have a size such as CHAR(35) or Numeric(8,2).īit –Integer data with either a 1 or 0 value Some examples of ColumnNames are FirstName and LastName. The ColumnName must be unique within the table. Each field in the CREATE TABLE has three parts (see above): Tablename is the name of the database table such as Employee. The general format for the CREATE TABLE command is:ĬolumnName, Datatype, Optional Column Constraint, Once the database is created, the next step is to create the database tables. The SQL statement CREATE is used to create the database and table structures.Ī new database named SW is created by the SQL statement CREATE DATABASE SW. The major SQL DDL statements are CREATE DATABASE and CREATE/DROP/ALTER TABLE. In Chapter 16, we will use SQL as a data manipulation language ( DML) to insert, delete, select and update data within the database tables. In this chapter, we will focus on using SQL to create the database and table structures, mainly using SQL as a data definition language ( DDL).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |