Database Series Learning (ii)-creation and management of data tables

Source: Internet
Author: User

1. Data type

A: Integer type

Bit,int,smallint,tinyint

"Relative to the number of operating system bits"

B: Numeric type

Decimal,numeric,money,smallmoney,float,real

"Save Decimal"

C: Character-related types

Char,varchar,text,nchar,nvarchar,ntext

D: Date Time Type

DateTime (Accurate to 0.01 seconds), smalldatetime (accurate to minutes), timestamp

E: Binary type

Image

"By image, video to binary, save to database"

2. Managing data tables with SQL statements

A: Create A data table

B: Define a non-null constraint

C: Define default values

D: Define primary key

E: Define foreign keys

F: Modify an existing data table

G: Delete data table

"If you have a primary foreign key relationship, you must first delete the foreign key table"

H: Solution for limited operation

If you delete a field F1 in table T, you can first create a table that has the same structure as the table T, with the only difference being the missing field F1.

The data in table T is then imported into T1, then the T is deleted, and the table T1 is renamed to T.

Database Series Learning (ii)-creation and management of data tables

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.