SQL Server Note 2

Source: Internet
Author: User

    1. Create and manage schemas

    2. Create a table

    3. FILESTREAM, spatial and date/time three types of data

    4. Create a computed column

    5. Define constraints to enhance data integrity

    6. Configure data storage options for compressed and sparse rows/columns



The purpose of any database and data platform is to store and manage data.

  1. The name of the object, or identifier. There are two types of identifiers: the general (regular) identifier and the delimited (delimited) identifier.

  2. Rules for identifiers:

    (1) Maximum of 128 characters

    (2) The first character must be a letter

    (3) cannot be T-SQL reserved words

    (4) cannot contain spaces or special characters

  3. Object names that do not conform to the rules of an identifier must be enclosed in quotation marks or square brackets [].

  4. Database objects use < instance >.< Database >.< schema >.< object > 4-part schema naming.

    The instance, database, and schema are optional. The strength name is unspecified, the object name defaults to the instance that is currently connected, the database name is unspecified, the current database context of the connection is used, the schema name is unspecified, and the default schema is used.

  5. All objects in the database are created under the schema. Schemas not only provide a way to group objects, but also provide security boundaries.

  6. common syntax for creating schemas :

    CREATE SCHEMA schema_name AUTHORIZATION owner_name

  7. One of the most fundamental differences between a database and a spreadsheet is that the database provides and enhances the structure of the data store.

  8. One of the most common data types in SQL Server is the numeric data type . There are 9 kinds of numeric data types: tinyint (0~255, 1 bytes), smallint ( -2768~32767,2 bytes), int ( -2^31 to 2^31-1, 4 bytes), bigint ( -2^63 to 2^63-1, 8 bytes), Decimal (P,s) ( -10^38+1 to 10^38-1), numeric (P,s) (-214 748.3648 to 214 748.3647, 4 bytes), smallmoney (9 bytes), Money (4 bytes), Real ( 4 bytes or 8 bytes).

  9. The decimal data type has two parameters: precision and scale. Precision, the sum of the number of digits around the decimal points. Precision, the number of decimal places to the right of the decimal point.

  10. character data Types : char (n), varchar (n), text, nchar (n), nvarchar (n), ntext. The first three types, 1 bytes per character, and the latter three types, 2 bytes per character.

  11. The Unicode character type begins with N, such as NCHAR (n), nvarchar (n), and ntext.


SQL Server Note 2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.